-
Notifications
You must be signed in to change notification settings - Fork 7
/
epas-first-setup.sh
42 lines (33 loc) · 1.92 KB
/
epas-first-setup.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
#!/bin/bash
# ePAS for Linux installation script
#
# See https://github.com/consiglionazionaledellericerce/epas for more details.
#
# This script is meant for quick & easy install via:
# $ curl -fsSL https://raw.githubusercontent.com/consiglionazionaledellericerche/epas/master/epas-first-setup.sh -o epas-first-setup.sh && sh epas-first-setup.sh
# NOTE: Make sure to verify the contents of the script
# you downloaded matches the contents of epas-first-setup.sh
# located at https://github.com/consiglionazionaledellericerche/epas/epas-first-setup.sh
#
# This script need docker and docker-compose to be installed to completed successfully.
INSTALL_DIR=${INSTALL_DIR:-.}
echo "ePAS installation script."
echo "Before running this script install docker, docker compose and add current user to docker group."
read -p "Press enter to continue, Ctrl+C to abort" ready
command -v docker -v >/dev/null 2>&1 || { echo >&2 "Docker not found. Aborting."; exit 1; }
command -v docker-compose -v >/dev/null 2>&1 || { echo >&2 "Docker-compose not found. Aborting."; exit 1; }
mkdir -p $INSTALL_DIR/epas/attachments $INSTALL_DIR/epas/logs $INSTALL_DIR/postgres/data
cd $INSTALL_DIR
curl https://raw.githubusercontent.com/consiglionazionaledellericerche/epas/main/docker-compose.yml -o docker-compose.yml
curl https://raw.githubusercontent.com/consiglionazionaledellericerche/epas/main/.env -o .env
# Creazione e impostazione dell'application secret
APPLICATION_SECRET=`tr -dc A-Za-z0-9 < /dev/urandom | head -c 64 ; echo`
sed "s|#- APPLICATION_SECRET=|- APPLICATION_SECRET=|g" -i docker-compose.yml
sed "s|#APPLICATION_SECRET=|APPLICATION_SECRET=${APPLICATION_SECRET}|g" -i .env
# Avvio del postgres e creazione del DB vuoto epas
docker-compose up -d postgres
# Attesa che il container docker sia pronto
sleep 10
docker-compose exec postgres createdb -U postgres epas
# Avvio di ePAS che si occuperà anche di popolare il db
docker-compose up -d