Skip to content

mdr223 deploys A2rchi to dev #272

mdr223 deploys A2rchi to dev

mdr223 deploys A2rchi to dev #272

Workflow file for this run

name: Deploy A2rchi Dev
run-name: ${{ github.actor }} deploys A2rchi to dev
on:
push:
branches:
- main
- feature/grafana
jobs:
deploy-dev-system:
runs-on: ubuntu-latest
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
steps:
# boilerplate message and pull repository to CI runner
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- uses: actions/checkout@v3
- run: echo "The ${{ github.repository }} repository has been cloned to the runner."
# setup SSH
- name: Setup SSH
run: |
mkdir -p /home/runner/.ssh/
echo "${{ secrets.SSH_PRIVATE_KEY_MDRUSSO }}" > /home/runner/.ssh/id_rsa_submit
chmod 600 /home/runner/.ssh/id_rsa_submit
echo "${{ secrets.SSH_SUBMIT_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
cp ${{ github.workspace }}/deploy/ssh_config /home/runner/.ssh/config
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add /home/runner/.ssh/id_rsa_submit
# create secrets files for docker-compose
- name: Create Secrets Files
run: |
mkdir -p ${{ github.workspace }}/deploy/dev/secrets/
touch ${{ github.workspace }}/deploy/dev/secrets/imap_user.txt
echo "${{ secrets.DEV_IMAP_USER }}" >> ${{ github.workspace }}/deploy/dev/secrets/imap_user.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/imap_user.txt
touch ${{ github.workspace }}/deploy/dev/secrets/imap_pw.txt
echo "${{ secrets.DEV_IMAP_PW }}" >> ${{ github.workspace }}/deploy/dev/secrets/imap_pw.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/imap_pw.txt
touch ${{ github.workspace }}/deploy/dev/secrets/cleo_url.txt
echo "${{ secrets.DEV_CLEO_URL }}" >> ${{ github.workspace }}/deploy/dev/secrets/cleo_url.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/cleo_url.txt
touch ${{ github.workspace }}/deploy/dev/secrets/cleo_user.txt
echo "${{ secrets.DEV_CLEO_USER }}" >> ${{ github.workspace }}/deploy/dev/secrets/cleo_user.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/cleo_user.txt
touch ${{ github.workspace }}/deploy/dev/secrets/cleo_pw.txt
echo "${{ secrets.DEV_CLEO_PW }}" >> ${{ github.workspace }}/deploy/dev/secrets/cleo_pw.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/cleo_pw.txt
touch ${{ github.workspace }}/deploy/dev/secrets/cleo_project.txt
echo "${{ secrets.DEV_CLEO_PROJECT }}" >> ${{ github.workspace }}/deploy/dev/secrets/cleo_project.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/cleo_project.txt
touch ${{ github.workspace }}/deploy/dev/secrets/sender_server.txt
echo "${{ secrets.DEV_SENDER_SERVER }}" >> ${{ github.workspace }}/deploy/dev/secrets/sender_server.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/sender_server.txt
touch ${{ github.workspace }}/deploy/dev/secrets/sender_port.txt
echo "${{ secrets.DEV_SENDER_PORT }}" >> ${{ github.workspace }}/deploy/dev/secrets/sender_port.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/sender_port.txt
touch ${{ github.workspace }}/deploy/dev/secrets/sender_replyto.txt
echo "${{ secrets.DEV_SENDER_REPLYTO }}" >> ${{ github.workspace }}/deploy/dev/secrets/sender_replyto.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/sender_replyto.txt
touch ${{ github.workspace }}/deploy/dev/secrets/sender_user.txt
echo "${{ secrets.DEV_SENDER_USER }}" >> ${{ github.workspace }}/deploy/dev/secrets/sender_user.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/sender_user.txt
touch ${{ github.workspace }}/deploy/dev/secrets/sender_pw.txt
echo "${{ secrets.DEV_SENDER_PW }}" >> ${{ github.workspace }}/deploy/dev/secrets/sender_pw.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/sender_pw.txt
touch ${{ github.workspace }}/deploy/dev/secrets/flask_uploader_app_secret_key.txt
echo "${{ secrets.DEV_FLASK_UPLOADER_APP_SECRET_KEY }}" >> ${{ github.workspace }}/deploy/dev/secrets/flask_uploader_app_secret_key.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/flask_uploader_app_secret_key.txt
touch ${{ github.workspace }}/deploy/dev/secrets/uploader_salt.txt
echo "${{ secrets.DEV_UPLOADER_SALT }}" >> ${{ github.workspace }}/deploy/dev/secrets/uploader_salt.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/uploader_salt.txt
touch ${{ github.workspace }}/deploy/dev/secrets/openai_api_key.txt
echo "${{ secrets.OPENAI_API_KEY }}" >> ${{ github.workspace }}/deploy/dev/secrets/openai_api_key.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/openai_api_key.txt
touch ${{ github.workspace }}/deploy/dev/secrets/hf_token.txt
echo "${{ secrets.HF_TOKEN }}" >> ${{ github.workspace }}/deploy/dev/secrets/hf_token.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/hf_token.txt
touch ${{ github.workspace }}/deploy/dev/secrets/pg_password.txt
echo "${{ secrets.DEV_PG_PASSWORD }}" >> ${{ github.workspace }}/deploy/dev/secrets/pg_password.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/pg_password.txt
touch ${{ github.workspace }}/deploy/dev/secrets/grafana_password.txt
echo "${{ secrets.DEV_GRAFANA_PASSWORD }}" >> ${{ github.workspace }}/deploy/dev/secrets/grafana_password.txt
chmod 400 ${{ github.workspace }}/deploy/dev/secrets/grafana_password.txt
# create env file to set tag(s) for docker-compose
- name: Create Env File
run: |
touch ${{ github.workspace }}/deploy/dev/.env
export tag="${GITHUB_REF#refs/heads/}"
export tag="${tag//\//-}.${GITHUB_SHA}"
echo "TAG=${tag}" >> ${{ github.workspace }}/deploy/dev/.env
# stop any existing docker compose that's running
- name: Stop Docker Compose
run: |
ssh submit06 'bash -s' < ${{ github.workspace }}/deploy/dev/dev-stop.sh
# copy repository to machine
- name: Copy Repository
run: |
rsync -e ssh -r ${{ github.workspace}}/* --exclude .git/ --delete submit06:~/A2rchi-dev/
# run deploy script
- name: Run Deploy Script
run: |
export tag="${GITHUB_REF#refs/heads/}"
export tag="${tag//\//-}.${GITHUB_SHA}"
sed -i "s/BASE_TAG/${tag}/" ${{ github.workspace }}/deploy/dev/dev-install.sh
ssh submit06 'bash -s' < ${{ github.workspace }}/deploy/dev/dev-install.sh
# clean up secret files
- name: Remove Secrets from Runner
run: |
rm ${{ github.workspace }}/deploy/dev/secrets/*.txt
# print job status
- run: echo "🍏 This job's status is ${{ job.status }}."