We are using basic Jenkins Docker image from here
- Download and run docker image
docker run -p 8080:8080 jenkins/jenkins:lts
- Copy password from console. It will looks like this:
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
e6ba76b405f848678a9f3f65ce858500
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword
- Navigate to localhost:8080 and paste the password
Note, if you're using Docker Toolbox, navigate to 192.168.99.100:8080
-
Hit "Install suggested plugin" button
-
Create first admin user by setting next data:
Username: admin
Password: admin
Full name: admin
E-mail address: admin@gmail.com
-
Add ThinBackup and SaveRestart plugins
-
Clone rr-jenkins repository
Note, it might take a while as the Jenkins backup file is quite big
git clone -b master https://github.com/royalrangers-ck/rr-jenkins.git
- Copy backup to the Jenkins container:
docker cp c:\workspace\rr-jenkins\backup\ f02f25169709:/tmp/
- Restore backup using ThinBackup plugin
Note, don't forget to set backup directory to: /tmp/backup
- Hit "Safe Restart" button
- Go to Manage Jenkins > Configure System > Publish over SSH
- Insert your RSA PRIVATE KEY
- Add your SSH Server, ex.:
name: rr-main
hostname: royalrangers.online
username: root
remote directory: /tmp
- Click Test Configuration button to test your config!
Freestyle project
- Go to Build Environment
- Check Send files or execute commands over SSH before the build starts
- Add exec command, e.g.:
FILE_NAME="rr-api"
SCRIPT_PATH="/usr/src/app/rr-docker/scripts/$FILE_NAME.sh"
sudo chmod +x "$SCRIPT_PATH"
sudo sh "$SCRIPT_PATH"
Freestyle project
- Go to Build Environment
- Check Send files or execute commands over SSH before the build starts
- Add exec command, e.g.:
FILE_NAME="rr-web-app"
SCRIPT_PATH="/usr/src/app/rr-docker/scripts/$FILE_NAME.sh"
sudo chmod +x "$SCRIPT_PATH"
sudo sh "$SCRIPT_PATH"
Freestyle project
- Go to Build Environment
- Check Send files or execute commands over SSH before the build starts
- Add exec command, e.g.:
printf "\nShow list of containers\n"
docker ps -a
echo "Done!"
printf "\nCheck Available Space\n"
df -h
echo "Done!"
printf "\nCheck swap & memory\n"
free -h
echo "Done!"