forked from celluloid-camp/celluloid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision.sh
73 lines (53 loc) · 1.95 KB
/
provision.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
#!/bin/bash
sudo su - vagrant
echo "== Installing Node =="
sudo apt install -y nodejs
echo "== Installing yarn =="
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn
echo "== Installing Postgres =="
sudo apt install -y postgresql
echo "== Copying repository =="
cp -R /vagrant/* ~/
cd ~
echo "== Creating user and database =="
sudo -u postgres psql -c "create user celluloid with encrypted password '${CELLULOID_PG_PASSWORD}';"
sudo -u postgres psql -c "alter user celluloid with SUPERUSER;"
sudo -u postgres psql -c "create database celluloid with owner celluloid;"
echo "== Running yarn =="
yarn
echo "== Creating environment file =="
echo "\
# HTTP server port. Do not change unless you know what you're doing.
CELLULOID_LISTEN_PORT=${CELLULOID_LISTEN_PORT}
# Postgres server IP address or hostname.
CELLULOID_PG_HOST=${CELLULOID_PG_HOST}
# Postgres port.
CELLULOID_PG_PORT=${CELLULOID_PG_PORT}
# Postgres database name.
CELLULOID_PG_DATABASE=${CELLULOID_PG_DATABASE}
# Postgres database user.
CELLULOID_PG_USER=${CELLULOID_PG_USER}
# Postgres database password.
CELLULOID_PG_PASSWORD=${CELLULOID_PG_PASSWORD}
# Postgres connection pool config. Change at your own risk.
CELLULOID_PG_MAX_POOL_SIZE=${CELLULOID_PG_MAX_POOL_SIZE}
CELLULOID_PG_IDLE_TIMEOUT=${CELLULOID_PG_IDLE_TIMEOUT}
# Cookie secret key. Generate something random and long.
CELLULOID_COOKIE_SECRET=${CELLULOID_COOKIE_SECRET}
# email params. Check with your SMTP provider
CELLULOID_SMTP_HOST=${CELLULOID_SMTP_HOST}
CELLULOID_SMTP_USER=${CELLULOID_SMTP_USER}
CELLULOID_SMTP_PASSWORD=${CELLULOID_SMTP_PASSWORD}
CELLULOID_SMTP_TLS=${CELLULOID_SMTP_TLS}
CELLULOID_SMTP_PORT=${CELLULOID_SMTP_PORT}
" > .env
echo "== Creating database schema =="
cd bin
./create_schema.sh
cd ..
echo "== Building =="
yarn build
echo "== Starting =="
yarn start &