Fixed postgres problems
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
2051b65463
commit
afe6ab80db
|
@ -10,6 +10,27 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
- name: copy setup script
|
||||||
|
template:
|
||||||
|
src: etc/rt/setup.sh.j2
|
||||||
|
dest: /etc/rt/setup.sh
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
- name: copy wait for script
|
||||||
|
template:
|
||||||
|
src: etc/rt/wait-for.sh.j2
|
||||||
|
dest: /etc/rt/wait-for.sh
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
- name: copy postgresql config
|
||||||
|
template:
|
||||||
|
src: etc/rt/postgresql.conf.j2
|
||||||
|
dest: /etc/rt/postgresql.conf
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
- name: start rt docker container
|
- name: start rt docker container
|
||||||
docker_compose:
|
docker_compose:
|
||||||
project_src: /etc/rt
|
project_src: /etc/rt
|
||||||
|
|
|
@ -1,15 +1,57 @@
|
||||||
version: '2'
|
version: '2'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
database:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- db_conn
|
||||||
|
command:
|
||||||
|
- postgres
|
||||||
|
- -c
|
||||||
|
- config_file=/etc/postgresql/postgresql.conf
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER={{ rt_postgres_user }}
|
||||||
|
- POSTGRES_PASSWORD={{ rt_postgres_password }}
|
||||||
|
volumes:
|
||||||
|
- /var/lib/postgres/data:/var/lib/postgres/data
|
||||||
|
- /etc/rt/postgresql.conf:/etc/postgresql/postgresql.conf
|
||||||
rt:
|
rt:
|
||||||
image: netsandbox/request-tracker:latest
|
image: netsandbox/request-tracker:latest
|
||||||
|
depends_on:
|
||||||
|
- database
|
||||||
ports:
|
ports:
|
||||||
- "8082:80"
|
- "8082:80"
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- /etc/rt/setup.sh:/usr/local/bin/setup.sh
|
||||||
|
- /etc/rt/wait-for.sh:/usr/local/bin/wait-for.sh
|
||||||
restart: always
|
restart: always
|
||||||
|
entrypoint:
|
||||||
|
- /usr/local/bin/wait-for.sh
|
||||||
|
- database:5432
|
||||||
|
- --
|
||||||
|
- /usr/local/bin/setup.sh
|
||||||
|
networks:
|
||||||
|
- db_conn
|
||||||
environment:
|
environment:
|
||||||
- RT_WEB_PORT=8082
|
- WEB_DOMAIN=rt.2martens.de
|
||||||
|
- RT_DB_NAME=rt4
|
||||||
|
- RT_DB_HOST=database
|
||||||
|
- RT_DB_PORT=5432
|
||||||
|
- RT_DB_USER={{ rt_postgres_user }}
|
||||||
|
- RT_DB_PASSWORD={{ rt_postgres_password }}
|
||||||
|
- DATABASE_USER={{ rt_postgres_user }}
|
||||||
|
- DATABASE_PASSWORD={{ rt_postgres_password }}
|
||||||
|
- DATABASE_NAME=rt4
|
||||||
|
- DATABASE_HOST=database
|
||||||
|
- RT_NAME={{ rt_domain }}
|
||||||
|
- TIMEZONE=Europe/Berlin
|
||||||
|
- OWNER_EMAIL={{ admin_mail }}
|
||||||
|
- WEB_BASE_URL=https://{{ rt_domain}}
|
||||||
|
- WEB_PORT=443
|
||||||
- LC_ALL=C.UTF-8
|
- LC_ALL=C.UTF-8
|
||||||
- LANG=C.UTF-8
|
- LANG=C.UTF-8
|
||||||
|
networks:
|
||||||
|
db_conn:
|
||||||
|
driver: bridge
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
listen_addresses = '*'
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
CONTAINER_ALREADY_STARTED="/opt/rt4/CONTAINER_ALREADY_STARTED_PLACEHOLDER"
|
||||||
|
if [ ! -e $CONTAINER_ALREADY_STARTED ]; then
|
||||||
|
touch $CONTAINER_ALREADY_STARTED
|
||||||
|
/opt/rt4/sbin/rt-setup-database --action init --dba {{ rt_postgres_user }} --dba-password {{ rt_postgres_password }}
|
||||||
|
exec /usr/local/bin/entrypoint.sh --web
|
||||||
|
else
|
||||||
|
exec /usr/local/bin/entrypoint.sh --web
|
||||||
|
fi
|
|
@ -0,0 +1,79 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
TIMEOUT=15
|
||||||
|
QUIET=0
|
||||||
|
|
||||||
|
echoerr() {
|
||||||
|
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
exitcode="$1"
|
||||||
|
cat << USAGE >&2
|
||||||
|
Usage:
|
||||||
|
$cmdname host:port [-t timeout] [-- command args]
|
||||||
|
-q | --quiet Do not output any status messages
|
||||||
|
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
||||||
|
-- COMMAND ARGS Execute command with args after the test finishes
|
||||||
|
USAGE
|
||||||
|
exit "$exitcode"
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for() {
|
||||||
|
for i in `seq $TIMEOUT` ; do
|
||||||
|
nc -z "$HOST" "$PORT" > /dev/null 2>&1
|
||||||
|
|
||||||
|
result=$?
|
||||||
|
if [ $result -eq 0 ] ; then
|
||||||
|
if [ $# -gt 0 ] ; then
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "Operation timed out" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
*:* )
|
||||||
|
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
|
||||||
|
PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
-q | --quiet)
|
||||||
|
QUIET=1
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
-t)
|
||||||
|
TIMEOUT="$2"
|
||||||
|
if [ "$TIMEOUT" = "" ]; then break; fi
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--timeout=*)
|
||||||
|
TIMEOUT="${1#*=}"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
--help)
|
||||||
|
usage 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echoerr "Unknown argument: $1"
|
||||||
|
usage 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$HOST" = "" -o "$PORT" = "" ]; then
|
||||||
|
echoerr "Error: you need to provide a host and port to test."
|
||||||
|
usage 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
wait_for "$@"
|
|
@ -1,2 +1,4 @@
|
||||||
---
|
---
|
||||||
rt_domain: best-practical.com
|
rt_domain: best-practical.com
|
||||||
|
rt_postgres_user: postgres
|
||||||
|
rt_postgres_password: NotSafePleaseChange
|
||||||
|
|
Loading…
Reference in New Issue