Skip to content

Commit

Permalink
Merge branch 'develop' into feature/fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vylpes committed Feb 10, 2024
2 parents 9749b56 + 5f2f102 commit f5dab28
Show file tree
Hide file tree
Showing 13 changed files with 279 additions and 165 deletions.
33 changes: 18 additions & 15 deletions .dev.env → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@
# Template files must be committed to the VCS, but must not contain
# any secret values.

EXPRESS_PORT=3000
EXPRESS_PORT=
EXPRESS_PROTOCOL=
EXPRESS_SECRET=

EMAIL_HOST=localhost
EMAIL_PORT=3003
EMAIL_SECURE=false
EMAIL_FROM_NAME=Droplet (Dev)
EMAIL_FROM_ADDRESS=noreply@vylpes.com
EMAIL_AUTH_ENABLE=false
EMAIL_HOST=
EMAIL_PORT=
EMAIL_SECURE=
EMAIL_FROM_NAME=
EMAIL_FROM_ADDRESS=
EMAIL_AUTH_ENABLE=
EMAIL_AUTH_USER=
EMAIL_AUTH_PASS=
EMAIL_TLS_REJECT_UNAUTHORISED=true
EMAIL_TLS_REJECT_UNAUTHORISED=

EMAIL_TEMPLATE_PASSWORDRESET_RESETLINK=http://localhost:3000/auth/password-reset/reset?token={token}
EMAIL_TEMPLATE_VERIFYUSER_VERIFYLINK=http://localhost:3000/auth/verify?token={token}

DB_HOST=127.0.0.1
DB_PORT=3001
DB_NAME=droplet
DB_AUTH_USER=dev
DB_AUTH_PASS=dev
DB_SYNC=true
DB_LOGGING=true
DB_HOST=
DB_PORT=
DB_NAME=
DB_AUTH_USER=
DB_AUTH_PASS=
DB_SYNC=
DB_LOGGING=
DB_DATA_LOCATION=
78 changes: 78 additions & 0 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy To Stage

on:
push:
branches:
- develop

jobs:
build:
environment: stage

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

- name: RSync to Stage Server
uses: D3rHase/rsync-deploy-action@v0.2
with:
HOST: ${{ secrets.SSH_HOST }}
PORT: ${{ secrets.SSH_PORT }}
USER: ${{ secrets.SSH_USER }}
PRIVATE_SSH_KEY: ${{ secrets.SSH_KEY }}
REPOSITORY_PATH: ${{ secrets.SSH_REPO_PATH }}
SERVER_PATH: ${{ secrets.SSH_SERVER_PATH }}

deploy:
environment: stage
needs: build
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1.0.0
env:
DB_NAME: ${{ secrets.DB_NAME }}
DB_AUTH_USER: ${{ secrets.DB_AUTH_USER }}
DB_AUTH_PASS: ${{ secrets.DB_AUTH_PASS }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_ROOT_HOST: ${{ secrets.DB_ROOT_HOST }}
DB_SYNC: ${{ secrets.DB_SYNC }}
DB_LOGGING: ${{ secrets.DB_LOGGING }}
DB_DATA_LOCATION: ${{ secrets.DB_DATA_LOCATION }}
EXPRESS_PORT: ${{ secrets.EXPRESS_PORT }}
EXPRESS_PROTOCOL: ${{ secrets.EXPRESS_PROTOCOL }}
EXPRESS_SECRET: ${{ secrets.EXPRESS_SECRET }}
EMAIL_HOST: ${{ secrets.EMAIL_HOST }}
EMAIL_PORT: ${{ secrets.EMAIL_PORT }}
EMAIL_SECURE: ${{ secrets.EMAIL_SECURE }}
EMAIL_FROM_NAME: ${{ vars.EMAIL_FROM_NAME }}
EMAIL_FROM_ADDRESS: ${{ vars.EMAIL_FROM_ADDRESS }}
EMAIL_AUTH_ENABLE: ${{ secrets.EMAIL_AUTH_ENABLE }}
EMAIL_AUTH_USER: ${{ secrets.EMAIL_AUTH_USER }}
EMAIL_AUTH_PASS: ${{ secrets.EMAIL_AUTH_PASS }}
EMAIL_TLS_REJECT_UNAUTHORISED: ${{ secrets.EMAIL_TLS_REJECT_UNAUTHORISED }}
EMAIL_TEMPLATE_PASSWORDRESET_RESETLINK: ${{ vars.EMAIL_TEMPLATE_PASSWORDRESET_RESETLINK }}
EMAIL_TEMPLATE_VERIFYUSER_VERIFYLINK: ${{ vars.EMAIL_TEMPLATE_VERIFYUSER_VERIFYLINK }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
envs: DB_NAME,DB_AUTH_USER,DB_AUTH_PASS,DB_HOST,DB_PORT,DB_ROOT_HOST,DB_SYNC,DB_LOGGING,DB_DATA_LOCATION,EXPRESS_PORT,EXPRESS_PROTOCOL,EXPRESS_SECRET,EMAIL_HOST,EMAIL_PORT,EMAIL_SECURE,EMAIL_FROM_NAME,EMAIL_FROM_ADDRESS,EMAIL_AUTH_ENABLE,EMAIL_AUTH_USER,EMAIL_AUTH_PASS,EMAIL_TLS_REJECT_UNAUTHORISED,EMAIL_TEMPLATE_PASSWORDRESET_RESETLINK,EMAIL_TEMPLATE_VERIFYUSER_VERIFYLINK
script: |
cd ~/app \
&& docker compose down \
&& (pm2 stop droplet || true) \
&& (pm2 delete droplet || true) \
&& docker compose up -d \
&& sleep 10 \
&& yarn run db:up \
&& pm2 start --name droplet dist/index.js
23 changes: 23 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Testing

on:
push:
branches:
- feature/*
- hotfix/*
- renovate/*

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18.x
- run: yarn install
- run: yarn build
- run: yarn test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ coverage/
ormconfig.json
yarn-error.log
.DS_Store
secret.txt
secret.txt

.terraform/
*.tfvars
*.tfstate
30 changes: 0 additions & 30 deletions .prod.env

This file was deleted.

30 changes: 0 additions & 30 deletions .stage.env

This file was deleted.

33 changes: 0 additions & 33 deletions docker-compose.prod.yml

This file was deleted.

33 changes: 0 additions & 33 deletions docker-compose.stage.yml

This file was deleted.

32 changes: 10 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
version: "3"

volumes:
dev_database_data:

services:
database:
image: mysql/mysql-server
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
- MYSQL_DATABASE=droplet
- MYSQL_USER=dev
- MYSQL_PASSWORD=dev
- MYSQL_ROOT_PASSWORD=root
- MYSQL_ROOT_HOST=0.0.0.0
- MYSQL_DATABASE=$DB_NAME
- MYSQL_USER=$DB_AUTH_USER
- MYSQL_PASSWORD=$DB_AUTH_PASS
- MYSQL_ROOT_PASSWORD=$DB_AUTH_PASS
- MYSQL_ROOT_HOST=$DB_ROOT_HOST
ports:
- "3001:3306"
- "3306:3306"
volumes:
- dev_database_data:/var/lib/mysql

phpmyadmin:
image: phpmyadmin
restart: always
ports:
- "3002:80"
environment:
- PMA_ARBITRARY=1

mail:
- $DB_DATA_LOCATION:/var/lib/mysql
mailhog:
image: mailhog/mailhog
ports:
- "3003:1025"
- "3004:8025"
- 1025:1025 # smtp server
- 8025:8025 # web ui
26 changes: 26 additions & 0 deletions infrastructure/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5dab28

Please sign in to comment.