Self host my website 🎉

This commit is contained in:
Jake Howard 2020-04-10 11:31:01 +01:00
parent 92d33a0fa7
commit d0c36adba8
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 50 additions and 4 deletions

View file

@ -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"

View file

@ -4,4 +4,5 @@ services:
image: containrrr/watchtower:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "{{ home }}/.docker/config.json:/config.json:ro"
command: --cleanup --interval 300

View file

@ -69,3 +69,6 @@
- name: Install pihole
include: pihole.yml
- name: Install theorangeone.net
include: theorangeone.net.yml

View 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

View file

@ -87,16 +87,16 @@ resource "cloudflare_record" "theorangeonenet_dkim_fm3" {
resource "cloudflare_record" "theorangeonenet_www" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "www"
value = "theorangeone-net.netlify.com"
type = "CNAME"
value = vultr_server.casey.main_ip
type = "A"
ttl = 1
}
resource "cloudflare_record" "theorangeonenet_apex" {
zone_id = cloudflare_zone.theorangeonenet.id
name = "@"
value = "theorangeone-net.netlify.com"
type = "CNAME"
value = vultr_server.casey.main_ip
type = "A"
ttl = 1
}