diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e94445..49fa5e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,7 +63,29 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - deploy: + copy-to-server: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run a one-line script + run: echo Hello from Octo Organization + + - name: rsync deployment + # You may pin to the exact commit or the version. + # uses: Burnett01/rsync-deployments@45d84ad5f6c174f3e0ffc50e9060a9666d09c16e + uses: Burnett01/rsync-deployments@6.0.0 + with: + switches: -avzr --delete + # path: src/ + # remote_path is the path under which "path" is checked out + # default is repo root - top-level files/dirs + remote_path: ${{ secrets.DEPLOY_PATH }} + remote_host: ${{ secrets.DEPLOY_HOST }} + remote_port: ${{ secrets.DEPLOY_PORT }} + remote_user: ${{ secrets.DEPLOY_USER }} + remote_key: ${{ secrets.CI_PRIVATE_KEY }} + + restart-services: runs-on: ubuntu-latest steps: - name: Execute SSH commmands on remote server @@ -75,5 +97,5 @@ jobs: privateKey: ${{ secrets.CI_PRIVATE_KEY }} debug: false command: | + /usr/bin/cp /home/princeton/config/.env.* /home/princeton/deployed/ /usr/bin/systemctl start deploy-princetonpy.service - echo "I am $NAME" diff --git a/.github/workflows/rsync.yml b/.github/workflows/rsync.yml deleted file mode 100644 index 7e32644..0000000 --- a/.github/workflows/rsync.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: princetonpy.org rsync - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run a one-line script - run: echo Hello from Octo Organization - - - name: rsync deployment - # You may pin to the exact commit or the version. - # uses: Burnett01/rsync-deployments@45d84ad5f6c174f3e0ffc50e9060a9666d09c16e - uses: Burnett01/rsync-deployments@6.0.0 - with: - switches: -avzr --delete - # path: src/ - # remote_path is the path under which "path" is checked out - # default is repo root - top-level files/dirs - remote_path: ${{ secrets.DEPLOY_PATH }} - remote_host: ${{ secrets.DEPLOY_HOST }} - remote_port: ${{ secrets.DEPLOY_PORT }} - remote_user: ${{ secrets.DEPLOY_USER }} - remote_key: ${{ secrets.CI_PRIVATE_KEY }} diff --git a/devops/systemd/princetonpy-cron.service b/devops/systemd/princetonpy-cron.service index 0db3712..f4fc679 100644 --- a/devops/systemd/princetonpy-cron.service +++ b/devops/systemd/princetonpy-cron.service @@ -7,10 +7,10 @@ Requires=docker.service TimeoutStartSec=120 Restart=always ExecStart=/usr/bin/docker compose \ - -f /home/princetonpy/repos/princetonpy/docker-compose.prod.yml \ + -f /home/princetonpy/deployed/docker-compose.prod.yml \ up cron ExecStop=/usr/bin/docker compose \ - -f /home/princetonpy/repos/princetonpy/docker-compose.prod.yml \ + -f /home/princetonpy/deployed/docker-compose.prod.yml \ down cron [Install] diff --git a/devops/systemd/princetonpy-web.service b/devops/systemd/princetonpy-web.service index 66be858..38cb316 100644 --- a/devops/systemd/princetonpy-web.service +++ b/devops/systemd/princetonpy-web.service @@ -1,5 +1,5 @@ [Unit] -Description=PrincetonPy service +Description=PrincetonPy web service After=docker.service Requires=docker.service @@ -7,10 +7,10 @@ Requires=docker.service TimeoutStartSec=120 Restart=always ExecStart=/usr/bin/docker compose \ - -f /home/princetonpy/repos/princetonpy/docker-compose.prod.yml \ + -f /home/princetonpy/deployed/docker-compose.prod.yml \ up web ExecStop=/usr/bin/docker compose \ - -f /home/princetonpy/repos/princetonpy/docker-compose.prod.yml \ + -f /home/princetonpy/deployed/docker-compose.prod.yml \ down web [Install]