-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathu.sh
executable file
·53 lines (45 loc) · 1.51 KB
/
u.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
#!/bin/sh
# Arranca con unicorn --suponiendo que ya se ejecutaron otras labores
# necesarias para ejecutar como instalar gemas, generar recursos,
# actualizar índices, etc. Ver bin/corre
if (test "${DIRAP}" = "") then {
echo "Definir directorio de la aplicación en DIRAP"
exit 1;
} fi;
if (test -f "${DIRAP}/.env") then {
. $DIRAP/.env
} fi;
if (test "${SECRET_KEY_BASE}" = "") then {
echo "Definir variable de ambiente SECRET_KEY_BASE"
exit 1;
} fi;
if (test "${USUARIO_AP}" = "") then {
echo "Definir usuario con el que se ejecuta en USUARIO_AP"
exit 1;
} fi;
defuroot=""
if (test "${RAILS_RELATIVE_URL_ROOT}" != "") then {
defuroot="RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT}"
} fi;
DOAS=`which doas 2> /dev/null`
if (test "$?" != "0") then {
DOAS="sudo"
} fi;
$DOAS su - ${USUARIO_AP} -c "cd $DIRAP;
echo \"== Iniciando unicorn... ==\";
${defuroot} BD_CLAVE='${BD_CLAVE}' \
BD_PRO=\"${BD_PRO}\" \
BD_USUARIO=\"${BD_USUARIO}\" \
CONFIG_HOSTS=\"${CONFIG_HOSTS}\" \
DIRAP=\"${DIRAP}\" \
HEB412_RUTA=\"${HEB412_RUTA}\" \
PUERTOUNICORN=\"${PUERTOUNICORN}\" \
RAILS_ENV=production \
RUTA_RELATIVA=\"${RUTA_RELATIVA}\" \
SECRET_KEY_BASE=\"${SECRET_KEY_BASE}\" \
MSIP_FORMATO_FECHA=\"${MSIP_FORMATO_FECHA}\" \
MSIP_RUTA_ANEXOS=\"${MSIP_RUTA_ANEXOS}\" \
MSIP_RUTA_VOLCADOS=\"${MSIP_RUTA_VOLCADOS}\" \
MSIP_TITULO=\"${MSIP_TITULO}\" \
bundle exec /usr/local/bin/unicorn_rails \
-c ${DIRAP}/config/unicorn.conf.minimal.rb -E production -D"