chore: initial commit with Docker + Ansible base
This commit is contained in:
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
.idea/
|
||||
vendor/
|
||||
node_modules/
|
||||
.env
|
||||
*.log
|
||||
*.retry
|
||||
ansible/.vault_pass
|
||||
16
Makefile
Normal file
16
Makefile
Normal file
@@ -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
|
||||
4
ansible/deploy.yml
Normal file
4
ansible/deploy.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- hosts: web
|
||||
become: false
|
||||
roles:
|
||||
- deploy
|
||||
2
ansible/inventory.ini
Normal file
2
ansible/inventory.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[web]
|
||||
localhost ansible_connection=local
|
||||
14
ansible/roles/deploy/tasks/main.yml
Normal file
14
ansible/roles/deploy/tasks/main.yml
Normal file
@@ -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 }}/../"
|
||||
3
ansible/roles/setup/tasks/main.yml
Normal file
3
ansible/roles/setup/tasks/main.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
- name: Test-Task Setup-Rolle lokal
|
||||
debug:
|
||||
msg: "Setup-Rolle ist vorbereitet – echte Installation folgt auf Server."
|
||||
4
ansible/setup.yml
Normal file
4
ansible/setup.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- hosts: web
|
||||
become: false
|
||||
roles:
|
||||
- setup
|
||||
3
app/Dockerfile
Normal file
3
app/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
2
app/html/index.php
Normal file
2
app/html/index.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
phpinfo();
|
||||
17
app/nginx/default.conf
Normal file
17
app/nginx/default.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /var/www/html;
|
||||
index index.php index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
|
||||
}
|
||||
}
|
||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ./app
|
||||
ports:
|
||||
- "8000:80"
|
||||
volumes:
|
||||
- ./app/html:/var/www/html
|
||||
depends_on:
|
||||
- php
|
||||
|
||||
php:
|
||||
image: php:8.4-fpm
|
||||
volumes:
|
||||
- ./app/html:/var/www/html
|
||||
Reference in New Issue
Block a user