Advertisement
Guest User

docker compose

a guest
Oct 6th, 2023
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. version: "3"
  2. services:
  3. db_recipes:
  4. restart: always
  5. image: postgres:15-alpine
  6. volumes:
  7. - ./postgresql:/var/lib/postgresql/data
  8. env_file:
  9. - ./.env
  10.  
  11. web_recipes:
  12. restart: always
  13. image: vabene1111/recipes
  14. env_file:
  15. - ./.env
  16. volumes:
  17. - staticfiles:/opt/recipes/staticfiles
  18. # Do not make this a bind mount, see https://docs.tandoor.dev/install/docker/#volumes-vs-bind-mounts
  19. - nginx_config:/opt/recipes/nginx/conf.d
  20. - ./mediafiles:/opt/recipes/mediafiles
  21. depends_on:
  22. - db_recipes
  23.  
  24. nginx_recipes:
  25. image: nginx:mainline-alpine
  26. restart: always
  27. ports:
  28. - 8123:80
  29. env_file:
  30. - ./.env
  31. depends_on:
  32. - web_recipes
  33. volumes:
  34. # Do not make this a bind mount, see https://docs.tandoor.dev/install/docker/#volumes-vs-bind-mounts
  35. - nginx_config:/etc/nginx/conf.d:ro
  36. - staticfiles:/static:ro
  37. - ./mediafiles:/media:ro
  38.  
  39. backup:
  40. image: postgres:13
  41. depends_on:
  42. - db_recipes
  43. volumes:
  44. - ./backup:/backup
  45. command: >
  46. bash -c "while true; do
  47. PGPASSWORD=$$POSTGRES_PASSWORD pg_dump -h db-postgresql -U $$POSTGRES_USER -Fc $$POSTGRES_DB > /backup/$$(date +%Y-%m-%d-%H-%M-%S).dump
  48. echo ""Backup done at $$(date +%Y-%m-%d_%H:%M:%S)""
  49. ls -1 /backup/*.dump | head -n -2 | xargs rm -f
  50. sleep 86400
  51. done"
  52. environment:
  53. POSTGRES_USER: <redacted>
  54. POSTGRES_PASSWORD: <redacted>
  55. POSTGRES_DB: <redacted>
  56.  
  57. volumes:
  58. nginx_config:
  59. staticfiles:
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement