|
| 1 | +# Comments are provided throughout this file to help you get started. |
| 2 | +# If you need more help, visit the Docker compose reference guide at |
| 3 | +# https://docs.docker.com/compose/compose-file/ |
| 4 | + |
| 5 | +# Here the instructions define your application as a service called "server". |
| 6 | +# This service is built from the Dockerfile in the current directory. |
| 7 | +# You can add other services your application may depend on here, such as a |
| 8 | +# database or a cache. For examples, see the Awesome Compose repository: |
| 9 | +# https://github.com/docker/awesome-compose |
| 10 | +services: |
| 11 | + server1: |
| 12 | + image: django_example |
| 13 | + env_file: |
| 14 | + - src/_example/django/.env |
| 15 | + volumes: |
| 16 | + - ./src/:/app/src |
| 17 | + ports: |
| 18 | + - 8801:80 |
| 19 | + server2: |
| 20 | + image: django_example |
| 21 | + env_file: |
| 22 | + - src/_example/django/.env |
| 23 | + volumes: |
| 24 | + - ./src/:/app/src |
| 25 | + ports: |
| 26 | + - 8802:80 |
| 27 | + # server3: |
| 28 | + # image: django_example |
| 29 | + # env_file: |
| 30 | + # - src/_example/django/.env |
| 31 | + # volumes: |
| 32 | + # - ./src/:/app/src |
| 33 | + # ports: |
| 34 | + # - 8803:80 |
| 35 | + # server4: |
| 36 | + # image: django_example |
| 37 | + # env_file: |
| 38 | + # - src/_example/django/.env |
| 39 | + # volumes: |
| 40 | + # - ./src/:/app/src |
| 41 | + # ports: |
| 42 | + # - 8804:80 |
| 43 | + # server5: |
| 44 | + # image: django_example |
| 45 | + # env_file: |
| 46 | + # - src/_example/django/.env |
| 47 | + # volumes: |
| 48 | + # - ./src/:/app/src |
| 49 | + # ports: |
| 50 | + # - 8805:80 |
| 51 | + # server6: |
| 52 | + # image: django_example |
| 53 | + # env_file: |
| 54 | + # - src/_example/django/.env |
| 55 | + # volumes: |
| 56 | + # - ./src/:/app/src |
| 57 | + # ports: |
| 58 | + # - 8806:80 |
| 59 | + # server7: |
| 60 | + # image: django_example |
| 61 | + # env_file: |
| 62 | + # - src/_example/django/.env |
| 63 | + # volumes: |
| 64 | + # - ./src/:/app/src |
| 65 | + # ports: |
| 66 | + # - 8807:80 |
| 67 | + # server8: |
| 68 | + # image: django_example |
| 69 | + # env_file: |
| 70 | + # - src/_example/django/.env |
| 71 | + # volumes: |
| 72 | + # - ./src/:/app/src |
| 73 | + # ports: |
| 74 | + # - 8808:80 |
| 75 | + # server9: |
| 76 | + # image: django_example |
| 77 | + # env_file: |
| 78 | + # - src/_example/django/.env |
| 79 | + # volumes: |
| 80 | + # - ./src/:/app/src |
| 81 | + # ports: |
| 82 | + # - 8809:80 |
| 83 | + # server10: |
| 84 | + # image: django_example |
| 85 | + # env_file: |
| 86 | + # - src/_example/django/.env |
| 87 | + # volumes: |
| 88 | + # - ./src/:/app/src |
| 89 | + # ports: |
| 90 | + # - 8810:80 |
| 91 | + |
| 92 | +# The commented out section below is an example of how to define a PostgreSQL |
| 93 | +# database that your application can use. `depends_on` tells Docker Compose to |
| 94 | +# start the database before your application. The `db-data` volume persists the |
| 95 | +# database data between container restarts. The `db-password` secret is used |
| 96 | +# to set the database password. You must create `db/password.txt` and add |
| 97 | +# a password of your choosing to it before running `docker compose up`. |
| 98 | +# depends_on: |
| 99 | +# db: |
| 100 | +# condition: service_healthy |
| 101 | +# db: |
| 102 | +# image: postgres |
| 103 | +# restart: always |
| 104 | +# user: postgres |
| 105 | +# secrets: |
| 106 | +# - db-password |
| 107 | +# volumes: |
| 108 | +# - db-data:/var/lib/postgresql/data |
| 109 | +# environment: |
| 110 | +# - POSTGRES_DB=example |
| 111 | +# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password |
| 112 | +# expose: |
| 113 | +# - 5432 |
| 114 | +# healthcheck: |
| 115 | +# test: [ "CMD", "pg_isready" ] |
| 116 | +# interval: 10s |
| 117 | +# timeout: 5s |
| 118 | +# retries: 5 |
| 119 | +# volumes: |
| 120 | +# db-data: |
| 121 | +# secrets: |
| 122 | +# db-password: |
| 123 | +# file: docker_files/db_password.txt |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + loadbalancer: |
| 128 | + image: nginx |
| 129 | + restart: always |
| 130 | + container_name: loadbalancer |
| 131 | + volumes: |
| 132 | + - ./docker_files/nginx.conf:/etc/nginx/nginx.conf |
| 133 | + ports: |
| 134 | + - "8800:8800" |
0 commit comments