forked from gigascience/gigadb-website
-
Notifications
You must be signed in to change notification settings - Fork 1
/
up.sh
executable file
·95 lines (68 loc) · 3.18 KB
/
up.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
# bails on error
set -e
# print command being run
set -x
dbSet=${1:-"dev"}
echo "Starting all services..."
# Make the Docker API available on TCP port 2375 on mac (unnecessary on windows or linux)
if [ "$(uname)" == "Darwin" ];then
docker stop socat && docker rm socat
docker run --name socat -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:2375:2375 alpine/socat TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock || true
fi;
# Check there is .env
if ! [ -f ./.env ];then
read -sp "To create .env, enter your private gitlab token and name of the name of your fork on GitLab: " token
read -p "To create .env, enter the name of your fork on GitLab: " reponame
cp ops/configuration/variables/env-sample .env
sed -i'.bak' "s/#GITLAB_PRIVATE_TOKEN=/GITLAB_PRIVATE_TOKEN=$token/" .env
sed -i'.bak' "s/REPO_NAME=\"<Your fork name here>\"/REPO_NAME=\"$reponame\"/" .env
rm .env.bak
fi
# write down application version
git describe --always > VERSION
# Configure the container services
docker-compose run --rm config
docker-compose run --rm fuw-config
# start the container admin UI (not in CI)
if [ "$(uname)" == "Darwin" ];then
./ops/scripts/start_portainer.sh
fi;
# Build console and web containers (needed when switching between branches often)
docker-compose build web test application database fuw-public fuw-admin console
# Launch the services required by GigaDB and FUW, and then start nginx (web server)
docker-compose up -d application database fuw-public fuw-admin console
# start web server
docker-compose up -d web
# Install composer dependencies for GigaDB
docker-compose exec -T application composer install
# Compile the CSS files
docker-compose run --rm less
# Install composer dependencies for FUW
docker-compose exec -T fuw-admin composer install
# Install the NPM dependencies for the Javascript application and the ops scripts
docker-compose run --rm js bash -c "npm install"
docker-compose run --rm js bash -c "cd /var/www/ops/scripts/ && npm install"
# Build and deploy the Javascript application
docker-compose run --rm js
# Start Chome web driver container services for acceptance testing
docker-compose up -d chrome
# Install dependencies for the Beanstalkd workers
docker-compose exec -T console bash -c 'cd /gigadb-apps/worker/file-worker/ && composer install'
# Start Beanstalkd workers after running the required migrations
docker-compose exec -T console /app/yii migrate/fresh --interactive=0
docker-compose up -d fuw-worker gigadb-worker
# Start
# Bootstrap the main database using data from "data/dev" by default or using the one passed as parameter
./ops/scripts/setup_devdb.sh $dbSet
# Bootstrap the test database for unit tests using data from "data/gigadb_testdata"
./ops/scripts/setup_testdb.sh gigadb_testdata
# create the database dumps needed by functional tests and acceptance tests
./ops/scripts/make_pgdmp_gigadb_testdata.sh
./ops/scripts/make_pgdmp_production_like.sh
./ops/scripts/make_pgdmp_gigadb.sh
# generate reference data feed for file formats and file types
docker-compose run --rm test ./protected/yiic generatefiletypes
docker-compose run --rm test ./protected/yiic generatefileformats
#show status of all containers
docker ps