Add docker-compose file for local testing.

This commit is contained in:
Nawaz Dhandala 2020-01-28 21:39:48 +01:00
parent 4b16563961
commit fe89945991
No known key found for this signature in database
GPG Key ID: 43C184A0DB24F9F6
6 changed files with 97 additions and 153 deletions

View File

@ -17,3 +17,5 @@ NODE_ENV=development
WINDOWMS=216000
MAX=5000
RATE_LIMITING_ENABLED=false
MONGO_URL=mongodb://mongo:27017/fyipedb
REDIS_HOST=redis

View File

@ -7,9 +7,6 @@ var redisAdapter = require('socket.io-redis');
var keys = require('./backend/config/keys.js');
var bodyParser = require('body-parser');
var cors = require('cors');
//var { fork } = require('child_process');
//fork('./backend/workers/cronjob.js');
var { NODE_ENV } = process.env;

94
docker-compose.yml Normal file
View File

@ -0,0 +1,94 @@
version: "3.7"
services:
mongo:
image: mongo:3.4
ports:
- "27017:27017"
volumes:
- mongodata:/data/db
redis:
image: redis:5.0.7
ports:
- "6379:6379"
command: redis-server
backend:
ports:
- "3002:3002"
env_file: ./backend/.env.development
build: ./backend
depends_on:
- mongo
- redis
accounts:
ports:
- "3003:3003"
build: ./accounts
depends_on:
- backend
dashboard:
ports:
- "3000:3000"
build: ./dashboard
depends_on:
- backend
home:
ports:
- "1444:1444"
build: ./home
status-page:
ports:
- "3006:3006"
build: ./status-page
depends_on:
- backend
- accounts
- dashboard
admin-dashboard:
ports:
- "3100:3100"
build: ./dashboard
depends_on:
- backend
- accounts
http-test-server:
ports:
- "3010:3010"
build: ./http-test-server
probe1:
ports:
- "3019:3019"
build: ./probe
environment:
- PORT=3019
- SERVER_URL=http://backend:3002
- PROBE_NAME=Probe 1
- PROBE_KEY=test-key
depends_on:
- backend
probe2:
ports:
- "3020:3020"
build: ./probe
environment:
- PORT=3020
- SERVER_URL=http://backend:3002
- PROBE_NAME=Probe 2
- PROBE_KEY=test-key
depends_on:
- backend
volumes:
mongodata:

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g>
<g>
<path d="M181.72,366.814c-0.723-0.206-1.463-0.322-2.208-0.362c10.954-11.513,17.7-27.066,17.7-44.174v-52.611
c0-0.481-0.046-0.95-0.111-1.412c0.066-0.95,0.111-1.906,0.111-2.872v-33.286c0-5.523-4.477-10-10-10h-67.073
c-28.245,0-51.223,22.979-51.223,51.223v48.958c0,17.108,6.745,32.661,17.7,44.174c-0.744,0.04-1.484,0.156-2.206,0.362
C37.153,371.093,0,410.924,0,459.276V502c0,5.523,4.477,10,10,10h246.127c5.523,0,10-4.477,10-10v-42.724
C266.127,410.925,228.976,371.094,181.72,366.814z M88.916,286.001v-12.682c0-17.216,14.007-31.223,31.223-31.223h57.073v23.286
c0,11.723-9.537,21.26-21.26,21.26H88.916V286.001z M88.916,306.642h67.036c7.772,0,15.047-2.162,21.26-5.914v21.549
c0,24.343-19.805,44.148-44.148,44.148c-24.343,0-44.148-19.805-44.148-44.148V306.642z M154.829,386.426l-21.765,21.766
l-21.765-21.766H154.829z M246.128,492L246.128,492H20v-20h41.5c5.523,0,10-4.477,10-10s-4.477-10-10-10H20.365
c3.359-33.716,29.806-60.717,63.255-64.969l42.373,42.373c1.875,1.875,4.419,2.929,7.071,2.929c2.652,0,5.196-1.054,7.071-2.929
l42.373-42.373c35.824,4.553,63.62,35.204,63.62,72.245V492z"/>
</g>
</g>
<g>
<g>
<path d="M427.595,144.718c-0.723-0.206-1.464-0.322-2.21-0.362c10.954-11.513,17.699-27.066,17.699-44.174V47.57
c0-0.481-0.046-0.95-0.111-1.412c0.066-0.95,0.111-1.906,0.111-2.872V10c0-5.523-4.477-10-10-10h-67.073
c-28.245,0-51.223,22.979-51.223,51.223v48.958c0,17.108,6.745,32.661,17.699,44.174c-0.745,0.04-1.487,0.156-2.21,0.362
c-47.255,4.281-84.405,44.112-84.405,92.462v42.723c0,5.523,4.477,10,10,10h80.46c5.523,0,10-4.477,10-10s-4.477-10-10-10h-70.46
V237.18c0-37.041,27.795-67.692,63.619-72.245l42.373,42.373c1.953,1.953,4.512,2.929,7.071,2.929s5.119-0.976,7.071-2.929
l42.373-42.373C464.205,169.489,492,200.139,492,237.18v32.723h-73.667c-5.523,0-10,4.477-10,10s4.477,10,10,10H502
c5.523,0,10-4.477,10-10V237.18C512,188.83,474.849,148.999,427.595,144.718z M378.937,186.095l-21.765-21.765h43.53
L378.937,186.095z M423.085,100.181c0,24.343-19.805,44.148-44.148,44.148s-44.148-19.804-44.148-44.147V84.546h67.036
c7.772,0,15.047-2.163,21.26-5.914V100.181z M423.085,43.286c0,11.723-9.537,21.26-21.26,21.26h-67.036v-0.641V51.223
c0-17.216,14.007-31.223,31.223-31.223h57.073V43.286z"/>
</g>
</g>
<g>
<g>
<path d="M386.01,272.83c-1.86-1.86-4.44-2.93-7.07-2.93c-2.64,0-5.21,1.07-7.07,2.93c-1.87,1.86-2.93,4.44-2.93,7.07
c0,2.64,1.06,5.21,2.93,7.07c1.86,1.87,4.43,2.93,7.07,2.93c2.63,0,5.21-1.06,7.07-2.93c1.86-1.86,2.93-4.43,2.93-7.07
C388.94,277.27,387.87,274.69,386.01,272.83z"/>
</g>
</g>
<g>
<g>
<path d="M267.405,139.929l-41.821-41.821V50c0-27.57-22.43-50-50-50H50C22.43,0,0,22.43,0,50v88c0,27.57,22.43,50,50,50h125.583
c20.674,0,38.702-12.407,46.266-31h38.484c4.044,0,7.691-2.437,9.239-6.173C271.12,147.091,270.264,142.789,267.405,139.929z
M214.554,137c-4.659,0-8.701,3.217-9.746,7.758C201.66,158.442,189.643,168,175.583,168H50c-16.542,0-30-13.458-30-30V50
c0-16.542,13.458-30,30-30h125.583c16.542,0,30,13.458,30,30v52.25c0,2.652,1.054,5.196,2.929,7.071L236.191,137H214.554z"/>
</g>
</g>
<g>
<g>
<path d="M462,324H336.417c-20.674,0-38.702,12.407-46.266,31h-38.484c-4.044,0-7.691,2.437-9.239,6.173
c-1.548,3.736-0.692,8.038,2.167,10.898l41.821,41.821V462c0,27.57,22.43,50,50,50H462c27.57,0,50-22.43,50-50v-88
C512,346.43,489.57,324,462,324z M492,462c0,16.542-13.458,30-30,30H336.417c-16.542,0-30-13.458-30-30v-52.25
c0-2.652-1.054-5.196-2.929-7.071L275.809,375h21.637c4.659,0,8.701-3.217,9.746-7.758C310.34,353.558,322.357,344,336.417,344
H462c16.542,0,30,13.458,30,30V462z"/>
</g>
</g>
<g>
<g>
<path d="M444.156,391.392c-3.904-3.905-10.236-3.905-14.141,0l-26.583,26.583l-12.361-12.361c-3.905-3.905-10.237-3.905-14.143,0
c-3.905,3.905-3.905,10.237,0,14.143l19.432,19.432c1.953,1.953,4.512,2.929,7.071,2.929s5.119-0.976,7.071-2.929l33.654-33.654
C448.061,401.63,448.061,395.298,444.156,391.392z"/>
</g>
</g>
<g>
<g>
<path d="M158.253,66.268c-1.182-17.147-15.004-30.969-32.151-32.151c-9.723-0.669-18.991,2.611-26.091,9.239
c-7.001,6.535-11.017,15.775-11.017,25.349c0.001,5.524,4.478,10.001,10.001,10.001s10-4.477,10-10
c0-4.111,1.656-7.921,4.664-10.729c3.003-2.804,6.938-4.196,11.069-3.906c7.239,0.499,13.074,6.334,13.573,13.573
c0.505,7.319-4.293,13.787-11.408,15.379c-7.788,1.742-13.227,8.513-13.227,16.465v5.335c0,5.523,4.477,10,10,10s10-4.477,10-10
v-2.91C149.16,97.291,159.385,82.684,158.253,66.268z"/>
</g>
</g>
<g>
<g>
<path d="M130.74,136.02c-1.86-1.86-4.44-2.93-7.07-2.93c-2.64,0-5.21,1.07-7.07,2.93c-1.87,1.86-2.93,4.44-2.93,7.07
s1.06,5.21,2.93,7.07c1.86,1.86,4.43,2.93,7.07,2.93c2.63,0,5.21-1.07,7.07-2.93c1.86-1.86,2.93-4.44,2.93-7.07
S132.6,137.88,130.74,136.02z"/>
</g>
</g>
<g>
<g>
<path d="M108.57,454.93c-1.86-1.86-4.44-2.93-7.07-2.93s-5.21,1.07-7.07,2.93s-2.93,4.44-2.93,7.07s1.07,5.21,2.93,7.07
c1.86,1.86,4.44,2.93,7.07,2.93s5.21-1.07,7.07-2.93s2.93-4.44,2.93-7.07S110.43,456.79,108.57,454.93z"/>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -8,43 +8,9 @@ fi
sudo chmod +x ./uninstall.sh
sudo ./uninstall.sh
sudo docker network create fyipe-network || "Netork already exists."
# Sleep
sleep 5s
sudo mkdir /Users/$whoami/mongodb || echo 'Path already exists'
# Run Dependencies
sudo docker run -v /Users/$whoami/mongodb:/data/db -p 27017:27017 -d mongo:3.4
sudo docker run --name redis -p 6379:6379 -d redis:5.0.7 redis-server
# Sleep
sleep 5s
# Run Backend
sudo docker build -t fyipe-project/backend:latest ./backend
sudo docker run --name backend --net=host -p 3002:3002 --env-file=./backend/.env.development -d fyipe-project/backend:latest #port is not needed because of nethost
# Run Accounts
sudo docker build -t fyipe-project/accounts:latest ./accounts
sudo docker run --name accounts -p 3003:3003 -d fyipe-project/accounts:latest
#Run Dashboard
sudo docker build -t fyipe-project/dashboard:latest ./dashboard
sudo docker run --name dashboard -p 3000:3000 -d fyipe-project/dashboard:latest
# Run home
sudo docker build -t fyipe-project/home:latest ./home
sudo docker run --name home -p 1444:1444 -d fyipe-project/home:latest
# Run Status Page
sudo docker build -t fyipe-project/status-page:latest ./status-page
sudo docker run --name status-page -p 3006:3006 -d fyipe-project/status-page:latest
# Run Admin Dashboard
sudo docker build -t fyipe-project/admin-dashboard:latest ./admin-dashboard
sudo docker run --name admin-dashboard -p 3100:3100 -d fyipe-project/admin-dashboard:latestcd
# Run Probes 1
sudo docker build -t fyipe-project/probe:latest ./probe

View File

@ -1,4 +1,5 @@
echo "REMOVING EXISTING CONTAINERS..."
sudo docker-compose down
sudo docker stop $(sudo docker ps -aq) || echo 'No docker containers'
sudo docker rm $(sudo docker ps -aq) || echo 'No docker containers'
echo "EXISTING CONTAINERS REMOVED."