Compare commits
34 Commits
pico-forwa
...
whatsit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d39245ab9 | ||
|
|
74d8767b86 | ||
|
|
52d82a2b52 | ||
|
|
b28998d3d1 | ||
|
|
22f8ccd7fe | ||
|
|
31434f5cf3 | ||
|
|
89ba2714a9 | ||
|
|
00ca00bf05 | ||
|
|
206dc5341b | ||
|
|
b006b9c9d5 | ||
|
|
d54be6f1c5 | ||
|
|
4c9399fad9 | ||
|
|
bcb424515f | ||
|
|
65d69c7f58 | ||
|
|
5625a1d51a | ||
|
|
874d800b58 | ||
|
|
879da752b6 | ||
|
|
31f0d064ac | ||
|
|
704fbedbae | ||
|
|
f5026efcc7 | ||
|
|
da7a33310b | ||
|
|
be41a87087 | ||
|
|
358734d403 | ||
|
|
01ddd57da3 | ||
|
|
8fa9d4ceff | ||
|
|
88a633bb94 | ||
|
|
a10e2a6663 | ||
|
|
96727cf17b | ||
|
|
1b6c2aa19a | ||
|
|
d2bcfec810 | ||
|
|
8637cb2af4 | ||
|
|
40755cdd97 | ||
|
|
9a79fe8078 | ||
|
|
e23ba65b8f |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "templates/docker-compose/mopidy"]
|
||||||
|
path = templates/docker-compose/mopidy
|
||||||
|
url = git@github.com:Log1x/docker-mopidy-iris.git
|
||||||
@@ -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
|
|
||||||
|
|
||||||
23
roles/docker_compose/defaults/main.yml
Normal file
23
roles/docker_compose/defaults/main.yml
Normal 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
|
||||||
|
|
||||||
13
roles/docker_compose/handlers/main.yml
Normal file
13
roles/docker_compose/handlers/main.yml
Normal 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
|
||||||
@@ -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
|
||||||
5
roles/root_sudoers/defaults/main.yml
Normal file
5
roles/root_sudoers/defaults/main.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
# Enables a sudoer group
|
||||||
|
# (Debianoid specific)
|
||||||
|
|
||||||
|
root_sudoers_group: sudo
|
||||||
15
roles/root_sudoers/tasks/main.yml
Normal file
15
roles/root_sudoers/tasks/main.yml
Normal 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
|
||||||
|
|
||||||
2
roles/root_sudoers/templates/sudoers.d/allow-sudoing.j2
Normal file
2
roles/root_sudoers/templates/sudoers.d/allow-sudoing.j2
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
## Allows people in this group to run all commands
|
||||||
|
%{{ root_sudoers_group }} ALL=(ALL) ALL
|
||||||
4
roles/ufw/defaults/main.yml
Normal file
4
roles/ufw/defaults/main.yml
Normal 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
30
roles/ufw/tasks/main.yml
Normal 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
|
||||||
@@ -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')}}"
|
|
||||||
|
|
||||||
142
snackpot.yml
Normal file
142
snackpot.yml
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
---
|
||||||
|
- 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_base_dir: /var/www/html
|
||||||
|
nextcloud_data_dir: /var/www/data
|
||||||
|
nextcloud_ext_dir: /var/www/ext
|
||||||
|
nextcloud_db_user: nextcloud
|
||||||
|
nextcloud_db: nextcloud
|
||||||
|
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"
|
||||||
|
|
||||||
|
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
106
templates/bin/ncadmin
Executable 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
|
||||||
|
"$@"
|
||||||
|
|
||||||
234
templates/docker-compose/docker-compose.yml
Normal file
234
templates/docker-compose/docker-compose.yml
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
---
|
||||||
|
# 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:
|
||||||
|
proxy-tier:
|
||||||
|
|
||||||
|
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
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
- JELLYFIN_PublishedServerUrl=http://snackpot.local
|
||||||
|
|
||||||
|
minidlna:
|
||||||
|
image: vladgh/minidlna:latest
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- minidlna_state:/minidlna
|
||||||
|
- minidlna_data:/media:ro
|
||||||
|
network_mode: host
|
||||||
|
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
|
||||||
|
devices:
|
||||||
|
- /dev/snd
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
upmpdcli:
|
||||||
|
build: ./upmpdcli
|
||||||
|
depends_on:
|
||||||
|
- mopidy
|
||||||
|
# Host mode needed for advertisement
|
||||||
|
network_mode: host
|
||||||
|
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
|
||||||
|
|
||||||
1
templates/docker-compose/letsencrypt-companion.env.j2
Normal file
1
templates/docker-compose/letsencrypt-companion.env.j2
Normal file
@@ -0,0 +1 @@
|
|||||||
|
DEFAULT_EMAIL={{ letsencrypt_email }}
|
||||||
1
templates/docker-compose/mopidy
Submodule
1
templates/docker-compose/mopidy
Submodule
Submodule templates/docker-compose/mopidy added at 3aa890f6a9
1
templates/docker-compose/nextcloud.env.j2
Normal file
1
templates/docker-compose/nextcloud.env.j2
Normal file
@@ -0,0 +1 @@
|
|||||||
|
POSTGRES_PASSWORD={{ nextcloud_db_password }}
|
||||||
1
templates/docker-compose/postgres.env.j2
Normal file
1
templates/docker-compose/postgres.env.j2
Normal file
@@ -0,0 +1 @@
|
|||||||
|
POSTGRES_PASSWORD={{ postgres_password }}
|
||||||
2
templates/docker-compose/postgres/Dockerfile.j2
Normal file
2
templates/docker-compose/postgres/Dockerfile.j2
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
FROM postgres:11.9-alpine
|
||||||
|
COPY --chown={{ postgres_db_user }}:{{ postgres_db_user }} init.sql /docker-entrypoint-initdb.d/
|
||||||
6
templates/docker-compose/postgres/init.sql.j2
Normal file
6
templates/docker-compose/postgres/init.sql.j2
Normal 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 }};
|
||||||
3
templates/docker-compose/proxy/Dockerfile
Normal file
3
templates/docker-compose/proxy/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
FROM jwilder/nginx-proxy:alpine-0.7.0
|
||||||
|
|
||||||
|
COPY uploadsize.conf /etc/nginx/conf.d/uploadsize.conf
|
||||||
2
templates/docker-compose/proxy/uploadsize.conf
Normal file
2
templates/docker-compose/proxy/uploadsize.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
client_max_body_size 10G;
|
||||||
|
proxy_request_buffering off;
|
||||||
17
templates/docker-compose/upmpdcli/Dockerfile
Normal file
17
templates/docker-compose/upmpdcli/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
FROM alpine:3.13
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
&& apk upgrade \
|
||||||
|
&& apk add --no-cache \
|
||||||
|
--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"]
|
||||||
28
templates/docker-compose/upmpdcli/upmpdcli.conf
Normal file
28
templates/docker-compose/upmpdcli/upmpdcli.conf
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# 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 =
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
3
templates/docker-compose/web.env.j2
Normal file
3
templates/docker-compose/web.env.j2
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
VIRTUAL_HOST={{ nextcloud_hostname }}
|
||||||
|
LETSENCRYPT_HOST={{ nextcloud_hostname }}
|
||||||
|
LETSENCRYPT_EMAIL={{ letsencrypt_email }}
|
||||||
3
templates/docker-compose/web/Dockerfile
Normal file
3
templates/docker-compose/web/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
FROM nginx:1.19.6-alpine
|
||||||
|
|
||||||
|
COPY nginx.conf /etc/nginx/nginx.conf
|
||||||
173
templates/docker-compose/web/nginx.conf
Normal file
173
templates/docker-compose/web/nginx.conf
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user