Self host my website 🎉
This commit is contained in:
parent
92d33a0fa7
commit
d0c36adba8
5 changed files with 50 additions and 4 deletions
|
@ -0,0 +1,13 @@
|
||||||
|
version: "2.3"
|
||||||
|
services:
|
||||||
|
website:
|
||||||
|
image: docker.pkg.github.com/realorangeone/theorangeone.net/theorangeone.net:latest
|
||||||
|
container_name: theorangeone.net
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/London
|
||||||
|
restart: unless-stopped
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.website.rule=Host(`theorangeone.net`) || Host(`www.theorangeone.net`)"
|
||||||
|
- "traefik.http.routers.website.tls=true"
|
||||||
|
- "traefik.http.routers.website.tls.certresolver=le"
|
|
@ -4,4 +4,5 @@ services:
|
||||||
image: containrrr/watchtower:latest
|
image: containrrr/watchtower:latest
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
- "{{ home }}/.docker/config.json:/config.json:ro"
|
||||||
command: --cleanup --interval 300
|
command: --cleanup --interval 300
|
||||||
|
|
|
@ -69,3 +69,6 @@
|
||||||
|
|
||||||
- name: Install pihole
|
- name: Install pihole
|
||||||
include: pihole.yml
|
include: pihole.yml
|
||||||
|
|
||||||
|
- name: Install theorangeone.net
|
||||||
|
include: theorangeone.net.yml
|
||||||
|
|
29
ansible/roles/docker/tasks/theorangeone.net.yml
Normal file
29
ansible/roles/docker/tasks/theorangeone.net.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
- name: Create theorangeone.net directory
|
||||||
|
file:
|
||||||
|
path: /opt/theorangeone.net
|
||||||
|
state: directory
|
||||||
|
owner: "{{ docker_user.name }}"
|
||||||
|
mode: "{{ docker_compose_directory_mask }}"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Install theorangeone.net compose file
|
||||||
|
template:
|
||||||
|
src: files/theorangeone.net/docker-compose.yml
|
||||||
|
dest: /opt/theorangeone.net/docker-compose.yml
|
||||||
|
mode: "{{ docker_compose_file_mask }}"
|
||||||
|
owner: "{{ docker_user.name }}"
|
||||||
|
validate: /usr/bin/docker-compose -f %s config
|
||||||
|
register: compose_file
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Cycle theorangeone.net container
|
||||||
|
docker_compose:
|
||||||
|
project_src: /opt/theorangeone.net
|
||||||
|
pull: true
|
||||||
|
remove_orphans: true
|
||||||
|
remove_volumes: true
|
||||||
|
state: "{{ item }}"
|
||||||
|
when: compose_file.changed
|
||||||
|
loop:
|
||||||
|
- absent
|
||||||
|
- present
|
|
@ -87,16 +87,16 @@ resource "cloudflare_record" "theorangeonenet_dkim_fm3" {
|
||||||
resource "cloudflare_record" "theorangeonenet_www" {
|
resource "cloudflare_record" "theorangeonenet_www" {
|
||||||
zone_id = cloudflare_zone.theorangeonenet.id
|
zone_id = cloudflare_zone.theorangeonenet.id
|
||||||
name = "www"
|
name = "www"
|
||||||
value = "theorangeone-net.netlify.com"
|
value = vultr_server.casey.main_ip
|
||||||
type = "CNAME"
|
type = "A"
|
||||||
ttl = 1
|
ttl = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudflare_record" "theorangeonenet_apex" {
|
resource "cloudflare_record" "theorangeonenet_apex" {
|
||||||
zone_id = cloudflare_zone.theorangeonenet.id
|
zone_id = cloudflare_zone.theorangeonenet.id
|
||||||
name = "@"
|
name = "@"
|
||||||
value = "theorangeone-net.netlify.com"
|
value = vultr_server.casey.main_ip
|
||||||
type = "CNAME"
|
type = "A"
|
||||||
ttl = 1
|
ttl = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue