Skip to content

Commit

Permalink
Add docker dev instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Pof Magicfingers committed Nov 14, 2018
1 parent 9ae389d commit 4a61915
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ addons:
services:
- postgresql
env:
- NODE_ENV=test
- NODE_ENV=travis
before_script:
- psql -c 'create database podcloud_stats_test;' -U postgres
- npm run db-migrate up
- NODE_ENV=travis npm run db-migrate up
script:
- yarn codecov
- NODE_ENV=travis yarn codecov
before_deploy:
- openssl aes-256-cbc -K $encrypted_17c9c2b55791_key -iv $encrypted_17c9c2b55791_iv
-in .deploy_rsa.enc -out /tmp/deploy_rsa -d
Expand Down
4 changes: 3 additions & 1 deletion config/development.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import process from "process";

module.exports = {
port: 80,
workers: 1,
postgres: {
user: "postgres",
host: "localhost",
host: "db",
database: "podcloud_stats_dev"
}
};
2 changes: 1 addition & 1 deletion config/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
postgres: {
user: "postgres",
host: "localhost",
host: "db",
database: "podcloud_stats_test"
}
};
9 changes: 9 additions & 0 deletions config/travis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const test = require("./test");

module.exports = {
...test,
postgres: {
...test.postgres,
host: "localhost"
}
};
9 changes: 8 additions & 1 deletion database.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
"driver": "pg",
"user": "postgres",
"password": "postgres",
"host": "localhost",
"host": "db",
"database": "podcloud_stats_dev"
},
"test": {
"driver": "pg",
"user": "postgres",
"password": "postgres",
"host": "db",
"database": "podcloud_stats_test"
},
"travis": {
"driver": "pg",
"user": "postgres",
"password": "postgres",
Expand Down
39 changes: 32 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
version: '2'
version: '3'
services:
server:
image: node:10
volumes:
- .:/usr/app
working_dir: /usr/app
command: "npm start"
networks:
- traefik
- default
depends_on:
- db
ports:
- 80
labels:
- "traefik.frontend.rule=Host:stats.podcloud.test"

db:
image: postgres
ports:
- 5432:5432
- 5432
labels:
- "traefik.enable=false"

pgadmin:
image: fenglc/pgadmin4
links:
- db
networks:
- traefik
- default
ports:
- 5050:5050
environment:
DEFAULT_USER: "admin"
VIRTUAL_PORT: 5050
VIRTUAL_HOST: "pg.test"
- 5050
labels:
- "traefik.port=5050"
- "traefik.frontend.rule=Host:db.stats.podcloud.test"


networks:
traefik:
external: true
28 changes: 21 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const App = () => {
);

app.workers = 0;
app.max_workers = 5;
app.max_workers = (config.has("workers") && config.get("workers")) || 5;
app.context = { db, maxmind };
app.cron = new CronJob({
cronTime: "* * * * * *",
Expand Down

0 comments on commit 4a61915

Please sign in to comment.