forked from notthebee/infra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
190 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
dashboard_url: "https://{{ subdomains['piped'] }}.{{ host }}" | ||
|
||
container_name: piped | ||
|
||
frontend_url: "{{ subdomains['piped'] }}.{{ host }}" | ||
|
||
proxy_url: "{{ subdomains['piped-proxy'] }}.{{ host }}" | ||
|
||
api_url: "{{ subdomains['piped-api'] }}.{{ host }}" | ||
|
||
homer_category: services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
- name: Clone the piped-docker repository | ||
git: | ||
clone: yes | ||
repo: https://github.com/TeamPiped/Piped-Docker | ||
dest: "{{ docker_dir }}/{{ container_name }}" | ||
ignore_errors: yes | ||
|
||
- name: Populate the frontend variable in the configure-instance.sh file | ||
lineinfile: | ||
search_string: "read frontend" | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
line: "frontend={{ frontend_url }}" | ||
state: present | ||
|
||
- name: Populate the backend variable in the configure-instance.sh file | ||
lineinfile: | ||
search_string: "read backend" | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
line: "backend={{ api_url }}" | ||
state: present | ||
|
||
- name: Populate the proxy variable in the configure-instance.sh file | ||
lineinfile: | ||
search_string: "read proxy" | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
line: "proxy={{ proxy_url }}" | ||
state: present | ||
|
||
- name: Populate the reverseproxy variable in the configure-instance.sh file | ||
lineinfile: | ||
search_string: "read reverseproxy" | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
line: "reverseproxy=nginx" | ||
state: present | ||
|
||
- name: Fix the 'sed' command in the configure-instance.sh file | ||
lineinfile: | ||
regexp: "sed.*" | ||
state: absent | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
|
||
- name: Fix the 'sed' command in the configure-instance.sh file | ||
lineinfile: | ||
line: "{{ item }}" | ||
state: present | ||
insertafter: "cp -r template/ config/" | ||
path: "{{ docker_dir }}/{{ container_name }}/configure-instance.sh" | ||
with_items: | ||
- sed -i "s|FRONTEND_HOSTNAME|$frontend|g" config/* | ||
- sed -i "s|BACKEND_HOSTNAME|$backend|g" config/* | ||
- sed -i "s|PROXY_HOSTNAME|$proxy|g" config/* | ||
|
||
- name: Change the default PostgreSQL password | ||
replace: | ||
path: "{{ item }}" | ||
regexp: "changeme" | ||
replace: "{{ piped_postgresql_password }}" | ||
with_items: | ||
- "{{ docker_dir }}/{{ container_name }}/template/config.properties" | ||
- "{{ docker_dir }}/{{ container_name }}/template/docker-compose.nginx.yml" | ||
- "{{ docker_dir }}/{{ container_name }}/template/docker-compose.caddy.yml" | ||
|
||
- name: Run the configure-instance.sh script | ||
shell: | ||
cmd: "cd {{docker_dir }}/{{ container_name }} && bash configure-instance.sh" | ||
|
||
- name: Add "version" parameter to the docker-compose file | ||
lineinfile: | ||
line: "version: '3'" | ||
state: present | ||
insertbefore: BOF | ||
path: "{{ docker_dir }}/{{ container_name }}/docker-compose.yml" | ||
|
||
|
||
- name: Run the docker-compose file | ||
shell: | ||
cmd: "cd {{docker_dir }}/{{ container_name }} && docker-compose up -d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dns_cloudflare_api_token = {{ cloudflare_token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
roles/containers/swag/templates/youtransfer.subdomain.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
|
||
server_name {{ swag_urls['youtransfer'] }}; | ||
|
||
{% include "common/params.j2" %} | ||
include /config/nginx/ssl.conf; | ||
|
||
client_max_body_size 128M; | ||
|
||
|
||
location / { | ||
{% include "common/cors.j2" %} | ||
auth_basic "Restricted"; | ||
auth_basic_user_file /config/nginx/.htpasswd; | ||
include /config/nginx/proxy.conf; | ||
include /config/nginx/resolver.conf; | ||
set $upstream_app youtransfer; | ||
set $upstream_port 5000; | ||
set $upstream_proto http; | ||
proxy_pass $upstream_proto://$upstream_app:$upstream_port; | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
container_name: youtransfer | ||
|
||
dashboard_name: YouTransfer | ||
|
||
dashboard_url: "https://{{ subdomains['youtransfer'] }}.{{ host }}" | ||
|
||
homer_category: services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
- name: Make sure the {{ container_name }} container is created and running | ||
docker_container: | ||
name: "{{ container_name }}" | ||
image: "remie/youtransfer:stable" | ||
pull: yes | ||
state: 'started' | ||
env: | ||
"PUID": "{{ guid }}" | ||
"PGID": "{{ guid }}" | ||
"TZ": "{{ timezone }}" | ||
volumes: | ||
- "{{ docker_dir }}/{{ container_name }}:/config" | ||
- "{{ mergerfs_root }}/Uploads:/uploads" | ||
restart_policy: unless-stopped | ||
|
||
- name: Schedule a cleanup for /opt/youtransfer | ||
cron: | ||
name: Cleanup /opt/youtransfer | ||
hour: "0" | ||
job: "docker exec {{ container_name }} rm -rf /opt/youtransfer/upload_*" | ||
|
||
- name: Add {{ container_name }} to the SWAG network (reverse-proxy) | ||
docker_network: | ||
name: swag_network | ||
connected: | ||
- "{{ container_name }}" | ||
appends: yes | ||
when: enable_swag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters