server? server!

This commit is contained in:
nora 2023-08-25 22:31:10 +02:00
parent 8b8313b22e
commit 6bb17f9c65
8 changed files with 100 additions and 3 deletions

View file

@ -25,7 +25,6 @@
pythonPkgs = python.withPackages (ps: with ps; [ pythonPkgs = python.withPackages (ps: with ps; [
virtualenv virtualenv
pip pip
ansible-core
]); ]);
in in
pkgs.mkShell { pkgs.mkShell {
@ -34,6 +33,8 @@
pythonPkgs pythonPkgs
ansible ansible
ansible-lint ansible-lint
certbot
dig
]; ];
}; };
}); });

12
html.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>uwu</title>
</head>
<body>
meow :3
</body>
</html>

8
new/README.md Normal file
View file

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

33
new/docker-compose-2.yml Normal file
View file

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

6
new/inventory.yml Normal file
View file

@ -0,0 +1,6 @@
vps:
hosts:
# vps1:
# ansible_host: vps1.nilstrieb.dev
vps2:
ansible_host: vps2.nilstrieb.dev

View file

@ -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: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>uwu</title>
</head>
<body>
meow :3
</body>
</html>
mode: u=rw,g=r,o=r

View file

@ -1,2 +0,0 @@
---
- name: uwu

3
new/run.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
ansible-playbook -i inventory.yml playbooks/basic-setup.yml -u root