From 6bb17f9c654e3f61032f6bfe8027e2e91caa880e Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Fri, 25 Aug 2023 22:31:10 +0200 Subject: [PATCH] server? server! --- flake.nix | 3 ++- html.html | 12 ++++++++++++ new/README.md | 8 ++++++++ new/docker-compose-2.yml | 33 ++++++++++++++++++++++++++++++++ new/inventory.yml | 6 ++++++ new/playbooks/basic-setup.yml | 36 +++++++++++++++++++++++++++++++++++ new/playbooks/server2.yml | 2 -- new/run.sh | 3 +++ 8 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 html.html create mode 100644 new/README.md create mode 100644 new/docker-compose-2.yml create mode 100644 new/inventory.yml create mode 100644 new/playbooks/basic-setup.yml delete mode 100644 new/playbooks/server2.yml create mode 100755 new/run.sh diff --git a/flake.nix b/flake.nix index 535c1aa..5349a7b 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,6 @@ pythonPkgs = python.withPackages (ps: with ps; [ virtualenv pip - ansible-core ]); in pkgs.mkShell { @@ -34,6 +33,8 @@ pythonPkgs ansible ansible-lint + certbot + dig ]; }; }); diff --git a/html.html b/html.html new file mode 100644 index 0000000..b426ad6 --- /dev/null +++ b/html.html @@ -0,0 +1,12 @@ + + + + + + + uwu + + + meow :3 + + \ No newline at end of file diff --git a/new/README.md b/new/README.md new file mode 100644 index 0000000..3573e45 --- /dev/null +++ b/new/README.md @@ -0,0 +1,8 @@ +# exciting new stuff!! + +https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-ansible-on-ubuntu-18-04 + +## server?? + +Each VPS has an nginx running _on the host_, not inside docker. It's the entrypoint to the stuff. +Everything else runs in a docker container via docker compose. diff --git a/new/docker-compose-2.yml b/new/docker-compose-2.yml new file mode 100644 index 0000000..a6c90e2 --- /dev/null +++ b/new/docker-compose-2.yml @@ -0,0 +1,33 @@ +version: '3.3' +services: + nginx: + container_name: nginx + restart: always + image: nginx:latest + ports: + - "80:80" + volumes: + - "${NGINX_CONF_PATH}:/etc/nginx/nginx.conf:ro" + - "/etc/letsencrypt:/etc/nginx/certs:ro" + networks: + - internal + registry: + container_name: registry-c + restart: always + image: registry:2 + volumes: + - "${REGISTRY_CONF_DIR}/config.yml:/etc/docker/registry/config.yml" + - "/var/lib/docker/registry:/var/lib/registry" + - "/etc/letsencrypt:/etc/letsencrypt" + environment: + - REGISTRY_HTTP_TLS_CERTIFICATE=/etc/letsencrypt/live/nilstrieb.dev/fullchain.pem + - REGISTRY_HTTP_TLS_KEY=/etc/letsencrypt/live/nilstrieb.dev/privkey.pem + - REGISTRY_AUTH=htpasswd + - REGISTRY_AUTH_HTPASSWD_REALM=Realm + - REGISTRY_AUTH_HTPASSWD_PATH=/htpasswd + - "/etc/htpasswd:/htpasswd" + networks: + - internal + +networks: + internal: \ No newline at end of file diff --git a/new/inventory.yml b/new/inventory.yml new file mode 100644 index 0000000..199c724 --- /dev/null +++ b/new/inventory.yml @@ -0,0 +1,6 @@ +vps: + hosts: + # vps1: + # ansible_host: vps1.nilstrieb.dev + vps2: + ansible_host: vps2.nilstrieb.dev diff --git a/new/playbooks/basic-setup.yml b/new/playbooks/basic-setup.yml new file mode 100644 index 0000000..a84931d --- /dev/null +++ b/new/playbooks/basic-setup.yml @@ -0,0 +1,36 @@ +--- +- name: Basic Server setup + hosts: all + gather_facts: false + tasks: + - name: Test ping + ansible.builtin.ping: + - name: Install docker + ansible.builtin.apt: + name: docker.io + state: present + - name: Install nginx + ansible.builtin.apt: + name: nginx + state: present + - name: Ensure nginx is started + ansible.builtin.service: + name: nginx + state: started + - name: Create hello world file + ansible.builtin.copy: + dest: /var/www/html/index.html + content: | + + + + + + + uwu + + + meow :3 + + + mode: u=rw,g=r,o=r diff --git a/new/playbooks/server2.yml b/new/playbooks/server2.yml deleted file mode 100644 index edb5e3e..0000000 --- a/new/playbooks/server2.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- name: uwu \ No newline at end of file diff --git a/new/run.sh b/new/run.sh new file mode 100755 index 0000000..24dd65f --- /dev/null +++ b/new/run.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +ansible-playbook -i inventory.yml playbooks/basic-setup.yml -u root