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.
- Loading branch information
Showing
9 changed files
with
424 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,46 @@ | ||
# Docker Compose Description for django-minio-backend | ||
Execute the following step to start a demo environment using Docker Compose: | ||
|
||
**Start the Docker Compose services:** | ||
```shell | ||
docker-compose up -d | ||
docker-compose exec web python manage.py createsuperuser --noinput | ||
docker-compose exec web python manage.py collectstatic --noinput | ||
``` | ||
|
||
## About 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" | ||
``` | ||
MinIO is load balanced by nginx, so all connections made from Django towards MinIO happens through the internal `nginx` FQDN. <br> | ||
Therefore, the value of `GH_MINIO_ENDPOINT` is `nginx:9000`. | ||
|
||
# Web Access | ||
Both Django(:8000) and MinIO(:9001) expose a Web GUI and their ports are mapped to the host machine. | ||
|
||
## 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` | ||
|
||
# Developer Environment | ||
An alternative docker-compose file is available for **django-minio-backend** which does not copy the source files into the container, but maps them as a volume. | ||
**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.