commit 3284204281c89ba5d935b8b4400ed4a1fbc00670 Author: Michael Schiemer Date: Sun May 18 16:37:48 2025 +0200 chore: initial commit with Docker + Ansible base diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..4565ba90 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.idea/ +vendor/ +node_modules/ +.env +*.log +*.retry +ansible/.vault_pass diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..427811a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +.PHONY: deploy setup stop build restart + +setup: + ansible-playbook -i ansible/inventory.ini ansible/setup.yml + +deploy: + ansible-playbook -i ansible/inventory.ini ansible/deploy.yml + +stop: + docker compose down + +build: + docker compose build --no-cache + +restart: stop build + docker compose up -d diff --git a/ansible/deploy.yml b/ansible/deploy.yml new file mode 100644 index 00000000..fd525065 --- /dev/null +++ b/ansible/deploy.yml @@ -0,0 +1,4 @@ +- hosts: web + become: false + roles: + - deploy diff --git a/ansible/inventory.ini b/ansible/inventory.ini new file mode 100644 index 00000000..09cdead9 --- /dev/null +++ b/ansible/inventory.ini @@ -0,0 +1,2 @@ +[web] +localhost ansible_connection=local \ No newline at end of file diff --git a/ansible/roles/deploy/tasks/main.yml b/ansible/roles/deploy/tasks/main.yml new file mode 100644 index 00000000..9d24ba21 --- /dev/null +++ b/ansible/roles/deploy/tasks/main.yml @@ -0,0 +1,14 @@ +- name: Stoppe laufende Container + command: docker compose down + args: + chdir: "{{ playbook_dir }}/../" + +- name: Baue Images neu (ohne Cache) + command: docker compose build --no-cache + args: + chdir: "{{ playbook_dir }}/../" + +- name: Starte Container neu + command: docker compose up -d + args: + chdir: "{{ playbook_dir }}/../" diff --git a/ansible/roles/setup/tasks/main.yml b/ansible/roles/setup/tasks/main.yml new file mode 100644 index 00000000..af820109 --- /dev/null +++ b/ansible/roles/setup/tasks/main.yml @@ -0,0 +1,3 @@ +- name: Test-Task Setup-Rolle lokal + debug: + msg: "Setup-Rolle ist vorbereitet – echte Installation folgt auf Server." diff --git a/ansible/setup.yml b/ansible/setup.yml new file mode 100644 index 00000000..3786e69a --- /dev/null +++ b/ansible/setup.yml @@ -0,0 +1,4 @@ +- hosts: web + become: false + roles: + - setup diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 00000000..2f977791 --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:stable-alpine + +COPY nginx/default.conf /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/app/html/index.php b/app/html/index.php new file mode 100644 index 00000000..84f4b4b5 --- /dev/null +++ b/app/html/index.php @@ -0,0 +1,2 @@ +