Added naruto host and gitea to docker

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
pull/1/head
TuDatTr 2023-10-10 11:34:02 +02:00
parent 582aa5e235
commit 860b1a6be4
21 changed files with 172 additions and 62 deletions

View File

@ -17,34 +17,36 @@ usermod -a -G sudo tudattr
Backup for aya01 and raspberry are in a backblaze b2, which gets encrypted on the clientside by rclone. Backup for aya01 and raspberry are in a backblaze b2, which gets encrypted on the clientside by rclone.
but first of all we need to create the buckets and provide ansible with the needed information. but first of all we need to create the buckets and provide ansible with the needed information.
When creating your own rclone config the `password` and `password2` entries have to be passed though `rclone obscure` like this: First we need to create a api key for backblaze, consists of an id and a key.
we use clone to sync to backblaze.
we can encrypt the data with rclone before sending it to backblaze.
to do this we need two buckets:
- b2
- crypt
on each device that should be backupped.
``` sh we create these by running `rclone config` and creating one [remote] b2 config and a [secret] crypt config. The crypt config should have two passwords that we store in our secrets file.
echo "$PASSWORD" | rclone obscure -
```
` `
## Vault ## Vault
- Create vault with: `ansible-vault create secrets.yml` - Create vault with: `ansible-vault create secrets.yml`
- Create entry in vault with: `ansible-vault edit secrets.yml` - Create entry in vault with: `ansible-vault edit secrets.yml`
- Add following entries: - Add following entries: TODO
- `vault_pi_tudattr_password: <YOURPASSWORD>` (password you've setup on the device)
- `vault_aya01_tudattr_password: <YOURPASSWORD>` (password you've setup on the device)
- `vault_pihole_password: <YOURPASSWORD>` (arbitrary password you want to log in with)
- `vault_mysql_root_password: <YOURPASSWORD>` (arbitrary password, used internally)
- `vault_mysql_user_password: <YOURPASSWORD>` (arbitrary password, used internally)
- `vault_ddns_tudattrdev_password: <YOURPASSWORD>` (password needed for ddns, refer to [here](https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-do-i-enable-dynamic-dns-for-a-domain/))
- `vault_ddns_borgland_password: <YOURPASSWORD>` (password needed for ddns, refer to [here](https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-do-i-enable-dynamic-dns-for-a-domain/))
## Docker ## Docker
To add new docker containers to the docker role you need to add the following and replace `service` with the name of your service: To add new docker containers to the docker role you need to add the following and replace `service` with the name of your service:
- Add relevent vars to `group_vars/all/vars.yaml`: - Add relevent vars to `group_vars/all/vars.yaml`:
```yaml ```yaml
service_port: "19999" # Exposed port service:
service_config: "{{ docker_dir }}/service/" # config folder or your dir host: "service"
service_data: "{{ docker_data_dir }}/service/" # data folder or your dir (only works on aya01) ports:
http: "19999"
volumes:
config: "{{ docker_dir }}/service/" # config folder or your dir
data: "{{ docker_data_dir }}/service/" # data folder or your dir (only works on aya01)
``` ```
- Create necessary directories for service in the docker role `roles/docker/tasks/service.yaml` - Create necessary directories for service in the docker role `roles/docker/tasks/service.yaml`
```yaml ```yaml
- name: Create service dirs - name: Create service dirs
@ -52,11 +54,11 @@ service_data: "{{ docker_data_dir }}/service/" # data folder or your dir (only w
path: "{{ item }}" path: "{{ item }}"
owner: 1000 owner: 1000
group: 1000 group: 1000
mode: '777' mode: '775'
state: directory state: directory
loop: loop:
- "{{ service_config }}" - "{{ service.volumes.config }}"
- "{{ service_data }}" - "{{ service.volumes.data }}"
# optional: # optional:
# - name: Place service config # - name: Place service config
@ -90,8 +92,6 @@ service_data: "{{ docker_data_dir }}/service/" # data folder or your dir (only w
- "{{service_lib}}:/var/lib/service" - "{{service_lib}}:/var/lib/service"
- "{{service_cache}}:/var/cache/service" - "{{service_cache}}:/var/cache/service"
``` ```
### Qbittorrent/Openvpn
You'll need to add a openvpn config to =./roles/docker/templates/aya01/qbittorrentvpn/config/=
## Server ## Server
- Install Debian (debian-11.5.0-amd64-netinst.iso) on remote system - Install Debian (debian-11.5.0-amd64-netinst.iso) on remote system

View File

@ -509,9 +509,15 @@ homarr:
gitea: gitea:
host: "git" host: "git"
url: "https://git.tudattr.dev"
volumes: volumes:
data: "{{ docker_data_dir }}/gitea/data" data: "{{ docker_data_dir }}/gitea/data"
config: "{{ docker_dir }}/gitea/config" config: "{{ docker_dir }}/gitea/config"
ports: ports:
http: "3000" http: "3000"
ssh: "2222" ssh: "2222"
runner:
host: "gitea-runner-{{ host.hostname }}"
token: "{{ host.gitea.runner.token }}"
volumes:
data: "{{ docker_data_dir }}/gitea/runner/data/"

View File

@ -47,3 +47,6 @@ host:
paperless: paperless:
db: db:
password: "{{ vault.aya01.paperless.db.password }}" password: "{{ vault.aya01.paperless.db.password }}"
gitea:
runner:
token: "{{ vault.aya01.gitea.runner.token }}"

View File

@ -5,6 +5,7 @@ ansible_ssh_private_key_file: '{{ pk_path }}'
ansible_become_pass: '{{ vault.mii.sudo }}' ansible_become_pass: '{{ vault.mii.sudo }}'
host: host:
hostname: "mii"
ip: "192.168.200.2" ip: "192.168.200.2"
backblaze: backblaze:
account: "{{ vault.mii.backblaze.account }}" account: "{{ vault.mii.backblaze.account }}"

View File

@ -5,17 +5,19 @@ ansible_ssh_private_key_file: '{{ pk_path }}'
ansible_become_pass: '{{ vault.naruto.sudo }}' ansible_become_pass: '{{ vault.naruto.sudo }}'
host: host:
hostname: "naruto"
ip: "{{ ansible_host }}" ip: "{{ ansible_host }}"
backblaze: backblaze:
account: "{{ vault.naruto.backblaze.account }}" account: "{{ vault.naruto.backblaze.account }}"
key: "{{ vault.naruto.backblaze.key }}" key: "{{ vault.naruto.backblaze.key }}"
remote: "remote:naruto-tudattr-dev" remote: "remote:naruto-tudattr-dev"
# password: "{{}}" password: "{{ vault.naruto.rclone.password }}"
# password2: "{{}}" password2: "{{ vault.naruto.rclone.password2 }}"
# paths: paths:
# - "{{}}" - "{{ docker_compose_dir }}"
# - "{{}}" - "{{ docker_dir }}"
fstab: fstab:
mergerfs: mergerfs:
samba: gitea:
password: "{{ vault.aya01.samba.password }}" runner:
token: "{{ vault.naruto.gitea.runner.token }}"

View File

@ -5,6 +5,7 @@ ansible_ssh_private_key_file: '{{ pk_path }}'
ansible_become_pass: '{{ vault.pi.sudo }}' ansible_become_pass: '{{ vault.pi.sudo }}'
host: host:
hostname: "pi"
ip: "{{ ansible_host }}" ip: "{{ ansible_host }}"
backblaze: backblaze:
account: "{{ vault.pi.backblaze.account }}" account: "{{ vault.pi.backblaze.account }}"
@ -17,3 +18,6 @@ host:
- "{{ docker_dir }}" - "{{ docker_dir }}"
fstab: fstab:
mergerfs: mergerfs:
gitea:
runner:
token: "{{ vault.pi.gitea.runner.token }}"

View File

@ -1,17 +0,0 @@
---
- name: Set up Servers
hosts: nas
gather_facts: yes
roles:
- role: common
tags:
- common
- role: samba
tags:
- samba
- role: node_exporter
tags:
- node_exporter
- role: smart_exporter
tags:
- smart_exporter

View File

@ -3,9 +3,7 @@ aya01
[raspberry] [raspberry]
pi pi
naruto
[vps] [vps]
mii mii
[nas]
naruto

View File

@ -5,9 +5,15 @@
state: stopped state: stopped
become: true become: true
# - name: Backing up for "{{ inventory_hostname }}"
# shell:
# cmd: "rclone sync {{ item }} secret:{{ item }} --transfers 16"
# loop: "{{ host.backblaze.paths }}"
# become: true
- name: Backing up for "{{ inventory_hostname }}" - name: Backing up for "{{ inventory_hostname }}"
shell: shell:
cmd: "rclone sync {{ item }} secret:{{ item }} --transfers 16" cmd: "rclone sync {{ item }} secret:{{ item }} -L"
loop: "{{ host.backblaze.paths }}" loop: "{{ host.backblaze.paths }}"
become: true become: true

View File

@ -90,3 +90,8 @@
- include_tasks: gitea.yml - include_tasks: gitea.yml
tags: tags:
- gitea - gitea
- include_tasks: gitea-runner.yml
tags:
- gitea-runner

View File

@ -10,7 +10,7 @@
- name: Copy ddns-config - name: Copy ddns-config
template: template:
owner: 1000 owner: 1000
src: "templates/pi/ddns-updater/data/config.json" src: "templates/{{host.hostname}}/ddns-updater/data/config.json"
dest: "{{ docker_dir }}/ddns-updater/data/config.json" dest: "{{ docker_dir }}/ddns-updater/data/config.json"
mode: '400' mode: '400'

View File

@ -0,0 +1,11 @@
---
- name: Create gitea-runner directories
file:
path: "{{ item }}"
owner: "{{ puid }}"
group: "{{ pgid }}"
mode: '755'
state: directory
become: yes
loop:
- "{{ gitea.runner.volumes.data }}"

View File

@ -1,4 +1,4 @@
---
- name: Create gitea directories - name: Create gitea directories
file: file:
path: "{{ item }}" path: "{{ item }}"

View File

@ -0,0 +1,11 @@
---
- name: Create gitlab-runner directories
file:
path: "{{ item }}"
owner: "{{ puid }}"
group: "{{ pgid }}"
mode: '755'
state: directory
become: yes
loop:
- "{{ gitlab.runner.volumes.config }}"

View File

@ -0,0 +1,13 @@
---
- include_tasks: nginx-proxy-manager.yml
tags:
- nginx
- include_tasks: pihole.yml
tags:
- pihole
- include_tasks: gitea-runner.yml
tags:
- gitea-runner

View File

@ -7,3 +7,8 @@
- include_tasks: pihole.yml - include_tasks: pihole.yml
tags: tags:
- pihole - pihole
- include_tasks: gitea-runner.yml
tags:
- gitea-runner

View File

@ -93,6 +93,8 @@ services:
- PUID={{puid}} - PUID={{puid}}
- PGID={{pgid}} - PGID={{pgid}}
- TZ={{timezone}} - TZ={{timezone}}
ports:
- "{{kuma_port}}:3001"
volumes: volumes:
- "{{ kuma_config }}:/app/data" - "{{ kuma_config }}:/app/data"
@ -221,6 +223,8 @@ services:
- PUID={{ puid }} - PUID={{ puid }}
- PGID={{ pgid}} - PGID={{ pgid}}
- TZ={{ timezone }} - TZ={{ timezone }}
ports:
- "{{ tautulli_port }}:8181"
volumes: volumes:
- {{ tautulli_config}}:/config - {{ tautulli_config}}:/config
@ -463,6 +467,21 @@ services:
- "{{ gitea.ports.http }}:3000" - "{{ gitea.ports.http }}:3000"
- "{{ gitea.ports.ssh }}:2222" - "{{ gitea.ports.ssh }}:2222"
{{ gitea.runner.host }}:
container_name: {{ gitea.runner.host }}
image: gitea/act_runner:nightly
restart: unless-stopped
depends_on:
- {{ gitea.host }}
networks:
- net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- "GITEA_INSTANCE_URL={{ gitea.url }}"
- "GITEA_RUNNER_REGISTRATION_TOKEN={{ gitea.runner.token }}"
networks: networks:
zoneminder: zoneminder:
driver: bridge driver: bridge

View File

@ -43,4 +43,3 @@ scrape_configs:
- job_name: 'SMART' - job_name: 'SMART'
static_configs: static_configs:
- targets: ['{{ aya01_ip }}:{{smart_exporter.port}}'] - targets: ['{{ aya01_ip }}:{{smart_exporter.port}}']
- targets: ['{{ naruto_ip }}:{{smart_exporter.port}}']

View File

@ -0,0 +1,40 @@
version: '3'
services:
nginx:
container_name: "{{nginx.host}}"
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
networks:
net: {}
ports:
- '{{nginx.endpoints.http}}:80'
- '{{nginx.endpoints.https}}:443'
- '{{nginx.endpoints.admin}}:81'
volumes:
- "{{nginx.paths.data}}:/data"
- "{{nginx.paths.letsencrypt}}:/etc/letsencrypt"
- '/var/run/docker.sock:/var/run/docker.sock'
{{ gitea.runner.host }}:
container_name: {{ gitea.runner.host }}
image: gitea/act_runner:nightly
restart: unless-stopped
depends_on:
- nginx
networks:
- net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- {{ gitea.runner.volumes.data }}:/data
environment:
- "GITEA_INSTANCE_URL={{ gitea.url }}"
- "GITEA_RUNNER_REGISTRATION_TOKEN={{ gitea.runner.token }}"
networks:
net:
driver: bridge
ipam:
# driver: default
config:
- subnet: 172.16.69.0/24
gateway: 172.16.69.1

View File

@ -43,6 +43,21 @@ services:
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
{{ gitea.runner.host }}:
container_name: {{ gitea.runner.host }}
image: gitea/act_runner:nightly
restart: unless-stopped
depends_on:
- nginx
networks:
- net
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- {{ gitea.runner.volumes.data }}:/data
environment:
- "GITEA_INSTANCE_URL={{ gitea.url }}"
- "GITEA_RUNNER_REGISTRATION_TOKEN={{ gitea.runner.token }}"
networks: networks:
net: net:
driver: bridge driver: bridge

View File

@ -1,11 +0,0 @@
{
"settings": [
{
"provider": "namecheap",
"domain": "{{ local_domain }}",
"host": "{{ local_subdomains }}",
"password": "{{ vault_ddns_borgland_password }}",
"provider_ip": true
}
]
}