34 Commits

Author SHA1 Message Date
Nick Stokoe
5e04b2f056 snackpot.yml - open ports for terraria 2021-12-03 17:59:35 +00:00
Nick Stokoe
32cabdd1f4 docker-compose.yml etc. - proxy jellyfin on virtual host
nominally working, although some hard-wired values to remove
2021-12-03 17:59:35 +00:00
Nick Stokoe
12f3fcbaaf docker-compose.yml - reverse proxy the jellyfin container as virtual host
we need to take it of host network mode, add it to the proxy-tier and
default networks, then enable proxying and lets-encrypt.

Tested, works.
2021-12-03 17:59:35 +00:00
Nick Stokoe
15ce90e098 docker-compose/docker-compose.yml - upgrade nextcloud to v22 2021-12-03 17:59:35 +00:00
Nick Stokoe
bb20922852 templates/docker-compose/mopidy - update tracked commit 2021-12-03 17:59:35 +00:00
Nick Stokoe
3d09f9d1e9 docker-compose/docker-compose.yml - upgrade nextcloud and others 2021-12-03 17:59:35 +00:00
Nick Stokoe
2512d2ef31 docker-compose/docker-compose.yml - add extra_hosts snackpot:host-gateway for mopidy 2021-12-03 17:59:35 +00:00
Nick Stokoe
a6290fe82d docker-compose/upmpdcli/upmpdcli.conf - don't check the content format
As this will disallow things that should be allowed.
2021-12-03 17:59:35 +00:00
Nick Stokoe
a4f0664663 docker-compose/upmpdcli/Dockerfile - explicitly specify the config file
In  the command parameters for upmpdcli - otherwise it seems not to be
picked up.
2021-12-03 17:59:35 +00:00
Nick Stokoe
5b3440457f add jellyfin 2021-12-03 17:59:35 +00:00
Nick Stokoe
73821733cf docker-compose/upmpdcli/Dockerfile - use python3 not 2 2021-12-03 17:59:35 +00:00
Nick Stokoe
32aaf0fe6b docker-compose.yml - set mopidy to restart: always 2021-12-03 17:59:35 +00:00
Nick Stokoe
17a04fc559 docker-compose.yml - set upmpdcli to restart: always 2021-12-03 17:59:35 +00:00
Nick Stokoe
18ec2c5320 docker-compose/upmpdcli/Dockerfile - add openssl to the package list
upmpdcli seems to use this, optionally
2021-12-03 17:59:35 +00:00
Nick Stokoe
d3fa11cf90 docker-compose.yml - add local audio access to mopidy 2021-12-03 17:59:35 +00:00
Nick Stokoe
caca059da0 snackpot.yml, docker-compose.yml - add mopidy and upmpdcli services
mopidy includes icecast
2021-12-03 17:59:35 +00:00
Nick Stokoe
625b2a656a docker-compose.yml - add MINIDLNA_INOTIFY=yes to minidlna
We want it to spot file changes
2021-12-03 17:59:35 +00:00
Nick Stokoe
71d8edab0a snackpot.yml, docker-compose.yml - these nextcloud paths can be fixed 2021-12-03 17:59:35 +00:00
Nick Stokoe
c160ba5193 snackpot.yml etc. - refine docker-compose config deploy
The main job of this commit:
- Be explicit about templates: expect the .j2 extension
- Copy all other files, so that they can be binary
- Don't deploy dotfiles or dotdirectories.

This snuck in:
- Remove `test` tag
- Refine some descriptions
2021-12-03 17:59:35 +00:00
Nick Stokoe
3aaa6deb34 templates/docker-compose/docker-compose.yml - remove some comment cruft 2021-12-03 17:59:35 +00:00
Nick Stokoe
3acc92043c snackpot.yml - add minidlna containiner
set all ports with firewall_ports
2021-12-03 17:59:35 +00:00
Nick Stokoe
375172e34e roles/ufw/tasks/main.yml - allow more flexible port config
specifically, allow specifying protocol
2021-12-03 17:59:35 +00:00
Nick Stokoe
fcad61a6c4 roles/docker_compose/tasks/main.yml - set docker data-root dir 2021-12-03 17:59:35 +00:00
Nick Stokoe
02b37f5680 docker-compose/docker-compose.yml - add nextcloud_cron
For running the cron job
2021-12-03 17:59:35 +00:00
Nick Stokoe
8df232dd91 templates/docker-compose/docker-compose.yml - bump nextcloud to v18.0.13 2021-12-03 17:59:35 +00:00
Nick Stokoe
108193a007 snackpot.yml - tag role invocations with docker-config
Else tagging doesn't work correctly
2021-12-03 17:59:35 +00:00
Nick Stokoe
3e69a85426 templates/bin/ncadmin - remove crufty comments 2021-12-03 17:59:35 +00:00
Nick Stokoe
b72b413755 templates/docker-compose/docker-compose.yml - share /srv with nextcloud
For ease of imports
2021-12-03 17:59:35 +00:00
Nick Stokoe
b602592ea4 snackpot.yml - set up networking on server 2021-12-03 17:59:35 +00:00
Nick Stokoe
32f6767cd4 snackpot.yml - add docker compose config
Nominally working and tested on a remote VM
2021-12-03 17:59:35 +00:00
Nick Stokoe
e887ad1898 snackpot.yml - adapt from server.playbook.yml 2021-12-03 17:59:35 +00:00
Nick Stokoe
cc89a3f437 roles/docker_compose/handlers/main.yml - add 'listen' clause
So we can notify from outside the role
2021-12-03 17:59:35 +00:00
Nick Stokoe
3866f6a0f2 roles/docker_compose_install/ -> roles/docker_compose 2021-12-03 17:59:35 +00:00
Nick Stokoe
38c2667d2d docker_compose_install - corrections from original copy
Use python 3, don't hardwire docker version, etc.
2021-12-03 17:58:01 +00:00
28 changed files with 868 additions and 50 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "templates/docker-compose/mopidy"]
path = templates/docker-compose/mopidy
url = git@github.com:Log1x/docker-mopidy-iris.git

View File

@@ -1,15 +0,0 @@
---
## Installs docker-CE
# Following guide from here:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
# The docker apt repo key uri
docker_compose_install_apt_key_uri: https://download.docker.com/linux/ubuntu/gpg
# The docker apt repo config line
docker_compose_install_apt_repo: deb https://download.docker.com/linux/ubuntu bionic stable
# Get this version from https://github.com/docker/compose/releases/
# Check compatibility with docker.
docker_compose_install_compose_verion: 1.22.0

View File

@@ -0,0 +1,23 @@
---
## Installs docker-CE
# Following guide from here:
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
# The docker apt repo key uri
docker_compose_apt_key_uri: https://download.docker.com/linux/ubuntu/gpg
# The docker apt repo config line
docker_compose_apt_repo: deb https://download.docker.com/linux/ubuntu {{ansible_lsb.codename}} stable
# Get this version from https://github.com/docker/compose/releases/
# Check compatibility with docker.
# This needs to be supplied externally.
docker_compose_install_version: Change me!
# Define where the docker project source directory is
# This needs to be supplied externally
docker_compose_base_dir: /opt/docker-compose
# Where the docker-compose binary is put (assumed executable)
docker_compose_exe: /usr/local/bin/docker-compose

View File

@@ -0,0 +1,13 @@
---
- name: restart docker daemon
systemd:
name: docker
state: restarted
listen: restart docker daemon
- name: restart docker compose services
docker_compose:
restarted: yes
project_src: "{{ docker_compose_base_dir }}"
build: no
listen: restart docker compose services

View File

@@ -7,19 +7,19 @@
- apt-transport-https - apt-transport-https
- ca-certificates - ca-certificates
- software-properties-common - software-properties-common
- python-pip - python3-pip
- virtualenv - virtualenv
- python-setuptools - python3-setuptools
- python-docker - python3-docker
- name: add docker repository key - name: add docker repository key
apt_key: apt_key:
url: "{{ docker_compose_install_apt_key_uri }}" url: "{{ docker_compose_apt_key_uri }}"
state: present state: present
- name: add docker repository - name: add docker repository
apt_repository: apt_repository:
repo: "{{ docker_compose_install_apt_repo }}" repo: "{{ docker_compose_apt_repo }}"
filename: docker-ce filename: docker-ce
state: present state: present
update_cache: true update_cache: true
@@ -38,6 +38,20 @@
name: name:
- docker-compose - docker-compose
- name: docker daemon configuration
copy:
dest: /etc/docker/daemon.json
content: |-
{
"data-root": "/srv/docker",
"log-driver": "json-file",
"log-opts": {
"max-size": "30m"
}
}
notify:
- restart docker daemon
- name: enable docker - name: enable docker
service: service:
name: docker name: docker

View File

@@ -0,0 +1,5 @@
---
# Enables a sudoer group
# (Debianoid specific)
root_sudoers_group: sudo

View File

@@ -0,0 +1,15 @@
---
- name: Install sudo on debian
apt:
name: sudo
update_cache: yes
- name: configure sudo to allow root access for {{root_sudoers_group}} members
template:
dest: '/etc/sudoers.d/allow-sudoing'
src: 'sudoers.d/allow-sudoing.j2'
owner: root
group: root
mode: 0440
backup: no

View File

@@ -0,0 +1,2 @@
## Allows people in this group to run all commands
%{{ root_sudoers_group }} ALL=(ALL) ALL

View File

@@ -0,0 +1,4 @@
---
# A list of ports to allow incomming connections on
ufw_allow_in: [22]

30
roles/ufw/tasks/main.yml Normal file
View File

@@ -0,0 +1,30 @@
---
- name: install base packages
apt:
name: ufw
state: present
update_cache: true
- name: deny all incoming traffic
ufw:
policy: deny
direction: incoming
- name: allow all outgoing traffic
ufw:
policy: allow
direction: outgoing
- name: incoming rules
ufw:
rule: allow
direction: in
to_port: "{{ item.port if 'port' in item else item }}"
proto: "{{ item.proto if 'proto' in item else 'tcp' }}"
loop: "{{ ufw_allow }}"
- name: enable ufw
ufw:
state: enabled

View File

@@ -1,30 +0,0 @@
---
- name: social.coop | server
hosts: all
become: yes
vars_files:
- secrets.vars.yml
vars:
s3_access_key_id: "{{lookup('passwordstore', 'deployment/backupninja/s3access')}}"
s3_secret_access_key: "{{lookup('passwordstore', 'deployment/backupninja/s3sec')}}"
roles:
- role: server
- role: social-coop
- role: logcheck-custom
tags: logcheck-custom
# Installs a script to dump the mastodon-live PgSQL database, and
# copy the GPG encrypted archive to our S3 space with rclone. This
# is invoked daily using a systemd timer. Encryption is done with
# the public key in the password store
# deployment/backupninja/pub. To decrypt, you need to use the
# associated private key
- role: pg-dump-to-s3
tags: pg-dump-to-s3
pg_dump_to_s3_systemd_timer_section: OnCalendar=00:40:00
pg_dump_to_s3_desturl: "spaces:social-coop-media/backups/{{inventory_hostname_short}}/"
pg_dump_to_s3_pgdump_opts: -h localhost -U root -d mastodon-live -Fc
pg_dump_to_s3_pubkey: "{{lookup('passwordstore', 'deployment/backupninja/pub returnall=true')}}"
pg_dump_to_s3_rclone_config: "{{lookup('template', 'templates/rclone-conf.j2')}}"

144
snackpot.yml Normal file
View File

@@ -0,0 +1,144 @@
---
- name: snackpot | server
hosts: all
vars:
nextcloud_db_password: "{{lookup('passwordstore', 'servers/snackpot/nextcloud_db.password')}}"
postgres_password: "{{lookup('passwordstore', 'servers/snackpot/postgres_db.password')}}"
postgres_db_user: postgres
nextcloud_hostname: nc.noodlefactory.co.uk
nextcloud_db_user: nextcloud
nextcloud_db: nextcloud
jellyfin_hostname: jf.noodlefactory.co.uk
letsencrypt_email: webmaster@noodlefactory.co.uk
docker_compose_base_dir: /opt/docker-compose
firewall_ports:
- "22"
- "80"
- "443"
# jellyfin
- "8096"
#- "8920" https
- "7359"
# minidlna
- "8200"
# upmpdcli
- port: "49152"
# upnp (jellyfin, minidlna and upmpdcli)
- proto: udp
port: "1900"
# mopidy
- "6600"
- "6680"
- "5555"
# icecast
- "8000"
# terraria
- "7777"
- "7778"
- "7779"
tasks:
- hostname:
name: "{{ nextcloud_hostname }}"
tags: network
- name: install packages
apt:
update_cache: true
name:
- emacs
- strace
- nmap
- git
- include_role:
name: root_sudoers
apply: { tags: root_sudoers }
tags: root_sudoers
- include_role:
name: ufw
apply: { tags: ufw }
tags: ufw
vars:
ufw_allow: "{{ firewall_ports }}"
# - include_role:
# name: mrlesmithjr.netplan
# apply: { become: true, tags: [netplan, network] }
# tags: netplan, network
# vars:
# netplan_enabled: true
# netplan_configuration:
# network:
# version: 2
# ethernets:
# enp3s0:
# addresses: [192.168.0.55/24]
# gateway4: 192.168.0.1
# nameservers:
# addresses: [192.168.0.1]
- include_role:
name: docker_compose
apply: { tags: docker_compose }
tags: docker_compose
vars:
docker_compose_version: 1.27.4
- name: ensure directory exists
file:
path: "{{ docker_compose_base_dir }}/{{ item.path }}"
state: directory
with_filetree: templates/docker-compose
when: item.state == "directory" and item.path.count("/.") == 0
tags: docker-config
- name: deploy docker compose templates
template:
dest: "{{ docker_compose_base_dir }}/{{ item.path | splitext | first }}"
src: "docker-compose/{{ item.path }}"
owner: root
group: root
mode: 0660
backup: yes
notify: restart docker compose services
with_filetree: templates/docker-compose
when: item.state == "file" and item.path.endswith(".j2")
tags: docker-config
- name: deploy docker compose files
copy:
dest: "{{ docker_compose_base_dir }}/{{ item.path }}"
src: "templates/docker-compose/{{ item.path }}"
owner: root
group: root
mode: 0660
backup: yes
notify: restart docker compose services
with_filetree: templates/docker-compose
when: |-
item.state == "file" and not (
item.path.endswith("~") or item.path.endswith(".j2")
or item.path.count("/.") > 0
)
tags: docker-config
- name: ensure directory exists
file:
path: "{{ docker_compose_base_dir }}/bin"
state: directory
tags: docker-config
- name: install executables
template:
dest: "{{ docker_compose_base_dir }}/bin/{{ item.path }}"
src: "bin/{{ item.path }}"
owner: root
group: root
mode: 0550
with_filetree: templates/bin
when: item.state == "file" and not item.path.endswith("~")
tags: docker-config
# config nextcloud
# hide pg password

106
templates/bin/ncadmin Executable file
View File

@@ -0,0 +1,106 @@
#!/bin/sh
dc_dir={{ docker_compose_base_dir }}
nextcloud_base_dir={{ nextcloud_base_dir }}
nextcloud_data_dir={{ nextcloud_data_dir }}
postgres_db_user={{ postgres_db_user }}
nextcloud_db_user={{ nextcloud_db_user }}
nextcloud_db={{ nextcloud_db }}
DOCKER_EXE() {
( cd $dc_dir; docker-compose exec "$@" )
}
ON_POSTGRES() {
DOCKER_EXE -T -u postgres postgres "$@"
}
ON_POSTGRESi() {
DOCKER_EXE -u postgres postgres "$@"
}
ON_NEXTCLOUD() {
DOCKER_EXE -T -u www-data nextcloud "$@"
}
ON_NEXTCLOUDi() {
DOCKER_EXE -u www-data nextcloud "$@"
}
PSQL() {
ON_POSTGRES /usr/local/bin/psql "$@"
}
PGDUMP() {
ON_POSTGRES /usr/local/bin/pg_dump "$@"
}
PSQLi() {
ON_POSTGRESi /usr/local/bin/psql "$@"
}
PHP() {
ON_NEXTCLOUD /usr/local/bin/php "$@"
}
TEE() {
ON_NEXTCLOUD /usr/bin/tee "$1"
}
CAT() {
ON_NEXTCLOUD /bin/cat "$1"
}
DUMP() {
ON_NEXTCLOUD /bin/sh -c "for d in $*; do /usr/bin/tar -C \$d -c . ; done"
}
UNDUMP() {
ON_NEXTCLOUD /bin/sh -c "for d in $*; do /usr/bin/tar -C \$d -x ; done"
}
_gen_config() {
local config=$nextcloud_base_dir/config/config.php
script=$( cat <<EOF )
require("$config");
\$CONFIG["password"] = "password";
// FIXME more here
file_put_contents("$config.2", "<?php\\n\\\$CONFIG = ". var_export(\$CONFIG, true) .";\\n");
EOF
PHP -r "$script"
}
unpack_db() {
tar t >/dev/null && tar t >/dev/null && cat
}
# FIXME override selected config settings
restore() {
( UNDUMP $nextcloud_base_dir $nextcloud_data_dir
#FIXME [ -n "$config" ] && gen_config <<<'$config' | WRITE $nextcloud_base_dir/config/config.php
PSQL -U $postgres_db_user < $dc_dir/postgres/init.sql
cat | PSQL -U $postgres_db_user -d $nextcloud_db )
}
backup() {
( DUMP $nextcloud_base_dir $nextcloud_data_dir
PGDUMP -U $postgres_db_user $nextcloud_db )
}
prune() {
docker system prune -a --volumes
}
OCC() {
ON_NEXTCLOUD ./occ "$@"
}
NSH() {
ON_NEXTCLOUDi sh "$@"
}
set -vx
set -e
"$@"

View File

@@ -0,0 +1,257 @@
---
# Adapted from:
# https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/postgres/fpm/docker-compose.yml
version: '3'
volumes:
postgres:
nextcloud_src:
nextcloud_data:
certs:
vhost.d:
html:
redis:
jellyfin_config:
jellyfin_cache:
minidlna_state:
minidlna_data:
mopidy_data:
networks:
# This is for proxied containers
proxy-tier:
# This is for containers which need to be host mode
lan:
name: lan
driver: macvlan
driver_opts:
parent: enp3s0 # our ethernet interface
ipam:
config:
- gateway: 192.168.0.1
subnet: 192.168.0.0/24
ip_range: 192.168.0.240/29 # addresses 240-248 (6 usable)
services:
postgres:
build: ./postgres
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
volumes:
- postgres:/var/lib/postgresql/data
env_file:
- postgres.env
redis:
restart: always
image: redis:6-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
volumes:
- redis:/data
nextcloud:
image: nextcloud:22-fpm-alpine
restart: always
volumes:
- nextcloud_src:/var/www/html
- nextcloud_data:/var/www/data
- minidlna_data:/var/www/ext/media
- /srv:/srv
links:
- postgres
- redis
env_file:
- nextcloud.env
environment:
- POSTGRES_HOST=postgres
- REDIS_HOST=redis
- POSTGRES_USER=nextcloud
# healthcheck:
# test: ["CMD-SHELL", "wget -q --spider --proxy=off localhost:3000/health || exit 1"]
nextcloud_cron:
image: nextcloud:22-fpm-alpine
restart: always
volumes:
- nextcloud_src:/var/www/html
- nextcloud_data:/var/www/data
entrypoint: /cron.sh
depends_on:
- postgres
- redis
web:
build: ./web
restart: always
volumes:
- nextcloud_src:/var/www/html:ro
env_file:
- web.env
depends_on:
- nextcloud
networks:
- proxy-tier
- default
proxy:
build: ./proxy
restart: always
ports:
- "80:80"
- "443:443"
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
volumes:
- certs:/etc/nginx/certs:ro
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- proxy-tier
letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.13.1
restart: always
volumes:
- certs:/etc/nginx/certs
- vhost.d:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- proxy-tier
depends_on:
- proxy
env_file:
- letsencrypt-companion.env
jellyfin:
image: jellyfin/jellyfin:latest
restart: always
user: daemon:daemon
volumes:
- jellyfin_config:/config
- jellyfin_cache:/cache
- minidlna_data:/media
networks:
proxy-tier:
default:
lan: # Static ip for the container on the macvlan net
ipv4_address: 192.168.0.241
env_file:
- jellyfin.env
minidlna:
image: vladgh/minidlna:latest
restart: always
volumes:
- minidlna_state:/minidlna
- minidlna_data:/media:ro
networks:
default:
lan: # Static ip for the container on the macvlan net
ipv4_address: 192.168.0.242
environment:
- UPID=2000
- UGID=2000
- MINIDLNA_INOTIFY=yes
- MINIDLNA_MEDIA_DIR_1=A,/media/audio
- MINIDLNA_MEDIA_DIR_2=V,/media/video
- MINIDLNA_FRIENDLY_NAME=Snackpot
mopidy:
build: ./mopidy
ports:
- "6600:6600"
- "6680:6680"
- "8000:8000"
extra_hosts:
- "snackpot:host-gateway"
volumes:
# Makes mopidy data persistent
- mopidy_data:/data
# Add local music folder
- minidlna_data:/music:ro
networks:
default:
devices:
- /dev/snd
restart: always
upmpdcli:
build: ./upmpdcli
depends_on:
- mopidy
networks:
default:
lan: # Static ip for the container on the macvlan net
ipv4_address: 192.168.0.243
restart: always
# Next three services adapted from
# https://github.com/deisi/audiostation/blob/master/docker-compose.yml
# and https://github.com/IVData/dockerfiles/blob/master/mopidy-multiroom/docker-compose.yml
# snapserver:
# image: ivdata/snapserver:latest
# # ports:
# # - "1704:1704"
# # - "1705:1705"
# # - "1780:1780"
# volumes:
# # The volume with the sharesound fifo for snapcast to work
# - fifo:/tmp/snapcast
# # command: "snapserver -s pipe:///tmp/sharesound/snapfifo?name=Radio"
# # host mode is needed for snapserver advertisement
# network_mode: host
# restart: unless-stopped
# snapclient:
# image: ivdata/snapclient:latest
# # ports:
# # - "1704:1704"
# # - "1705:1705"
# # - "1780:1780"
# devices:
# - /dev/snd
# volumes:
# # The volume with the sharesound fifo for snapcast to work
# - fifo:/tmp/snapcast
# # command: "snapserver -s pipe:///tmp/sharesound/snapfifo?name=Radio"
# # host mode is needed for snapserver advertisement
# network_mode: host
# restart: unless-stopped
# environment:
# - HOST=127.0.0.1
# mopidy:
# image: ivdata/mopidy:latest
# ports:
# - "6600:6600"
# - "6680:6680"
# - "5555:5555"
# depends_on:
# - snapserver
# volumes:
# # The volume with the fifo for snapcast to work with
# - fifo:/tmp/snapcast
# # Makes mopidy data persistent
# - mopidy_data:/mopidy
# # Add local music folder
# - minidlna_data:/media/music:ro
# restart: unless-stopped
# spotify:
# image: audiostation/spotify:latest
# # host mode is needed for Spotifyd advertisement
# network_mode: host
# depends_on:
# - snapserver
# volumes:
# # The volume with the sharesound fifo for snapcast to work
# - /tmp/sharesound:/tmp/sharesound
# restart: unless-stopped

View File

@@ -0,0 +1,4 @@
VIRTUAL_HOST={{ jellyfin_hostname }}
JELLYFIN_PublishedServerUrl=https://{{ jellyfin_hostname }}/
LETSENCRYPT_HOST={{ jellyfin_hostname }}
LETSENCRYPT_EMAIL={{ letsencrypt_email }}

View File

@@ -0,0 +1 @@
DEFAULT_EMAIL={{ letsencrypt_email }}

View File

@@ -0,0 +1 @@
POSTGRES_PASSWORD={{ nextcloud_db_password }}

View File

@@ -0,0 +1 @@
POSTGRES_PASSWORD={{ postgres_password }}

View File

@@ -0,0 +1,2 @@
FROM postgres:11.9-alpine
COPY --chown={{ postgres_db_user }}:{{ postgres_db_user }} init.sql /docker-entrypoint-initdb.d/

View File

@@ -0,0 +1,6 @@
CREATE USER {{ nextcloud_db_user }};
ALTER USER {{ nextcloud_db_user }} WITH ENCRYPTED PASSWORD 'md5{{ (nextcloud_db_password + nextcloud_db_user) | hash("md5") }}';
DROP DATABASE IF EXISTS {{ nextcloud_db }};
CREATE DATABASE {{ nextcloud_db }} TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE {{ nextcloud_db }} OWNER TO {{ nextcloud_db_user }};
GRANT ALL PRIVILEGES ON DATABASE {{ nextcloud_db }} TO {{ nextcloud_db_user }};

View File

@@ -0,0 +1,3 @@
FROM jwilder/nginx-proxy:alpine-0.7.0
COPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf

View File

@@ -0,0 +1,2 @@
client_max_body_size 10G;
proxy_request_buffering off;

View File

@@ -0,0 +1,18 @@
FROM alpine:3.15
RUN apk update \
&& apk upgrade \
&& apk add --no-cache \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
python3 \
openssl \
upmpdcli
COPY upmpdcli.conf /etc/upmpdcli.conf
#RUN adduser -S upmpdcli
EXPOSE 1900/udp
EXPOSE 49152
ENTRYPOINT ["upmpdcli", "-c", "/etc/upmpdcli.conf"]

View File

@@ -0,0 +1,29 @@
# upmpdcli general parameters
#logfilename = /var/log/upmpdcli.log
# loglevel = 0
#pkgdatadir=/usr/share/upmpdcli
#pidfile = /var/run/upmpdcli.pid
# upnp network parameters
#upnpiface =
#upnpip =
# upnpport =
upnpip = 192.168.0.243
# media renderer parameters
friendlyname = Snackpot
#upnpav = 1
#openhome = 1
#lumincompat = 0
#saveohcredentials = 1
checkcontentformat = 0
#iconpath = /usr/share/upmpdcli/icon.png
#cachedir = /var/cache/upmpdcli
#presentationhtml = /usr/share/upmpdcli/presentation.html
# mpd parameters
#mpdhost = 127.0.0.1
#mpdport = 6600
#mpdpassword =
#ownqueue = 1
mpdhost = mopidy

View File

@@ -0,0 +1,3 @@
VIRTUAL_HOST={{ nextcloud_hostname }}
LETSENCRYPT_HOST={{ nextcloud_hostname }}
LETSENCRYPT_EMAIL={{ letsencrypt_email }}

View File

@@ -0,0 +1,3 @@
FROM nginx:1.19.6-alpine
COPY nginx.conf /etc/nginx/nginx.conf

View File

@@ -0,0 +1,173 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
set_real_ip_from 10.0.0.0/8;
set_real_ip_from 172.16.0.0/12;
set_real_ip_from 192.168.0.0/16;
real_ip_header X-Real-IP;
#gzip on;
upstream php-handler {
server nextcloud:9000;
}
server {
listen 80;
# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this
# topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /var/www/html;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
# The following rule is only needed for the Social app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
location = /.well-known/carddav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host:$server_port/remote.php/dav;
}
# set max upload size
client_max_body_size 10G;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
location / {
rewrite ^ /index.php;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
# fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Enable pretty urls
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js, css and map files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into
# this topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
}