The site has been dockerised
This commit is contained in:
parent
b614f0daf0
commit
0cb1404d32
26
Docker/Dockerfile
Normal file
26
Docker/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
# FROM node:current-slim
|
||||
FROM martind2000/node-python3:16-slim
|
||||
ARG VERSION
|
||||
ENV VERSION ${VERSION:-development}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./Docker/start.sh ./package*.json ./web-server.js /app/
|
||||
|
||||
COPY ./dist /app/dist
|
||||
|
||||
COPY ./views /app/views
|
||||
|
||||
COPY ./lib /app/lib
|
||||
|
||||
COPY ./config /app/config
|
||||
|
||||
RUN pnpm install
|
||||
|
||||
# RUN ls -lh .
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
RUN chmod +x /app/start.sh
|
||||
|
||||
ENTRYPOINT ["/app/start.sh"]
|
12
Docker/ecosystem.config.json
Normal file
12
Docker/ecosystem.config.json
Normal file
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"name": "Slack",
|
||||
"script": "app/predict.js",
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"autorestart": false,
|
||||
"instances": 1,
|
||||
"cron_restart": "10 15 * * 2,5"
|
||||
}
|
||||
]
|
4
Docker/start.sh
Executable file
4
Docker/start.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
node web-server.js
|
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
silvrtree:
|
||||
container_name: silvrtree
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Docker/Dockerfile
|
||||
image: silvrtree_docker
|
||||
restart: always
|
||||
ports:
|
||||
- "9000:9000"
|
||||
# volumes:
|
||||
# - ./dist:/app/dist
|
@ -1,6 +1,6 @@
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const LimitedArray = require('limitedarray');
|
||||
const LimitedArray = require('@rakh/limitedarray');
|
||||
const trend = require('trend');
|
||||
const logger = require('log4js').getLogger('btc');
|
||||
let btcCache = {};
|
||||
@ -62,8 +62,8 @@ function getBitcoin () {
|
||||
history.push(a.bpi.USD.rate_float);
|
||||
btcCache.history = history.get();
|
||||
btcCache.trend = trend(btcCache.history, { 'avgPoints': 12 });
|
||||
GLOBAL.lastcheck = new Date();
|
||||
btcCache.lastcheck = GLOBAL.lastcheck.toISOString();
|
||||
global.lastcheck = new Date();
|
||||
btcCache.lastcheck = global.lastcheck.toISOString();
|
||||
eventEmitter.emit('sendSocket', { 'id': 'btc', 'data': btcCache });
|
||||
});
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
const http = require('http');
|
||||
const LimitedArray = require('limitedarray');
|
||||
const LimitedArray = require('@rakh/limitedarray');
|
||||
const trend = require('trend');
|
||||
const logger = require('log4js').getLogger('fx');
|
||||
const delay = 5529600; // 32 days divided by 500
|
||||
|
23
package.json
23
package.json
@ -21,21 +21,6 @@
|
||||
"eslint-watch": "^3.0.1",
|
||||
"fitbit-oauth2": "0.0.1",
|
||||
"forecast.io": "0.0.11",
|
||||
"gulp-autoprefixer": "^4.0.0",
|
||||
"gulp-babel": "^7.0.0",
|
||||
"gulp-cache": "^0.4.6",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-cssnano": "^2.1.2",
|
||||
"gulp-google-webfonts": "0.0.14",
|
||||
"gulp-html-replace": "^1.6.2",
|
||||
"gulp-htmlmin": "^3.0.0",
|
||||
"gulp-jshint": "^2.0.4",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sass": "^3.1.0",
|
||||
"gulp-scss": "^1.4.0",
|
||||
"gulp-sourcemaps": "^2.6.1",
|
||||
"gulp-strip-debug": "^1.1.0",
|
||||
"gulp-uglify": "^3.0.0",
|
||||
"htmlparser": "^1.7.7",
|
||||
"jade": "^1.11.0",
|
||||
"jest": "^21.2.1",
|
||||
@ -74,9 +59,8 @@
|
||||
"express": "^4.15.5",
|
||||
"express-session": "^1.15.6",
|
||||
"ftse": "^1.0.6",
|
||||
"gulp": "^3.9.1",
|
||||
"ical2json": "^1.2.0",
|
||||
"limitedarray": "git+https://gitlab.silvrtree.co.uk/martind2000/limitedArray.git",
|
||||
"@rakh/limitedarray": "^0.1.0",
|
||||
"logger": "0.0.1",
|
||||
"method-override": "^2.3.10",
|
||||
"morgan": "^1.9.0",
|
||||
@ -94,12 +78,9 @@
|
||||
"scripts": {
|
||||
"start": "node web-server.js",
|
||||
"copy": "sudo cp -r ./. /var/www/silvrtree",
|
||||
"postinstall": "browserify -g uglifyify app/appV2.js -o app/bundle.js"
|
||||
"nopostinstall": "browserify -g uglifyify app/appV2.js -o app/bundle.js"
|
||||
},
|
||||
"jest": {
|
||||
"verbose": true
|
||||
},
|
||||
"engines": {
|
||||
"node": "= 8.8.0"
|
||||
}
|
||||
}
|
||||
|
10364
pnpm-lock.yaml
Normal file
10364
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@ const polys = require('./lib/poly.js');
|
||||
|
||||
const logger = require('log4js').getLogger();
|
||||
const app = express();
|
||||
GLOBAL.lastcheck = 0;
|
||||
global.lastcheck = 0;
|
||||
let btcCache = {}, fxCache = {}, trainCache = {};
|
||||
|
||||
const port = process.env.PORT || 9010;
|
||||
|
@ -51,8 +51,8 @@ const logger = require('log4js').getLogger('web-server');
|
||||
logger.level = 'debug';
|
||||
|
||||
const app = express();
|
||||
GLOBAL.lastcheck = 0;
|
||||
GLOBAL.fxLastCheck = 0;
|
||||
global.lastcheck = 0;
|
||||
global.fxLastCheck = 0;
|
||||
let btcCache = {}, fxCache = {}, trainCache = {};
|
||||
|
||||
const port = process.env.PORT || 9000;
|
||||
|
Loading…
Reference in New Issue
Block a user