forked from TheCacophonyProject/cacophony-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·35 lines (27 loc) · 1015 Bytes
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -e
echo "---- Starting Minio ----"
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=miniostorage
./minio server --address :9001 .data &> minio.log &
echo "---- Starting PostgreSQL ----"
service postgresql start
sudo -i -u postgres psql -c "CREATE USER test with password 'test'"
sudo -i -u postgres psql -c "CREATE DATABASE cacophonytest WITH OWNER test;"
sudo -i -u postgres psql cacophonytest -c "CREATE EXTENSION postgis"
echo "---- Setting up Minio ----"
./mc config host add myminio http://127.0.0.1:9001 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
./mc mb myminio/cacophony
if [[ $ISOLATE -eq 1 ]]; then
cp -r /app app-isolated
echo "---- Installing npm dependencies ----"
cd /app-isolated
npm install
npm run apidoc
else
cd /app
fi
echo "---- Migrating database ----"
node_modules/.bin/sequelize db:migrate --config config/app_test_default.js
sudo -i -u postgres psql cacophonytest -f /app/test/db-seed.sql
$NODE_BIN Server.js --config=config/app_test_default.js