docker tweaks for fast setup on UAT

pull/4/head
Jose Vera 2022-03-02 18:46:03 -05:00
parent 16b6256367
commit 9d14157621
6 changed files with 14 additions and 23 deletions

View File

@ -6,9 +6,10 @@ WORKDIR /app
# Install app dependencies # Install app dependencies
COPY package*.json ./ COPY package*.json ./
RUN npm ci RUN npm ci
RUN npm install pm2 -g
# Bundle app source # Bundle app source
COPY . . COPY . .
EXPOSE 3000 EXPOSE 3000
CMD [ "node", "--es-module-specifier-resolution=node", "server.js" ] CMD ["pm2-runtime", "ecosystem.config.js"]

View File

@ -8,16 +8,8 @@ services:
volumes: volumes:
- ./:/app - ./:/app
ports: ports:
- "80:3000" - "3000:3000"
- "4040:4040" - "4040:4040"
worker:
build: .
command: node --es-module-specifier-resolution=node worker.js
restart: unless-stopped
depends_on:
- db
volumes:
- ./:/app
db: db:
image: postgres image: postgres
restart: always restart: always

View File

@ -1,10 +1,9 @@
export default { module.exports = [{
apps: [{ script: 'server.js',
name: 'Retropilot Service', name: 'server',
script: './server.js', node_args: '-r esm',
}, {
env_development: { script: 'worker.js',
NODE_ENV: 'development', node_args: '-r esm',
}, name: 'worker'
}], }]
};

View File

@ -3,7 +3,6 @@
"version": "1.0.0", "version": "1.0.0",
"description": "replacement for comma.ai backend and useradmin dashboard. can be combined with a modified cabana instance.", "description": "replacement for comma.ai backend and useradmin dashboard. can be combined with a modified cabana instance.",
"main": "server.js", "main": "server.js",
"type": "module",
"scripts": { "scripts": {
"test": "mocha", "test": "mocha",
"start": "node --es-module-specifier-resolution=node server.js", "start": "node --es-module-specifier-resolution=node server.js",
@ -62,4 +61,4 @@
"eslint-plugin-import": "^2.25.4", "eslint-plugin-import": "^2.25.4",
"eslint-plugin-no-floating-promise": "^1.0.2" "eslint-plugin-no-floating-promise": "^1.0.2"
} }
} }

View File

@ -2,7 +2,7 @@ import express from 'express';
import crypto from 'crypto'; import crypto from 'crypto';
import dirTree from 'directory-tree'; import dirTree from 'directory-tree';
import bodyParser from 'body-parser'; import bodyParser from 'body-parser';
import deviceSchema from '../../schema/routes/devices.mjs'; import deviceSchema from '../../schema/routes/devices';
import deviceController from '../../controllers/devices'; import deviceController from '../../controllers/devices';
import authenticationController from '../../controllers/authentication'; import authenticationController from '../../controllers/authentication';