From f5dbbe78103bab9524619644c786a03efecd42c7 Mon Sep 17 00:00:00 2001 From: BeritJanssen Date: Mon, 27 May 2024 11:31:25 +0200 Subject: [PATCH 1/4] fix: return correct content for first_round --- backend/experiment/rules/thats_my_song.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/experiment/rules/thats_my_song.py b/backend/experiment/rules/thats_my_song.py index 2393328d8..82ad44fb6 100644 --- a/backend/experiment/rules/thats_my_song.py +++ b/backend/experiment/rules/thats_my_song.py @@ -55,7 +55,7 @@ def get_info_playlist(self, filename): def first_round(self, experiment): actions = super().first_round(experiment) # skip Consent and Playlist action - return actions[:1] + return [actions[0]] def next_round(self, session): """Get action data for the next round""" From 82be5090716e7c842c430c5dfef25dd7076466e8 Mon Sep 17 00:00:00 2001 From: Drikus Roor Date: Mon, 27 May 2024 11:32:46 +0200 Subject: [PATCH 2/4] CI: Configure deployment to Production server (#1015) * CI: Deploy to production environment with updated environment variables and build Podman images * chore: Temporarily run podman workflow for prod environment on ci/deploy-prod branch * chore: Update podman.yml workflow conditions for prod environment on ci/deploy-prod branch --- .github/workflows/podman.yml | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/.github/workflows/podman.yml b/.github/workflows/podman.yml index 676347d0f..14ce08306 100644 --- a/.github/workflows/podman.yml +++ b/.github/workflows/podman.yml @@ -190,3 +190,87 @@ jobs: - name: Check logs run: podman-compose -f docker-compose-deploy.yml logs + deploy-production: + name: Deploy to production environment + environment: Production + runs-on: PRD + + # this job runs only on tags + if: github.ref == 'refs/tags/*' + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + env: + # Variables + AML_ALLOWED_HOSTS: ${{ vars.AML_ALLOWED_HOSTS }} + AML_CORS_ORIGIN_WHITELIST: ${{ vars.AML_CORS_ORIGIN_WHITELIST }} + AML_DEBUG: ${{ vars.AML_DEBUG }} + AML_LOCATION_PROVIDER: ${{ vars.AML_LOCATION_PROVIDER }} + AML_SUBPATH: ${{ vars.AML_SUBPATH }} + DJANGO_SETTINGS_MODULE: ${{ vars.DJANGO_SETTINGS_MODULE }} + SENTRY_ENVIRONMENT: "acceptance" + SQL_DATABASE: ${{ vars.SQL_DATABASE }} + SQL_HOST: ${{ vars.SQL_HOST }} + SQL_PORT: ${{ vars.SQL_PORT }} + FRONTEND_API_ROOT: ${{ vars.FRONTEND_API_ROOT }} + FRONTEND_EXPERIMENT_SLUG: ${{ vars.FRONTEND_EXPERIMENT_SLUG }} + FRONTEND_AML_HOME: ${{ vars.FRONTEND_AML_HOME }} + FRONTEND_HTML_PAGE_TITLE: ${{ vars.FRONTEND_HTML_PAGE_TITLE }} + FRONTEND_HTML_FAVICON: ${{ vars.FRONTEND_HTML_FAVICON || '' }} + FRONTEND_LOGO_URL: ${{ vars.FRONTEND_LOGO_URL || '' }} + FRONTEND_HTML_OG_DESCRIPTION: ${{ vars.FRONTEND_HTML_OG_DESCRIPTION || '' }} + FRONTEND_HTML_OG_IMAGE: ${{ vars.FRONTEND_HTML_OG_IMAGE || '' }} + FRONTEND_HTML_OG_TITLE: ${{ vars.FRONTEND_HTML_OG_TITLE || '' }} + FRONTEND_HTML_OG_URL: ${{ vars.FRONTEND_HTML_OG_URL || '' }} + FRONTEND_HTML_BODY_CLASS: ${{ vars.FRONTEND_HTML_BODY_CLASS || '' }} + + # Secrets + AML_SECRET_KEY: ${{ secrets.AML_SECRET_KEY }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + SQL_USER: ${{ secrets.SQL_USER }} + SQL_PASSWORD: ${{ secrets.SQL_PASSWORD }} + FRONTEND_SENTRY_DSN: ${{ secrets.FRONTEND_SENTRY_DSN }} + DJANGO_SUPERUSER_USERNAME: ${{ secrets.DJANGO_SUPERUSER_USERNAME }} + DJANGO_SUPERUSER_PASSWORD: ${{ secrets.DJANGO_SUPERUSER_PASSWORD }} + DJANGO_SUPERUSER_EMAIL: ${{ secrets.DJANGO_SUPERUSER_EMAIL }} + # Prevent podman services from exiting after startup + RUNNER_TRACKING_ID: "" + steps: + - uses: actions/checkout@v4 + - name: Create .env file + run: | + touch .env + echo "VITE_API_ROOT=$FRONTEND_API_ROOT" >> .env + echo "VITE_EXPERIMENT_SLUG=$FRONTEND_EXPERIMENT_SLUG" >> .env + echo "VITE_AML_HOME=$FRONTEND_AML_HOME" >> .env + echo "VITE_LOGO_URL=$FRONTEND_LOGO_URL" >> .env + echo "VITE_HTML_FAVICON=$FRONTEND_HTML_FAVICON" >> .env + echo "VITE_HTML_PAGE_TITLE=$FRONTEND_HTML_PAGE_TITLE" >> .env + echo "VITE_HTML_OG_DESCRIPTION=$FRONTEND_HTML_OG_DESCRIPTION" >> .env + echo "VITE_HTML_OG_IMAGE=$FRONTEND_HTML_OG_IMAGE" >> .env + echo "VITE_HTML_OG_TITLE=$FRONTEND_HTML_OG_TITLE" >> .env + echo "VITE_HTML_OG_URL=$FRONTEND_HTML_OG_URL" >> .env + echo "VITE_HTML_BODY_CLASS=$FRONTEND_HTML_BODY_CLASS" >> .env + echo "VITE_SENTRY_DSN=$FRONTEND_SENTRY_DSN" >> .env + cp .env frontend/.env + - name: Build Podman images + run: podman-compose -f docker-compose-deploy.yml build + - name: Deploy Podman images + run: podman-compose -f docker-compose-deploy.yml up -d --force-recreate + - name: Notify Sentry of new release + run: | + curl -X POST "https://sentry.io/api/0/organizations/uva-aml/releases/" \ + -H "Authorization: Bearer ${{ secrets.SENTRY_AUTH_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ + "version": "${{ github.sha }}", + "refs": [{ + "repository": "Amsterdam-Music-Lab/MUSCLE", + "commit": "${{ github.sha }}" + }], + "projects": ["muscle-frontend", "muscle-backend"], + "environment": "production" + }' + - name: Prune old images + run: podman image prune -a -f + - name: Check Podman images + run: podman-compose -f docker-compose-deploy.yml ps \ No newline at end of file From dba227fecafdee5ccdc84e9c15dd8d6b0143b728 Mon Sep 17 00:00:00 2001 From: Drikus Roor Date: Mon, 27 May 2024 11:56:45 +0200 Subject: [PATCH 3/4] chore: Update package version to 2.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 191a531f9..a78e6c7f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "muscle", - "version": "2.1.0", + "version": "2.1.1", "private": false, "description": "The MUSCLE platform is an application that provides an easy way to implement and run online listening experiments for music research.", "license": "MIT", From 1b249f3665bd602ebaa527cf981e2335af4bc05b Mon Sep 17 00:00:00 2001 From: BeritJanssen Date: Mon, 27 May 2024 12:15:57 +0200 Subject: [PATCH 4/4] fix: pick correct first_round action in That's My Song --- backend/experiment/rules/thats_my_song.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/experiment/rules/thats_my_song.py b/backend/experiment/rules/thats_my_song.py index 82ad44fb6..3adee411e 100644 --- a/backend/experiment/rules/thats_my_song.py +++ b/backend/experiment/rules/thats_my_song.py @@ -55,7 +55,7 @@ def get_info_playlist(self, filename): def first_round(self, experiment): actions = super().first_round(experiment) # skip Consent and Playlist action - return [actions[0]] + return [actions[2]] def next_round(self, session): """Get action data for the next round"""