Move to new VPS

This commit is contained in:
Perflyst 2022-06-05 12:20:34 +02:00
parent 67afb89ae6
commit 00214fca72
5 changed files with 187 additions and 0 deletions

79
dia.yml Normal file
View File

@ -0,0 +1,79 @@
---
- hosts: dia.invidious.io
handlers:
- name: restart ssh
systemd:
name: sshd
state: restarted
tasks:
- name: SSH config
template:
src: sshd_config.j2
dest: /etc/ssh/sshd_config
mode: 0644
notify: restart ssh
tags: [ssh, base]
- name: SSH keys
template:
src: authorized_keys.j2
dest: /root/.ssh/authorized_keys
mode: 0600
tags: [ssh, base]
- name: Install packages
apt:
name: "{{ apt_packages }}"
update_cache: true
tags: [apt, base]
- name: unattended-upgrades
import_role:
name: jnv.unattended-upgrades
tags: [unattended-upgrades]
- name: pip
import_role:
name: geerlingguy.pip
tags: [pip,docker]
- name: docker
import_role:
name: geerlingguy.docker
tags: [dockerd, docker]
- name: Deploy invidious api
import_tasks: tasks/compose.yml
vars:
app: instances-api
tags: [instances-api, api, docker]
- name: Deploy invidious redirect
import_tasks: tasks/compose.yml
vars:
app: redirect
tags: [redirect, docker]
- name: Deploy invidious website
import_tasks: tasks/compose.yml
vars:
app: invidious.io
tags: [website, docker]
- name: Deploy gitea
import_tasks: tasks/compose.yml
vars:
app: gitea
tags: [gitea, docker]
- name: Deploy docs
import_tasks: tasks/compose.yml
vars:
app: "docs.invidious.io"
tags: [docs, docker]
- name: caddy
import_role:
name: caddy_ansible.caddy_ansible
tags: [caddy]

View File

@ -0,0 +1,3 @@
---
docker_compose_version: "1.29.2"
caddy_config: "{{ lookup('template', 'templates/dia-Caddyfile.j2') }}"

View File

@ -5,3 +5,4 @@ all:
hosts:
invidious.io:
tin.invidious.io:
dia.invidious.io:

102
templates/dia-Caddyfile.j2 Normal file
View File

@ -0,0 +1,102 @@
# {{ ansible_managed }}
(common) {
encode gzip
log {
output file /var/log/caddy/access.log {
roll_size 500mb
roll_keep 5
}
format filter {
wrap json
fields {
common_log delete
request>remote_addr ip_mask {
ipv4 24
ipv6 32
}
}
}
}
}
(block-robots) {
respond /robots.txt 200 {
body "User-agent: *
Disallow: /
"
}
}
www.invidio.us {
import common
import block-robots
redir https://invidious.io{uri}
}
invidious.io {
import common
reverse_proxy http://127.0.0.1:8081
}
git.invidious.io {
import common
import block-robots
redir https://github.com/iv-org/invidious
}
gitea.invidious.io {
import common
import block-robots
reverse_proxy http://127.0.0.1:3200
}
invidio.us {
import common
import block-robots
redir https://redirect.invidious.io{uri}
header /api* content-type "application/json"
respond /api* "{\"error\":\"This server no longer hosts the Invidious API.\"}" 410
}
redirect.invidious.io {
import common
import block-robots
reverse_proxy http://127.0.0.1:8080
}
instances.invidio.us {
import common
import block-robots
redir https://api.invidious.io{uri}
}
api.invidious.io {
import common
import block-robots
reverse_proxy http://127.0.0.1:3000
header /static* Cache-Control "max-age=86400"
}
uptime.invidio.us {
import common
import block-robots
redir https://stats.uptimerobot.com/89VnzSKAn{uri}
}
uptime.invidious.io {
import common
import block-robots
redir https://stats.uptimerobot.com/89VnzSKAn{uri}
}
docs.invidious.io {
import common
reverse_proxy http://127.0.0.1:8082
}
instances.invidious.io {
import common
redir https://docs.invidious.io/instances/
}
todo.invidious.io {
import common
import block-robots
redir https://github.com/orgs/iv-org/projects
}

View File

@ -1,7 +1,9 @@
Protocol 2
Port {{ ansible_port }}
ListenAddress {{ ansible_default_ipv4.address }}
{% if ansible_default_ipv6.address is defined %}
ListenAddress {{ ansible_default_ipv6.address }}
{% endif %}
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key