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
```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
> 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

@ -4,16 +4,9 @@
state: directory
loop:
- /compose
- /compose/nginx
- /compose/volumes
- /compose/volumes/nginx
- name: Ensure docker-compose file has been updated
template:
src: "{{item}}"
dest: /compose/nginx/
loop:
- docker-compose.yml
- /compose/volumes/nginx/log/{{ kuma_domain }}
- name: Ensure nginx config directory exist
copy:
@ -27,9 +20,3 @@
template:
src: "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 }};
listen 443 ssl http2 default_server;
access_log /var/log/nginx/yoursite.access.log main;
error_log /var/log/nginx/yoursite.error.log;
access_log /var/log/nginx/{{ kuma_domain }}.access.log main;
error_log /var/log/nginx/{{ kuma_domain }}.error.log;
location / {
# rewrite ^/(.*)/$ /$1 permanent;
@ -79,7 +79,7 @@ http {
# }
proxy_set_header X-Real-IP $remote_addr;
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_set_header Upgrade $http_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:
uptime-kuma:
restart: always
ports:
- '127.0.0.1:3001:3001'
expose:
- 3001
volumes:
- '/compose/volumes/uptime-kuma:/app/data'
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