Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

Run sqlite environment in docker

Cette révision appartient à :
tomleb 2017-05-06 00:34:41 -04:00
Parent be9a9c5a06
révision 125a53263b
8 fichiers modifiés avec 50 ajouts et 0 suppressions

2
.gitignore externe
Voir le fichier

@ -8,3 +8,5 @@ nyaa-master.exe
*.swp
.vscode
templates/*.html.go
*.backup
tags

2
deploy/.env Fichier normal
Voir le fichier

@ -0,0 +1,2 @@
PANTSU_EXTERNAL_PORT=9999
PANTSU_INTERNAL_PORT=9999

5
deploy/Dockerfile Fichier normal
Voir le fichier

@ -0,0 +1,5 @@
FROM golang:1.8.1
RUN mkdir -p /nyaa
WORKDIR /nyaa

Voir le fichier

@ -0,0 +1,19 @@
version: '3'
services:
pantsu:
build:
context: ..
dockerfile: deploy/Dockerfile
command: ./deploy/init.sh
env_file:
- sqlite.env
environment:
- PANTSU_INTERNAL_PORT=${PANTSU_INTERNAL_PORT}
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"

10
deploy/init.sh Fichier exécutable
Voir le fichier

@ -0,0 +1,10 @@
#!/bin/bash
set -ex
go get github.com/ewhal/nyaa
go build
./nyaa -host 0.0.0.0 \
-port "${PANTSU_INTERNAL_PORT}" \
-dbtype "${PANTSU_DBTYPE}" \
-dbparams "${PANTSU_DBPARAMS}"

7
deploy/postgres.env Fichier normal
Voir le fichier

@ -0,0 +1,7 @@
POSTGRES_USER="nyaapantsu"
POSTGRES_PASSWORD="nyaapantsu"
POSTGRES_DB="nyaa_db"
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"

3
deploy/restore.sh Fichier normal
Voir le fichier

@ -0,0 +1,3 @@
#!/bin/bash
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER}" < "${PANTSU_POSTGRES_DBFILE}"

2
deploy/sqlite.env Fichier normal
Voir le fichier

@ -0,0 +1,2 @@
PANTSU_DBTYPE="sqlite3"
PANTSU_DBPARAMS="./nyaa.db"