madibaalbert commited on
Commit
72eaffa
·
verified ·
1 Parent(s): 0ab77bd

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +13 -6
entrypoint.sh CHANGED
@@ -2,9 +2,10 @@
2
  set -e
3
 
4
  PG_BIN="/usr/lib/postgresql/14/bin"
 
5
 
6
  echo ">>> Préparation des répertoires persistants..."
7
- mkdir -p /data/postgres
8
  mkdir -p /data/mattermost/data/files
9
  mkdir -p /data/mattermost/plugins
10
  mkdir -p /data/mattermost/client/plugins
@@ -13,15 +14,21 @@ echo ">>> Correction des permissions..."
13
  chown -R 1000:1000 /data /opt/mattermost
14
 
15
  # Initialiser PostgreSQL si ce n'est pas déjà fait
16
- if [ ! -f "/data/postgres/PG_VERSION" ]; then
17
  echo ">>> Initialisation du cluster PostgreSQL..."
18
- su - huggingface -c "${PG_BIN}/initdb -D /data/postgres"
19
- echo "host all all 127.0.0.1/32 md5" >> /data/postgres/pg_hba.conf
20
- echo "listen_addresses='localhost'" >> /data/postgres/postgresql.conf
 
 
21
  fi
22
 
23
  echo ">>> Démarrage de PostgreSQL..."
24
- su - huggingface -c "${PG_BIN}/pg_ctl -D /data/postgres -l /data/postgres/logfile start"
 
 
 
 
25
  sleep 2
26
 
27
  # Créer l'utilisateur et la base mattermost (idempotent)
 
2
  set -e
3
 
4
  PG_BIN="/usr/lib/postgresql/14/bin"
5
+ PG_DATA="/data/postgres"
6
 
7
  echo ">>> Préparation des répertoires persistants..."
8
+ mkdir -p ${PG_DATA}
9
  mkdir -p /data/mattermost/data/files
10
  mkdir -p /data/mattermost/plugins
11
  mkdir -p /data/mattermost/client/plugins
 
14
  chown -R 1000:1000 /data /opt/mattermost
15
 
16
  # Initialiser PostgreSQL si ce n'est pas déjà fait
17
+ if [ ! -f "${PG_DATA}/PG_VERSION" ]; then
18
  echo ">>> Initialisation du cluster PostgreSQL..."
19
+ su - huggingface -c "${PG_BIN}/initdb -D ${PG_DATA}"
20
+ # Configuration locale : écoute locale et socket dans /data/postgres
21
+ echo "host all all 127.0.0.1/32 md5" >> ${PG_DATA}/pg_hba.conf
22
+ echo "listen_addresses='localhost'" >> ${PG_DATA}/postgresql.conf
23
+ echo "unix_socket_directories = '${PG_DATA}'" >> ${PG_DATA}/postgresql.conf
24
  fi
25
 
26
  echo ">>> Démarrage de PostgreSQL..."
27
+ su - huggingface -c "${PG_BIN}/pg_ctl -D ${PG_DATA} -l ${PG_DATA}/pg_start.log -w start" || {
28
+ echo "!!! Échec du démarrage de PostgreSQL. Logs :"
29
+ cat ${PG_DATA}/pg_start.log
30
+ exit 1
31
+ }
32
  sleep 2
33
 
34
  # Créer l'utilisateur et la base mattermost (idempotent)