jenkins reset password

edit /var/lib/jenkins/users/username/config.xml

<password> replace below string </password>

#jbcrypt:$2a$10$razd3L1aXndFfBNHO95aj.IVrFydsxkcQCcLmujmFQzll3hcUrY7S

password= test

Delete common rows between tables


tableA                                                        
apple@gmail.com
ram@gmail.com
user@hotmail.com
jai@qqmail.com
bai@example.com

tableB
ram@gmail.com
jai@qqmail.com

Query

delete
    from tableA
where exists
  ( select 1 
         from tableB
          where email = tableA.email )

Resulting table tableA  where common item from tableB is deleted: 

TableA
apple@gmail.com
user@hotmail.com
bai@example.com

part 5 dockerizing simple flask application and docker exec

### vim Dockerfile

FROM python:3.5
RUN pip install  Flask==0.11.1
RUN useradd -ms /bin/bash admin
USER admin
WORKDIR /app
COPY app /app
CMD ["python", "app.py"]

###

docker build -t urgen/dockerapp:1.01

docker images   <copy imageid>

docker run -d -p 5000:8080

    -d = run container in background
    -p = expose port
    5000 = port of container
    8080 = port of real host


user1@localhost ~ $ docker run -d -i -t busybox
8ba73738bf52630e31106be2f3a1cb4d4e0ab8f79d311f38c6ec8ff5ce7eba24

# to docker exec the container must be running in background (-d option)
docker exec -it 8ba73738bf52630e31106be2f3a1cb4d4e0ab8f79d311f38c6ec8ff5ce7eba24  sh

part 4 push docker image to docker hub public

1) docker images  ## list images

docker tag  <image id>  <docker hub repositoryname>:<tag>

2) docker tag  c75bebcdd211 urgensherpa2/box1:1.01

docker login --username=urgensherpa2
password:
Login succeed

3) docker push urgensherpa2/box1:1.01

part 4 docker automate building images

Build docker images

   docker file - is text doc that contains all the instructions to assemble the image

By default the filename is "Dockerfile" where we put all the instructions

cd /home/user1/

# vim Dockerfile
FROM debian:jessie
RUN apt-get update
RUN apt-get install -y git vim rsync
COPY localfile.txt  /src/localfile.txt   ##copy local file to containers /src/ directory ..look ADD command too!

docker build -t repositoryname:tag .


docker build -t vieux/apache:2.0 .

docker build -t urgen/dockerfiledemo -f Dockerfile /home/user1/

docker build -t urgen/dockerfiledemo -f customdockerfilemame /home/user1/

OR

docker build -t ubuntu:latest .

    --tag, -t  = Name and optionally a tag in the ‘name:tag’ format
    --file, -f = Name of the Dockerfile (Default is ‘PATH/Dockerfile’)


in screenshot "Dockerfile" is saved at /home/user1/docker directory

part 3 docker build images and commit , delete and stop running containers

Docker image is made up of list of readonly layes that represent filesystem differences. image layers are stacked on top of each other to form up a base for container's filesystem

Install GIT in a base image called ubuntu:latest

# docker run -it ubuntu:latest
apt-get update && apt-get install -y git

exit

# docker ps -a     ...grab container id


Docker commit - Create a new image from a container's changes
## commit changes and save to a new container named ubuntu:1.00
docker commit 4188d246e83c urg3n/ubuntu:1.00

docker commit d823hjhd8fj2    repositoryname:tag

# list new images created
--> docker images

docker run -it urg3n/ubuntu:1.00

## Delete container !!! ##

docker ps -a   and grab container id

docker rm 247e45581fed    ### removes container with ID 247e45581fed

part 2 docker port mapping and run in background

## remove docker container after running the command called "sleep 100"
docker run --rm busybox:1.24  sleep 100

## specify name for docker container we want to run
docker run  --name  mycontainer100 busybox:1.24
docker run  --name  mycontainer200 busybox:latest
docker ps -a

docker inspect containerid
##outpus image id , logpath,mac id

user1@localhost$ docker run -d busybox:latest sleep 10
a7393fc5cc8e1db7e87b9eb24151147

user1@localhost$ docker inspect a7393fc5cc8e1db7e87b9eb24151147


### docker tomcat
expose container port 8080 to host port 8888

docker run -it -p 8888:8080 tomcat:8.0

-->open browser--goto--> localhost:8888  it willopen tomcat server


# run container in detached mode

docker run -it -d -p 8888:8080 tomcat:8.0 

docker exec <name> /bin/cat /etc/profile
docker logs <name>

#docker run -d -p <hostport>:<containerPort>  nginx:latest

a7393fc5cc8e1db7e87b9eb24151147sf
docker logs a7393fc5cc8e1db7e87b9eb24151147sf

# Docker attach or login into the running container :-

docker exec -it containeridORname /bin/bash

# Docker management
# delete all containers
docker ps -aq | xargs docker rm -f

docker logs <cont id>   # view the output logs of container






mysql database size

To determine the sizes of all of your databases, at the mysql> prompt type the following command:

SELECT table_schema AS "Database", 
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" 
FROM information_schema.TABLES 
GROUP BY table_schema;


To determine the sizes of all of the tables in a specific database, at the mysql> prompt, type the following command. Replace database_name with the name of the database that you want to check:

SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
ORDER BY (data_length + index_length) DESC;

git dealing with remotes

Add a remote

git remote add origin https://github.com/user/repo.git
# Set a new remote

git remote -v
# Verify new remote
origin  https://github.com/user/repo.git (fetch)
origin  https://github.com/user/repo.git (push)

Remove remote

git remote -v
# View current remotes
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)
destination  https://github.com/FORKER/REPOSITORY.git (fetch)
destination  https://github.com/FORKER/REPOSITORY.git (push)

git remote rm destination
# Remove remote
git remote -v
# Verify it's gone
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)



Rename the remote

git remote -v
# View existing remotes
origin  https://github.com/OWNER/REPOSITORY.git (fetch)
origin  https://github.com/OWNER/REPOSITORY.git (push)

git remote rename origin destination
# Change remote name from 'origin' to 'destination'

git remote -v
# Verify remote's new name
destination  https://github.com/OWNER/REPOSITORY.git (fetch)
destination  https://github.com/OWNER/REPOSITORY.git (push)


remote add origin git@gitlab.com:urg3n/mailservice935dovecot.git

git push origin master

postfix firewall daemon postfwd

https://www.vooservers.com/technical-blog/rate-limit-outbound-mail-in-postfix/