Commit 9ce7449f by Adi Amir

update devops

parent cefd4dab
...@@ -2,21 +2,26 @@ docker special commands & procedures ...@@ -2,21 +2,26 @@ docker special commands & procedures
to kill a docker that refuses to go down normally to kill a docker that refuses to go down normally
------------------------------------------------- -------------------------------------------------
>dc -f mcx-external.yml stop orientdb
>dc -f mcx-external.yml rm -f orientdb
>systemctl restart docker.socket docker.service >systemctl restart docker.socket docker.service
>docker -f mcx-external.yml stop orientdb >dc -f mcx-external.yml stop orientdb
>docker -f mcx-external.yml rm -f orientdb >dc -f mcx-external.yml rm -f orientdb
verify with "docker ps" that the docker is not running
login into a running docker shell login into a running docker shell
--------------------------------- ---------------------------------
get the container-id by: docker ps get the container-id by: docker ps
docker exec -it <container-id> sh >docker exec -it <container-id> sh
create an image from a docker create an image from a docker
----------------------------- -----------------------------
get repository url by: docker images get repository url by: docker images
docker save 172.16.1.212:5050/ipgallery/public-safety-ic > psic2.tar >docker save 172.16.1.212:5050/ipgallery/public-safety-ic > psic2.tar
gzip & copy the zipped image file to target machine gzip & copy the zipped image file to target machine
...@@ -36,4 +41,4 @@ docker rmi <repositoy url> ...@@ -36,4 +41,4 @@ docker rmi <repositoy url>
show logs show logs
--------- ---------
docker-compose -f {yml file} logs >docker-compose -f {yml file} logs
\ No newline at end of file \ No newline at end of file
howto-install-jenkins-from-scratch.txt
Objective
step by step guide for installing Jenkins.
========================
prerequisites
========================
1. install ubuntu 16.04 or above
2. install java 1.8 or above
3. you need to make sure that all projects in gitlab are configured as follow:
a. in the relevant gitlab project setting - Project Visibility = public
b. in the relevant gitlab project setting - Allow users to request access = yes (check the box)
c. project name must be the same as the project name in jenkins.
==========================
install step-by-step guide
==========================
1. install docker
install the latest version of docker
ref: https://docs.docker.com/install/linux/docker-ce/ubuntu/
>apt-get update
>apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
>add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
>apt-get update
check that you version appears in the repository
>apt-cache madison docker-ce
>apt-get install docker-ce docker-ce-cli containerd.io
note: to install specific version see the reference link above
2. install latest official jenkins:
ref: https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-16-04
2.1 install
>wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
>apt-get update
>apt-get install jenkins
>systemctl start jenkins
>systemctl status jenkins
2.2 add 'jenkins' user to docker group & restart jenkins !!!
>usermod -a -G docker jenkins
>systemctl stop jenkins
>systemctl stat jenkins
note: if you re-install docker you need to perform this step again
2.3. configure jenkins
note: the home directory of jenkins is at: /var/lib/jenkins
- browse to http://172.16.1.138:8080
- enter the initial admin password.
the password is located at:
>cat /var/lib/jenkins/secrets/initialAdminPassword
- press in UI on installed suggested plugins.
- create first admin user in UI as instructed and login into Jenkins.
3. import jobs
extart from the latest Jenkins backup the 'job' directory.
- shutdown Jenkins
>systemctl stop jenkins
- copy the jobs (only!) directory from your latest backup to jenkins to jenkins home directory/var/lib/jenkins
- change permissions
>chown -R jenkins:jenkins jobs/*
- start Jenkins docker again
>systemctl start jenkins
>systemctl status jenkins
4. set gitlab_url environment in Jenkins
Follow youtube tutorial: "Learn to use global variable in jenkins,with simple demo"
https://www.youtube.com/watch?v=9r1g_idFkIs
- goto Jenkins >> manage Jenkins >> configure system
- in global properties section add:
environment variable:
name: gitlab_url
value: municipalitybank.com
5. install gradle
>wget https://services.gradle.org/distributions/gradle-3.2.1-bin.zip -P /tmp
>mkdir /opt/gradle
>unzip -d /opt/gradle /tmp/gradle-3.2.1-bin.zip
important note: the latest gradle 5.2.1 produced errors in resolving of packages !!!
use only 3.2.1 at this stage
======================================================================
...@@ -7,3 +7,22 @@ user: amira ...@@ -7,3 +7,22 @@ user: amira
password: giptmgrr password: giptmgrr
2. if we get an 403 forbidden while login into gitlab:
reference: https://stackoverflow.com/questions/36298959/gitlab-issuing-temporary-ip-bans-403-forbidden
- enter the gitlab docker in municipalitybanck.com
>docker exec -it volumenyc101_gitlab_1 bash
- Find the IPs that have been blocked in the production log:
>grep "Rack_Attack" /var/log/gitlab/gitlab-rails/production.log
- Since the blacklist is stored in Redis, you need to open up redis-cli:
>/opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket
- You can remove the block using the following syntax, replacing with the actual IP that is blacklisted:
>del cache:gitlab:rack::attack:allow2ban:ban:<your blocked ip>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment