Saturday, October 31, 2020

Install letsencrypt cer to trust CA in ubuntu

Install ca-certificates

sudo apt-get install ca-certificates

Down load cer from letsencrypt

cd /usr/share/ca-certificates
sudo wget https://letsencrypt.org/certs/isrgrootx1.pem  -O isrgrootx1.crt
sudo wget https://letsencrypt.org/certs/letsencryptauthorityx3.pem  -O letsencryptauthorityx3.crt

Update CA

sudo dpkg-reconfigure ca-certificates

Wednesday, October 14, 2020

Endpoint is not Created for Service in Kubernetes

The Problem

Endpoints shows ‘none’:

$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.yy.0.1 <none> 443/TCP 9d
test ClusterIP 10.xx.97.97 <none> 6379/TCP 21s
$ kubectl describe svc test
Name: test
Namespace: default
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"test","namespace":"default"},"spec":{"clusterIP":"10.xx.97.97","...
Selector: app=test
Type: ClusterIP
IP: 10.xx.97.97
Port: <unset> 6379/TCP
TargetPort: 6379/TCP
Endpoints: <none>
Session Affinity: None
Events: <none>

The Solution

The service selector doesn’t match any Pod’s labels.

$ kubectl get pods --show-labels |egrep 'app=test'
$

1. Edit the yaml file and correct the selector to match the Pod’s label.

$ kubectl get pods --show-labels |egrep 'app=filebeat'
myapp-ds-c2fwm 1/1 Running 0 21h app=filebeat,controller-revision-hash=54ccfc87bd,pod-template-generation=1,release=stable
myapp-ds-rbn4z 1/1 Running 0 21h app=filebeat,controller-revision-hash=54ccfc87bd,pod-template-generation=1,release=stable
$ vi test-svc.yaml
apiVersion: v1
apiVersion: v1
kind: Service
metadata:
name: test
namespace: default
spec:
selector:
app: filebeat
clusterIP: 10.xx.97.97
type: ClusterIP
ports:
- port: 6379
targetPort: 6379

2. Apply the configuration:

$ kubectl apply -f test-svc.yaml
service/test created
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.yy.0.1  443/TCP 9d
test ClusterIP 10.xx.97.97  6379/TCP 29m

3. Show the details of the service:

$ kubectl describe svc test
Name: test
Namespace: default
Labels: [none]
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"test","namespace":"default"},"spec":{"clusterIP":"10.xx.97.97","...
Selector: app=filebeat
Type: ClusterIP
IP: 10.xx.97.97
Port: [unset] 6379/TCP
TargetPort: 6379/TCP
Endpoints: 10.zzz.1.38:6379,10.zzz.2.36:6379
Session Affinity: None
Events: [none]
$ kubectl get endpoints test
NAME ENDPOINTS AGE
test 10.zzz.1.38:6379,10.zzz.2.36:6379 39m

 Ref: https://www.thegeekdiary.com/endpoint-is-not-created-for-service-in-kubernetes/

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"/>

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 ...