Skip to content
Snippets Groups Projects
Commit ca08844a authored by Schiffer, Christian's avatar Schiffer, Christian
Browse files

Made docker-compose fancy with mongodb and mariadb

parent 8b4d339b
No related branches found
No related tags found
No related merge requests found
Showing
with 76 additions and 36 deletions
......@@ -4,3 +4,5 @@ __pycache__/
.idea/
atlas_controller/venv/
atlas_controller/work_dir/
atlas_server/mongodb/
microdraw/mariadb/
\ No newline at end of file
# atlas_server
Flask server accepting data and requests from Microdraw, accessing and maintaining the MongoDB and contacting `atlas_controller`.
Deployment is implemented using docker and docker-compose.
Perform the following steps to start:
```bash
docker-compose build
docker-compose up -d
```
This will start two docker containers: `uwsgi` hosting the flask application and `nginx` hosting the web server.
\ No newline at end of file
# docker-compose for atlas_server
# atlas_server consists of two containers
# - uwsgi: runs flask app using uwsgi
# - nginx: runs nginx server
version: '3'
services:
uwsgi:
image: atlas-server-uwsgi
build: "./uwsgi"
volumes:
- "./atlas_server:/src/atlas_server"
nginx:
image: atlas-server-nginx
build: "./nginx"
ports:
- 5000:80
depends_on:
- uwsgi
\ No newline at end of file
......@@ -3,7 +3,7 @@ FROM nginx:latest
# Configuration
ENV NGINX_PORT 80
ENV NGINX_CONFIG app.conf
ENV NGINX_CONFIG atlas_server.conf
# Port for nginx
EXPOSE ${NGINX_PORT}
......
......@@ -10,6 +10,6 @@ server {
location @app {
include uwsgi_params;
uwsgi_pass uwsgi:5000;
uwsgi_pass atlas-server-uwsgi:5000;
}
}
\ No newline at end of file
File moved
......@@ -2,7 +2,7 @@
"""
Configuration for ATLaS server
"""
DATABASE_HOST = "localhost"
DATABASE_HOST = "mongodb"
DATABASE_PORT = 27017
DATABASE_NAME = "atlas_ui_db"
ATLAS_CONTROLLER_URL = "http://localhost:8000/api"
ATLAS_CONTROLLER_URL = "http://atlas-server-nginx:5000"
File moved
File moved
# docker-compose for atlas_server
# atlas_server consists of two containers
# - uwsgi: runs flask app using uwsgi
# - nginx: runs nginx server
version: '3'
services:
atlas-server-uwsgi:
image: atlas-server-uwsgi
build: "./atlas_server/uwsgi"
volumes:
- "./atlas_server/src:/src/atlas_server"
atlas-server-nginx:
image: atlas-server-nginx
build: "./atlas_server/nginx"
ports:
- 5000:80
depends_on:
- atlas-server-uwsgi
microdraw:
image: microdraw
build: "./microdraw/"
ports:
- 5001:80
volumes:
- "./microdraw/src:/var/www/html/microdraw"
mongodb:
image: mongo
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: root
volumes:
- "./atlas_server/mongodb:/data/db"
mariadb:
image: mariadb
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: microdraw
MYSQL_PASSWORD: microdraw
volumes:
- "./microdraw/mariadb:/var/lib/mysql"
\ No newline at end of file
# Dockerfile for nginx
FROM nginx:latest
# Configuration
ENV NGINX_PORT 80
ENV NGINX_CONFIG microdraw.conf
# Port for nginx
EXPOSE ${NGINX_PORT}
# Remove default configuration and add our custom configuration
RUN rm /etc/nginx/conf.d/default.conf
COPY ${NGINX_CONFIG} /etc/nginx/conf.d
\ No newline at end of file
# Configuration for microdraw nginx
server {
listen 80;
root /var/www/html/microdraw;
}
\ No newline at end of file
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment