docker-compose is made in one, volume for error & access log, better tagging for docker

pull/662/head
Muhammed Hussein Karimi 3 years ago
parent 4ccff95d9c
commit 9a36e227a3

@ -20,9 +20,12 @@ ansible -> roles -> nginx -> ssl -> <uptime kuma domain>.privkey.pem
``` ```
5. to run playbook 5. to run playbook
```bash ```bash
ansible-playbook ./playbook.yml -i <your inventory path> --extra-vars "kuma_domain=<uptime kuma domain>" ansible-playbook ./playbook.yml -i <your inventory path> -e "kuma_domain=<uptime kuma domain>" -e "kuma_image_os=<alpine or debian>" -e "kuma_image_version=<version>"
``` ```
you can use other ansible playbook options too you can use other ansible playbook options too
> Note: Replace `<uptime kuma domain>` with your desired domain for uptime kuma > Note: Replace `<uptime kuma domain>` with your desired domain for uptime kuma
> replace `<version>` with a version from https://github.com/louislam/uptime-kuma/releases
> replace `<alpine or debian>` with one of options
> `-e "kuma_image_os=<alpine or debian>" -e "kuma_image_version=<version>"` is not required and you can remove this part or change only one of them (kuma_image_os is debian & kuma_image_version is 1 by default)
> If you are not using root user as your ansible_user use -bK option to become root > If you are not using root user as your ansible_user use -bK option to become root

@ -4,16 +4,9 @@
state: directory state: directory
loop: loop:
- /compose - /compose
- /compose/nginx
- /compose/volumes - /compose/volumes
- /compose/volumes/nginx - /compose/volumes/nginx
- /compose/volumes/nginx/log/{{ kuma_domain }}
- name: Ensure docker-compose file has been updated
template:
src: "{{item}}"
dest: /compose/nginx/
loop:
- docker-compose.yml
- name: Ensure nginx config directory exist - name: Ensure nginx config directory exist
copy: copy:
@ -27,9 +20,3 @@
template: template:
src: "nginx.conf" src: "nginx.conf"
dest: /compose/volumes/nginx/nginx.conf dest: /compose/volumes/nginx/nginx.conf
- name: Ensure nginx is up
community.docker.docker_compose:
state: present
project_src: /compose/nginx
pull: no

@ -1,8 +0,0 @@
version: '3.3'
services:
nginx:
network_mode: host
restart: always
image: nginx:stable-alpine
volumes:
- '/compose/volumes/nginx/:/etc/nginx/'

@ -67,8 +67,8 @@ http {
server_name {{ kuma_domain }}; server_name {{ kuma_domain }};
listen 443 ssl http2 default_server; listen 443 ssl http2 default_server;
access_log /var/log/nginx/yoursite.access.log main; access_log /var/log/nginx/{{ kuma_domain }}.access.log main;
error_log /var/log/nginx/yoursite.error.log; error_log /var/log/nginx/{{ kuma_domain }}.error.log;
location / { location / {
# rewrite ^/(.*)/$ /$1 permanent; # rewrite ^/(.*)/$ /$1 permanent;
@ -79,7 +79,7 @@ http {
# } # }
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3001/; proxy_pass http://uptime-kuma:3001/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";

@ -0,0 +1,3 @@
---
kuma_image_version: '1'
kuma_image_os: 'debian'

@ -2,9 +2,18 @@ version: '3.3'
services: services:
uptime-kuma: uptime-kuma:
restart: always restart: always
ports: expose:
- '127.0.0.1:3001:3001' - 3001
volumes: volumes:
- '/compose/volumes/uptime-kuma:/app/data' - '/compose/volumes/uptime-kuma:/app/data'
container_name: uptime-kuma container_name: uptime-kuma
image: 'louislam/uptime-kuma:alpine' image: 'louislam/uptime-kuma:{{kuma_image_version}}-{{kuma_image_os}}'
nginx:
depends_on:
- uptime-kuma
restart: always
image: nginx:stable-alpine
volumes:
- '/compose/volumes/nginx/:/etc/nginx/'
- '/compose/volumes/nginx/log/{{ kuma_domain }}:/var/log/nginx/{{ kuma_domain }}/'

Loading…
Cancel
Save