Skip to content

Commit

Permalink
Merge pull request #73 from FedeMont/release
Browse files Browse the repository at this point in the history
First production deploy
  • Loading branch information
FedeMont authored Jun 7, 2022
2 parents a9431d3 + 80a0e2e commit a2e31b5
Show file tree
Hide file tree
Showing 57 changed files with 26,240 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:

runs-on: ubuntu-latest

# This is used to load Environment-level secrets, from the specified environment.
# Instead, repository secrets are loaded by default.
environment: production

env:
token_safe: ${{ secrets.TOKEN_SAFE }} # Must be set as a GitHub secret
positionstack_api_key: ${{ secrets.POSITIONSTACK_API }} # Must be set as a GitHub secret
db_url: ${{ secrets.DB_URL }} # Must be set as a GitHub secret
db_name: ${{ secrets.DB_NAME }} # Must be set as a GitHub secret
db_user: ${{ secrets.DB_USER }} # Must be set as a GitHub secret
db_password: ${{ secrets.DB_PASSWORD }} # Must be set as a GitHub secret
emailer_user: ${{ secrets.EMAILER_USER }} # Must be set as a GitHub secret
emailer_clientId: ${{ secrets.EMAILER_CLIENTID }} # Must be set as a GitHub secret
emailer_clientSecret: ${{ secrets.EMAILER_CLIENTSECRET }} # Must be set as a GitHub secret
emailer_refreshToken: ${{ secrets.EMAILER_REFRESHTOKEN }} # Must be set as a GitHub secret

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: node/package-lock.json
- run: npm ci
working-directory: node
- run: npm run build --if-present
working-directory: node
- run: npm test
working-directory: node

release:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- uses: akhileshns/[email protected] # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: "[email protected]"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
database/*
*.DS_Store
*.idea

# Logs
logs
*.log
Expand Down
47 changes: 47 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: "3.2"
networks:
default:
driver: bridge

services:
nodejs:
image: node:18.1.0
working_dir: /home/node/app
restart: unless-stopped
environment:
- NODE_ENV=production
volumes:
- ./node/:/home/node/app
ports:
- 3000:3000
command: bash -c "npm i && npm run start-dev"
# networks:
# - partyhub
mongo:
image: mongo:4.4.13
container_name: mongo
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
volumes:
- ./database/db:/data/db
- ./database/dev.archive:/Databases/dev.archive
- ./database/production:/Databases/production
ports:
- 27017:27017
# networks:
# - partyhub
mongo-express:
image: mongo-express:0.54.0
restart: unless-stopped
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: password
ME_CONFIG_MONGODB_URL: mongodb://root:password@mongo:27017/
ports:
- 8081:8081
depends_on:
- mongo
# networks:
# - partyhub
1 change: 1 addition & 0 deletions node/.jest/setEnvVars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("dotenv").config()
1 change: 1 addition & 0 deletions node/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node app.js
Loading

0 comments on commit a2e31b5

Please sign in to comment.