Setting up CI CD for Admins
Documented below are the steps you will need to take on the Services VM to enable a new application to use the ABAIR CI/CD pipeline
1. Create Directory For Project
sudo mkdir /home/services/project-name
2. Add Deploy Script to Directory
- Replace the password
{see elsewhere}with the admin password you can find in ABAIR CI/CD.
deploy-project-name.sh
docker stop project-name
docker rm project-name
docker login 10.0.0.2:5000 -u admin -p {see elsewhere}
docker rmi 10.0.0.2:5000/project-name:main
docker pull 10.0.0.2:5000/project-name:main
docker run -t -d -p port:port --restart always --name project-name 10.0.0.2:5000/project-name:main
3. Generate SSH Keys
In order for the new GitHub Action to be able to SSH into the Services VM it needs its own private key.
Recommended: Use the generate-ssh-key.sh script which automates the steps below and prints the private key for easy copying.
Manual steps:
sudo su services
# Generate the key pair (replace project-name with actual name)
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/project-name_ed25519 -C "project-name Github Action" -N ""
# Add public key to authorized_keys so the VM accepts this key
cat ~/.ssh/project-name_ed25519.pub >> ~/.ssh/authorized_keys
# Print the private key to send to developer
cat ~/.ssh/project-name_ed25519
Send the private key to the developer to add as SSH_PRIVATE_KEY in GitHub.