Tuesday, September 8, 2020

Run Docker Container as a Service

 Ref: https://www.jetbrains.com/help/youtrack/standalone/run-docker-container-as-service.html


Docker team recommends to use cross-platform built-in restart policy for running container as a service. For this, configure your docker service to start on system boot and simply add parameter --restart unless-stopped to the docker run command that starts YouTrack.


However, when it comes to the sequential start of several services (including YouTrack), the restart policy method will not suit. You can use a process manager instead.


Here's an example of how to run YouTrack container as a service on Linux with help of systemd.


To run YouTrack container as a service on Linux with systemd:

Create a service descriptor file /etc/systemd/system/docker.youtrack.service:

[Unit]
Description=YouTrack Service
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker exec %n stop
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull jetbrains/youtrack:<version>
ExecStart=/usr/bin/docker run --rm --name %n \
    -v <path to data directory>:/opt/youtrack/data \
    -v <path to conf directory>:/opt/youtrack/conf \
    -v <path to logs directory>:/opt/youtrack/logs \
    -v <path to backups directory>:/opt/youtrack/backups \
    -p <port on host>:8080 \
    jetbrains/youtrack:<version>
[Install]
WantedBy=default.target


Enable starting the service on system boot with the following command:


systemctl enable docker.youtrack


You can also stop and start the service manually at any moment with the following commands, respectively:


sudo service docker.youtrack stop

sudo service docker.youtrack start


Friday, August 28, 2020

Docker insecure registry

 Edit file /usr/lib/systemd/system/docker.service

add --insecure-registry=myregistrydomain.com:5000

to line 

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock


reload and restart docker service

systemctl daemon-reload

service docker restart

Wednesday, August 5, 2020

T24 Error: No component defined. $PACKAGE is mandatory !

To fix the issue add this line to tafj.properties( in $TAFJ_HOME/conf folder)
 temn.tafj.compiler.component.strict.mode=false 

Tuesday, July 21, 2020

Import DUMP file in Oracle


  1. Create user and grant permission
    alter session set "_ORACLE_SCRIPT"=true;

    create user [username] identified by [password];
    grant connect, create session, imp_full_database to [username];
    CREATE SMALLFILE TABLESPACE [TABLESPACE_NAME] DATAFILE 'FILEDATA.dbf' SIZE 7G AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
    GRANT UNLIMITED TABLESPACE TO  [username];
  2. Create Directory
    CREATE DIRECTORY BACKUP_DIR AS '/home/oracle/import';
    GRANT read,write on DIRECTORY BACKUP_DIR to   [username];
  3. Import
     impdp [username]/[password] DIRECTORY=BACKUP_DIR  DUMPFILE=File.dmp FULL=Y LOGFILE=import.log

Sunday, June 21, 2020

WSO2 Micro Integrator- Remove Request Headers From Response

Add the name of the header to be removed as a property property

<property name="<name of the header to be removed>" scope="transport" action="remove"/>

Note : The above method removes only the specified headers from the response. If you need to remove all the headers, follow the instructions below.
Add the TRANSPORT_HEADERS property

<property name="TRANSPORT_HEADERS" action="remove" scope="axis2"/>

WSO2 Micro Integrator - Enable Jms transport

Edit file [MI_HOME]/conf/deployment.toml, add below lines:
[[transport.jms.listener]]
name = "myQueueListener"
parameter.initial_naming_factory = "com.ibm.mq.jms.context.WMQInitialContextFactory"
parameter.broker_name = "IBM MQ"
parameter.provider_url = "X.X.X.X:1416/Channel"
parameter.connection_factory_name = "connection_factory_name "
parameter.connection_factory_type = "queue"



[[transport.jms.sender]]
name = "myQueueSender"
parameter.initial_naming_factory = "com.ibm.mq.jms.context.WMQInitialContextFactory"
parameter.broker_name = "IBM MQ"
parameter.provider_url = "X.X.X.X:1416/Channel"
parameter.connection_factory_name = "connection_factory_name "
parameter.connection_factory_type = "queue"


Copying IBM Websphere MQ libraries

These instructions are tested on IBM WebSphere MQ version 8.0.0.4. However, you can follow them for other versions appropriately.
  • Create a new directory named wmq-client , and then create another new directory named lib inside it.
  • Copy the following JAR files from the <IBM_MQ_HOME>/java/lib/ directory (where <IBM_MQ_HOME> refers to the IBM WebSphere MQ installation directory) to the wmq-client/lib/ directory.
com.ibm.mq.allclient.jar
mqcontext.jar
jms.jar
providerutil.jar
  • Create a POM.xml file inside the wmq -client/ directory and add all the required dependencies as shown in the example below.
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>wmq-client</groupId>
<artifactId>wmq-client</artifactId>
<version>8.0.0.4</version>
<packaging>bundle</packaging>
<dependencies>
    <dependency>
        <groupId>com.ibm</groupId>
        <artifactId>fscontext</artifactId>
        <version>8.0.0.4</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/mqcontext.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.ibm</groupId>
        <artifactId>providerutil</artifactId>
        <version>8.0.0.4</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/providerutil.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>com.ibm</groupId>
        <artifactId>allclient</artifactId>
        <version>8.0.0.4</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/com.ibm.mq.allclient.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>jms</artifactId>
        <version>1.1</version>
        <scope>system</scope>
        <systemPath>${basedir}/lib/jms.jar</systemPath>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.3.4</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                    <Bundle-Name>${project.artifactId}</Bundle-Name>
                    <Export-Package>*;-split-package:=merge-first</Export-Package>
                    <Private-Package/>
                    <Import-Package/>
                    <Embed-Dependency>*;scope=system;inline=true</Embed-Dependency>
                    <DynamicImport-Package>*</DynamicImport-Package>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>
</project>
  • Navigate to the wmq -client directory using your Command Line Interface (CLI), and execute the following command, to build the project: mvn clean install
  • Stop the WSO2 Micro Integrator, if it is already running.
  • Remove any existing IBM MQ client JAR files from the MI_HOME/dropins directory and the MI_HOME/lib directory.
  • Copy the <wmq-client>/target/wmq-client-8.0.0.4.jar file to the MI_HOME/dropins directory.
  • Download the jta.jar file from the maven repository, and copy it to the MI_HOME/lib directory.
Reference: https://ei.docs.wso2.com/en/7.1.0/micro-integrator/setup/brokers/configure-with-IBM-websphereMQ

Sunday, June 14, 2020

JBOSS 7.3 connect to remote ActiveMQ


  1. Create mododule ActiveMQ
    mkdir -pv $JBOSS_HOME/modules/system/layers/base/org/apache/activemq/main
    cp activemq-all-5.15.9.jar $JBOSS_HOME/modules/system/layers/base/org/apache/activemq/main
    Create module.xml with content below:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.5" name="org.apache.activemq">
       <resources>
            <resource-root path="activemq-all-5.15.9.jar"/>
        </resources>
        <dependencies>
            <module name="javax.api"/>
            <module name="javax.jms.api"/>
        </dependencies>
    </module>
  2. Choose "Configuration -> Naming -> Binding" click Add(external-context)
    Class: javax.naming.InitialContext
    Environment:
    java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
    java.naming.provider.url=tcp://xxxxx:61616
    Module: org.apache.activemq
    Name: java:global/remoteContext
    Binding Type: external-context
  3. Choose "Configuration -> Naming -> Binding" click Add(lookup) for ConnectionFactory, Queue,..
    Binding Type: lookup
    Lookup: java:global/remoteContext/ConnectionFactory

Install and use xorg-server on macOS via Homebrew

  The instructions to install and use xorg-server on macOS via Homebrew: Install Homebrew (if you haven't already): /bin/bash -c ...