diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ce32868..59ee75b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,10 @@ name: Deploy on release on: - release: - types: [published] + push: + branches: + -master + -releases jobs: unit-tests: @@ -39,24 +41,7 @@ jobs: - run: npm --prefix webapp install - run: npm --prefix webapp run build - run: npm --prefix webapp run test:e2e - - docker-push-questionservice: - name: Push question service Docker Image to GitHub Packages - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - needs: [e2e-tests] - steps: - - uses: actions/checkout@v4 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@v5 - with: - name: arquisoft/wiq_es04c/questionservice - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ghcr.io - workdir: ./questionservice + docker-push-webapp: name: Push webapp Docker Image to GitHub Packages @@ -70,7 +55,9 @@ jobs: - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@v5 env: - API_URI: http://${{ secrets.DEPLOY_HOST }}:8000 + API_URI: http://${{ secrets.DEPLOY_HOST || 'localhost' }}:8000 + + with: name: arquisoft/wiq_es04c/webapp username: ${{ github.actor }} @@ -129,7 +116,26 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ghcr.io - workdir: gatewayservice + workdir: ./gatewayservice + + docker-push-questionservice: + name: Push question service Docker Image to GitHub Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + needs: [e2e-tests] + steps: + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: arquisoft/wiq_es04c/questionservice + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + workdir: ./questionservice + deploy: name: Deploy over SSH runs-on: ubuntu-latest @@ -142,10 +148,8 @@ jobs: user: ${{ secrets.DEPLOY_USER }} key: ${{ secrets.DEPLOY_KEY }} command: | - pwd - ls -la - cd wiq_es04c wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/docker-compose.yml -O docker-compose.yml wget https://raw.githubusercontent.com/arquisoft/wiq_es04c/releases/.env -O .env - docker compose down + git clone -b releases https://github.com/Arquisoft/wiq_es04c.git + docker compose --profile prod down docker compose --profile prod up -d \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 43d8fcf..e51c9ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: mongodb: - container_name: mongodb-${teamname:-defaultASW} + container_name: mongodb-${teamname:-wiq_0} image: mongo profiles: ["dev", "prod"] volumes: @@ -12,8 +12,8 @@ services: - mynetwork authservice: - container_name: authservice-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es04c/authservice:latest + container_name: authservice-${teamname:-wiq_0} + image: ghcr.io/arquisoft/${teamname:-wiq_0}/authservice:latest profiles: ["dev", "prod"] build: ./users/authservice depends_on: @@ -26,8 +26,8 @@ services: MONGODB_URI: mongodb://mongodb:27017/userdb userservice: - container_name: userservice-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es04c/userservice:latest + container_name: userservice-${teamname:-wiq_0} + image: ghcr.io/arquisoft/${teamname:-wiq_0}/userservice:latest profiles: ["dev", "prod"] build: ./users/userservice depends_on: @@ -40,8 +40,8 @@ services: MONGODB_URI: mongodb://mongodb:27017/userdb gatewayservice: - container_name: gatewayservice-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es04c/gatewayservice:latest + container_name: gatewayservice-${teamname:-wiq_0} + image: ghcr.io/arquisoft/${teamname:-wiq_0}/gatewayservice:latest profiles: ["dev", "prod"] build: ./gatewayservice depends_on: @@ -58,9 +58,7 @@ services: USER_SERVICE_URL: http://userservice:8001 questionservice: - container_name: questionservice-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es04c/questionservice:latest - + container_name: questionservice-${teamname:-wiq_0} build: ./questionservice ports: - "8003:8003" @@ -68,8 +66,8 @@ services: - mynetwork webapp: - container_name: webapp-${teamname:-defaultASW} - image: ghcr.io/arquisoft/wiq_es04c/webapp:latest + container_name: webapp-${teamname:-wiq_0} + image: ghcr.io/arquisoft/${teamname:-wiq_0}/webapp:latest profiles: ["dev", "prod"] build: ./webapp depends_on: @@ -81,7 +79,7 @@ services: prometheus: image: prom/prometheus - container_name: prometheus-${teamname:-defaultASW} + container_name: prometheus-${teamname:-wiq_0} profiles: ["dev"] networks: - mynetwork @@ -95,7 +93,7 @@ services: grafana: image: grafana/grafana - container_name: grafana-${teamname:-defaultASW} + container_name: grafana-${teamname:-wiq_0} profiles: ["dev"] networks: - mynetwork diff --git a/gatewayservice/package.json b/gatewayservice/package.json index fd16c42..03b5cc2 100644 --- a/gatewayservice/package.json +++ b/gatewayservice/package.json @@ -9,14 +9,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/arquisoft/wiq_0.git" + "url": "git+https://github.com/arquisoft/wiq_es04c.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/arquisoft/wiq_0/issues" + "url": "https://github.com/arquisoft/wiq_es04c/issues" }, - "homepage": "https://github.com/arquisoft/wiq_0#readme", + "homepage": "https://github.com/arquisoft/wiq_es04c#readme", "dependencies": { "axios": "^1.6.5", "cors": "^2.8.5", diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9bdaa85 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "wiq_es04c", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/questionservice/package.json b/questionservice/package.json index ad9e8d9..7094837 100644 --- a/questionservice/package.json +++ b/questionservice/package.json @@ -9,14 +9,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/arquisoft/wiq_0.git" + "url": "git+https://github.com/arquisoft/wiq_es04c.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/arquisoft/wiq_0/issues" + "url": "https://github.com/arquisoft/wiq_es04c/issues" }, -"homepage": "https://github.com/arquisoft/wiq_0#readme", +"homepage": "https://github.com/arquisoft/wiq_es04c#readme", "dependencies": { "bcrypt": "^5.1.1", "body-parser": "^1.20.2", diff --git a/users/authservice/package.json b/users/authservice/package.json index 6b5b623..7438a5b 100644 --- a/users/authservice/package.json +++ b/users/authservice/package.json @@ -9,14 +9,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/arquisoft/wiq_0.git" + "url": "git+https://github.com/arquisoft/wiq_es04c.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/arquisoft/wiq_0/issues" + "url": "https://github.com/arquisoft/wiq_es04c/issues" }, - "homepage": "https://github.com/arquisoft/wiq_0#readme", + "homepage": "https://github.com/arquisoft/wiq_es04c#readme", "dependencies": { "bcrypt": "^5.1.1", "body-parser": "^1.20.2", diff --git a/users/userservice/package.json b/users/userservice/package.json index 2462c8e..9ea341c 100644 --- a/users/userservice/package.json +++ b/users/userservice/package.json @@ -9,14 +9,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/arquisoft/wiq_0.git" + "url": "git+https://github.com/arquisoft/wiq_es04c.git" }, "author": "", "license": "ISC", "bugs": { - "url": "https://github.com/arquisoft/wiq_0/issues" + "url": "https://github.com/arquisoft/wiq_es04c/issues" }, - "homepage": "https://github.com/arquisoft/wiq_0#readme", + "homepage": "https://github.com/arquisoft/wiq_es04c#readme", "dependencies": { "bcrypt": "^5.1.1", "body-parser": "^1.20.2",