-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from vim/feature/deployment-vm
CI: Deploy Docker Images on remote VM
- Loading branch information
Showing
17 changed files
with
235 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
NODE_ENV=development | ||
|
||
DATABASE_CLIENT=mysql2 | ||
DATABASE_USERNAME=vim | ||
DATABASE_PASSWORD=super-secret | ||
DATABASE_PORT=3306 | ||
DATABASE_SSL=false | ||
|
||
WEB_DATABASE_NAME=vim | ||
CMS_DATABASE_NAME=vim_cms | ||
NEXT_PRIVATE_STANDALONE=true | ||
NEXTAUTH_SECRET=testsecret | ||
|
||
CMS_DATABASE_NAME=vim_cms | ||
CMS_HOST=0.0.0.0 | ||
CMS_PORT=1337 | ||
CMS_APP_KEYS=testkey1,testkey2 | ||
CMS_API_TOKEN_SALT=testtoken | ||
CMS_ADMIN_JWT_SECRET=testsecret | ||
CMS_JWT_SECRET=testsecret | ||
CMS_TRANSFER_TOKEN_SALT=testtoken | ||
CMS_DISABLE_UPDATE_NOTIFICATION=false | ||
CMS_TELEMETRY_DISABLED=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Deploy Docker Images | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- development | ||
workflow_run: | ||
workflows: | ||
- Build and Push Web Docker Image | ||
- Build and Push CMS Docker Image | ||
branches: | ||
- development | ||
types: | ||
- completed | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: setup environment file | ||
run: | | ||
test -f .env || cp .env.example .env | ||
- name: copy files to server | ||
uses: appleboy/scp-action@v0.1.3 | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
source: "./docker-compose.dev.yml,./.env" | ||
target: "~/${{ github.event.repository.name }}/" | ||
|
||
- name: pull & start container images | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USER }} | ||
key: ${{ secrets.SSH_KEY }} | ||
script_stop: true | ||
script: | | ||
cd ~/${{ github.event.repository.name }}/ | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{github.actor}} --password-stdin | ||
docker compose -f docker-compose.dev.yml pull | ||
docker compose -f docker-compose.dev.yml down | ||
docker compose -f docker-compose.dev.yml up -d --wait --no-build --force-recreate | ||
docker compose -f docker-compose.dev.yml logs -t -n 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ on: | |
branches: | ||
- main | ||
- development | ||
- 'feature/**' | ||
paths: | ||
- cms/** | ||
pull_request: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
services: | ||
web: | ||
container_name: web | ||
image: ghcr.io/vim/website_next_generation/web:${TAG:-development} | ||
environment: | ||
- CMS_API=http://cms:1337/api | ||
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET} | ||
ports: | ||
- 3000:3000 | ||
networks: | ||
- vim_network | ||
|
||
db: | ||
container_name: db | ||
image: mysql:8 | ||
restart: unless-stopped | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=${DATABASE_PASSWORD} | ||
- MYSQL_USER=${DATABASE_USERNAME} | ||
- MYSQL_PASSWORD=${DATABASE_PASSWORD} | ||
- MYSQL_DATABASE=${CMS_DATABASE_NAME} | ||
volumes: | ||
- vim-cms-data:/var/lib/mysql | ||
- ./db/docker-scripts:/docker-entrypoint-initdb.d | ||
ports: | ||
- ${DATABASE_PORT}:3306 | ||
networks: | ||
- vim_network | ||
|
||
cms: | ||
container_name: strapi | ||
image: ghcr.io/vim/website_next_generation/cms:${TAG:-development} | ||
restart: unless-stopped | ||
environment: | ||
DATABASE_CLIENT: ${DATABASE_CLIENT} | ||
DATABASE_HOST: db | ||
DATABASE_PORT: ${DATABASE_PORT} | ||
DATABASE_NAME: ${CMS_DATABASE_NAME} | ||
DATABASE_USERNAME: ${DATABASE_USERNAME} | ||
DATABASE_PASSWORD: ${DATABASE_PASSWORD} | ||
DATABASE_SSL: false | ||
HOST: ${CMS_HOST} | ||
PORT: ${CMS_PORT} | ||
APP_KEYS: ${CMS_APP_KEYS} | ||
API_TOKEN_SALT: ${CMS_API_TOKEN_SALT} | ||
ADMIN_JWT_SECRET: ${CMS_ADMIN_JWT_SECRET} | ||
TRANSFER_TOKEN_SALT: ${CMS_TRANSFER_TOKEN_SALT} | ||
JWT_SECRET: ${CMS_JWT_SECRET} | ||
STRAPI_DISABLE_UPDATE_NOTIFICATION: ${CMS_DISABLE_UPDATE_NOTIFICATION} | ||
STRAPI_TELEMETRY_DISABLED: ${CMS_TELEMETRY_DISABLED} | ||
ports: | ||
- 1337:1337 | ||
networks: | ||
- vim_network | ||
depends_on: | ||
- db | ||
|
||
volumes: | ||
vim-cms-data: | ||
|
||
networks: | ||
vim_network: | ||
name: vim_network | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Strapi server | ||
upstream strapi { | ||
server 127.0.0.1:1337; | ||
} | ||
|
||
# NextJS server | ||
upstream nextjs { | ||
server 127.0.0.1:3000; | ||
} |
Oops, something went wrong.