forked from theriverman/django-minio-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved support for Docker environments
* Transformed the external client into a fake client * The fake client is used for pre-signed URL generation only * All other activities are done via the regular client using internal network (GitHub Actions): Optimised the PyPI Publish workflow by ignoring develop and feature/ branches
- Loading branch information
1 parent
e144016
commit 3ea0f03
Showing
9 changed files
with
417 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ name: PyPI Publish | |
|
||
on: | ||
push: | ||
branches-ignore: | ||
- 'develop' | ||
- 'feature/*' | ||
tags: | ||
- v** | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM python:3 | ||
ENV PYTHONUNBUFFERED=1 | ||
WORKDIR /code | ||
|
||
# Copy Demo Project | ||
COPY ./manage.py /code/manage.py | ||
COPY ./django_minio_backend /code/django_minio_backend | ||
COPY ./DjangoExampleProject /code/DjangoExampleProject | ||
COPY ./DjangoExampleApplication /code/DjangoExampleApplication | ||
|
||
# Copy and install requirements.txt | ||
COPY requirements.txt /code/ | ||
RUN pip install -r /code/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Demo Description for Docker Compose | ||
Execute the following step to start a demo environment using Docker Compose: | ||
|
||
**Start the Docker Compose services:** | ||
```shell | ||
docker-compose up | ||
``` | ||
Leave this shell instance intact to keep your Docker services running! | ||
|
||
# Django Admin | ||
Open your browser at http://localhost:8000/admin to access the Django admin portal: | ||
* username: `admin` | ||
* password: `123123` | ||
|
||
# MinIO Console | ||
Open your browser at http://localhost:9001 to access the MiniIO Console: | ||
* username: `minio` | ||
* password: `minio123` | ||
|
||
# docker-compose.yml | ||
Note the following lines in `docker-compose.yml`: | ||
```yaml | ||
environment: | ||
GH_MINIO_ENDPOINT: "nginx:9000" | ||
GH_MINIO_USE_HTTPS: "false" | ||
GH_MINIO_EXTERNAL_ENDPOINT: "localhost:9000" | ||
GH_MINIO_EXTERNAL_ENDPOINT_USE_HTTPS: "false" | ||
``` | ||
The value of `GH_MINIO_ENDPOINT` is `nginx:9000` because in the used [docker-compose.yml](docker-compose.yml) file the minio instances are load balanced by NGINX. | ||
This means we're not interacting with the four minio1...minio4 instances directly but through the NGINX reverse-proxy. | ||
|
||
# Developer Environment | ||
**Input file**: `docker-compose.develop.yml` | ||
|
||
If you would like to develop in a Docker Compose environment, execute the following commands: | ||
```shell | ||
docker-compose --project-name "django-minio-backend-DEV" -f docker-compose.develop.yml up -d | ||
docker-compose --project-name "django-minio-backend-DEV" -f docker-compose.develop.yml exec web python manage.py createsuperuser --noinput | ||
docker-compose --project-name "django-minio-backend-DEV" -f docker-compose.develop.yml exec web python manage.py collectstatic --noinput | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# ORIGINAL SOURCE | ||
# https://docs.min.io/docs/deploy-minio-on-docker-compose.html | ||
# https://github.com/minio/minio/blob/master/docs/orchestration/docker-compose/docker-compose.yaml?raw=true | ||
|
||
# IN THIS CONFIGURATION, THE PROJECT FILES ARE VOLUME MAPPED INTO THE CONTAINER FROM THE HOST | ||
|
||
version: "3.9" | ||
|
||
# Settings and configurations that are common for all containers | ||
x-minio-common: &minio-common | ||
image: minio/minio:RELEASE.2021-07-30T00-02-00Z | ||
command: server --console-address ":9001" http://minio{1...4}/data{1...2} | ||
expose: | ||
- "9000" | ||
- "9001" | ||
environment: | ||
MINIO_ROOT_USER: minio | ||
MINIO_ROOT_PASSWORD: minio123 | ||
healthcheck: | ||
test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] | ||
interval: 30s | ||
timeout: 20s | ||
retries: 3 | ||
|
||
services: | ||
# starts Django from DjangoExampleProject + DjangoExampleApplication | ||
web: | ||
image: python:3 | ||
command: bash -c " | ||
pip install -r /code/requirements.txt | ||
&& python manage.py migrate | ||
&& python manage.py runserver 0.0.0.0:8000 | ||
" | ||
volumes: | ||
- .:/code | ||
working_dir: /code | ||
environment: | ||
PYTHONUNBUFFERED: "1" | ||
GH_MINIO_ENDPOINT: "nginx:9000" | ||
GH_MINIO_USE_HTTPS: "false" | ||
GH_MINIO_EXTERNAL_ENDPOINT: "localhost:9000" | ||
GH_MINIO_EXTERNAL_ENDPOINT_USE_HTTPS: "false" | ||
GH_MINIO_ACCESS_KEY: "minio" | ||
GH_MINIO_SECRET_KEY: "minio123" | ||
# CREATE AN ADMIN ACCOUNT FOR INTERNAL DEMO PURPOSES ONLY! | ||
DJANGO_SUPERUSER_USERNAME: "admin" | ||
DJANGO_SUPERUSER_PASSWORD: "123123" | ||
DJANGO_SUPERUSER_EMAIL: "[email protected]" | ||
ports: | ||
- "8000:8000" | ||
depends_on: | ||
- nginx | ||
# starts 4 docker containers running minio server instances. | ||
# using nginx reverse proxy, load balancing, you can access | ||
# it through port 9000. | ||
minio1: | ||
<<: *minio-common | ||
hostname: minio1 | ||
volumes: | ||
- data1-1:/data1 | ||
- data1-2:/data2 | ||
|
||
minio2: | ||
<<: *minio-common | ||
hostname: minio2 | ||
volumes: | ||
- data2-1:/data1 | ||
- data2-2:/data2 | ||
|
||
minio3: | ||
<<: *minio-common | ||
hostname: minio3 | ||
volumes: | ||
- data3-1:/data1 | ||
- data3-2:/data2 | ||
|
||
minio4: | ||
<<: *minio-common | ||
hostname: minio4 | ||
volumes: | ||
- data4-1:/data1 | ||
- data4-2:/data2 | ||
|
||
nginx: | ||
image: nginx:1.19.2-alpine | ||
hostname: nginx | ||
volumes: | ||
- ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
ports: | ||
- "9000:9000" | ||
- "9001:9001" | ||
depends_on: | ||
- minio1 | ||
- minio2 | ||
- minio3 | ||
- minio4 | ||
|
||
## By default this config uses default local driver, | ||
## For custom volumes replace with volume driver configuration. | ||
volumes: | ||
data1-1: | ||
data1-2: | ||
data2-1: | ||
data2-2: | ||
data3-1: | ||
data3-2: | ||
data4-1: | ||
data4-2: |
Oops, something went wrong.