-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·29 lines (25 loc) · 943 Bytes
/
start.sh
File metadata and controls
executable file
·29 lines (25 loc) · 943 Bytes
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
#!/bin/bash
# Esse é o primeiro script a ser executado quando o container/replit executa.
# Atualmente, ele:
# - Cria a pasta do banco de dados
# - Configura o postgresql
# - Levanta o postgresql
# - Aplica o arquivo main.sql em `postgres`
#
# É esperado que o repositório esteja em /home/runner/ProjetoPIBD. O replit
# monta por padrão enquanto o Docker monta no script start-docker.sh
#
# As pastas de dados estão em:
# - dados /home/runner/postgres
# - socket /home/runner/postgres/...
# - logs /home/runner/postgres/postgresql.log
export PGDATA="/home/runner/postgres"
if [ ! -d $PGDATA ]; then
initdb --auth-host=trust
sed -i "s/#unix_socket_directories = '\/run\/postgresql'/unix_socket_directories='\/home\/runner\/postgres'/" \
$PGDATA/postgresql.conf
fi
if [ ! -f $PGDATA/postmaster.pid ]; then
pg_ctl -l $PGDATA/postgresql.log start
fi
m4 bundle.m4 sql/index.sql | psql --echo-all postgresql://127.0.0.1/postgres