Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Add postgres docker support

Not tested yet as the current postgres dump is incompatible with the
application. We need to fix ourselve to one schema and stick to it for
whatever database backend we support.
Cette révision appartient à :
tomleb 2017-05-06 01:32:43 -04:00
Parent 125a53263b
révision ded00e5ceb
4 fichiers modifiés avec 42 ajouts et 7 suppressions

Voir le fichier

@ -1,2 +1,3 @@
PANTSU_EXTERNAL_PORT=9999
PANTSU_INTERNAL_PORT=9999
PANTSU_POSTGRES_DBFILE=nyaa_psql.backup

Voir le fichier

@ -0,0 +1,34 @@
version: '3'
services:
pantsu:
build:
context: ..
dockerfile: deploy/Dockerfile
command: ./deploy/init.sh
depends_on:
- pantsu_db
env_file:
- postgres.env
environment:
- PANTSU_INTERNAL_PORT=${PANTSU_INTERNAL_PORT}
links:
- pantsu_db
ports:
# 0.0.0.0 makes it accessible to the network
# You may want to remove it to make pantsu available only
# to localhost
- 0.0.0.0:${PANTSU_EXTERNAL_PORT}:${PANTSU_INTERNAL_PORT}
volumes:
- "${GOPATH}:/go/"
- "./..:/nyaa"
pantsu_db:
env_file:
- postgres.env
environment:
- PANTSU_POSTGRES_DBFILE=${PANTSU_POSTGRES_DBFILE}
image: postgres:9.6.2
volumes:
# restore.sh will be sourced after initial initdb
- "./restore.sh:/docker-entrypoint-initdb.d/restore.sh"
- "./../${PANTSU_POSTGRES_DBFILE}:/${PANTSU_POSTGRES_DBFILE}"

Voir le fichier

@ -1,7 +1,6 @@
POSTGRES_USER="nyaapantsu"
POSTGRES_PASSWORD="nyaapantsu"
POSTGRES_DB="nyaa_db"
POSTGRES_USER=nyaapantsu
POSTGRES_PASSWORD=nyaapantsu
POSTGRES_DB=nyaapantsu
PANTSU_DBTYPE="postgres"
PANTSU_DBPARAMS="host=pantsu_db user=${POSTGRES_USER} dbname=${POSTGRES_DB} sslmode=disable password=${POSTGRES_PASSWORD}"
PANTSU_POSTGRES_DBFILE="nyaa_psql.backup"
PANTSU_DBTYPE=postgres
PANTSU_DBPARAMS=host=pantsu_db user=${POSTGRES_USER} dbname=${POSTGRES_DB} sslmode=disable password=${POSTGRES_PASSWORD}

3
deploy/restore.sh Fichier normal → Fichier exécutable
Voir le fichier

@ -1,3 +1,4 @@
#!/bin/bash
# Restore the database from a postgres dump
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" < "${PANTSU_POSTGRES_DBFILE}"
pg_restore --username "${POSTGRES_USER}" -d ${POSTGRES_DB} "/${PANTSU_POSTGRES_DBFILE}"