Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #31 from Miouyouyou/main
Browse files Browse the repository at this point in the history
docker: softwares: Use volumes instead of directories
  • Loading branch information
igorpecovnik authored Sep 27, 2022
2 parents 42abae4 + 89eb1f4 commit d96fea7
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions modules/docker/library/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def docker_remove(self, services_names:list):
shutil.rmtree(remove_path)
except Exception as e:
self.logger.error(f'Could not delete {remove_path}')
self.logger.error(e)
continue
else:
self.logger.error(f'{remove_path} does not exist. Skipping {docker_compose_service}')
Expand Down
13 changes: 10 additions & 3 deletions modules/docker/module.cli
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ if __name__ == '__main__':
if args.install:
new_installs = [i for i in args.install if i not in module.list_installed(config)]
module.docker_install(new_installs)
#if args.edit:
# module.edit_configuration_files(args.edit)
if args.service:
actions = {
'start': module.docker_service_start,
Expand All @@ -240,7 +242,12 @@ if __name__ == '__main__':
'disable': module.docker_service_remove_from_boot
}
actions[args.service[0]]()
module.compose_stop(args.stop)
module.compose_start(args.start)
module.compose_status(args.status)
if args.stop:
module.compose_stop(args.stop)

if args.start:
module.compose_start(args.start)

if args.status:
module.compose_status(args.status)

14 changes: 10 additions & 4 deletions modules/docker/softwares/haproxy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
image: haproxy:latest
volumes:
- "./haproxy/conf:/usr/local/etc/haproxy:ro"
- "./ssl:/etc/ssl/mine:ro"
- "haproxy_ssl:/etc/ssl/mine:ro"
# Redirecting HAProxy logs can be troublesome
# The container /dev/log to host /dev/log does
# the trick, though.
Expand All @@ -25,14 +25,20 @@ services:
volumes:
- "./www:/usr/share/nginx/website:ro"
- "./nginx/config/nginx.conf:/etc/nginx/nginx.conf:ro"
- "./nginx/cache:/var/cache/nginx"
- "./nginx/run:/var/run"
- "./nginx/logs:/var/log/nginx"
- "nginx_cache:/var/cache/nginx"
- "nginx_run:/var/run"
- "nginx_logs:/var/log/nginx"
restart: always
networks:
haproxy_net:
aliases:
- that_nginx_server

volumes:
haproxy_ssl:
nginx_cache:
nginx_run:
nginx_logs:

networks:
haproxy_net:
Empty file.
Empty file.
Empty file.
Empty file.
7 changes: 5 additions & 2 deletions modules/docker/softwares/pihole/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ services:
# WEBPASSWORD: 'set a secure password here or it will be random'
# Volumes store your data between container upgrades
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
- 'etc-pihole:/etc/pihole'
- 'etc-dnsmasq:/etc/dnsmasq.d'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped

volumes:
etc-pihole:
etc-dnsmasq:

0 comments on commit d96fea7

Please sign in to comment.