Docker compose and README
This commit is contained in:
parent
5012c8943f
commit
c7e58cad59
10
.env
Normal file
10
.env
Normal file
@ -0,0 +1,10 @@
|
||||
# Add anything that might need to be configured here
|
||||
|
||||
COMPOSE_PROJECT_NAME=AIC_G4T2
|
||||
|
||||
# Externally exposed ports (i.e. ports mapped on host system)
|
||||
MONGO_DB_PORT=27017
|
||||
FRONTEND_PORT=8080
|
||||
|
||||
|
||||
DATA_PATH= /aic/g2/
|
||||
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
# If you want you can use this Makefile to specify debug commands, test scripts, etc.
|
||||
|
||||
# Some examples below
|
||||
|
||||
start:
|
||||
docker-compose build && docker-compose up -d
|
||||
|
||||
restart:
|
||||
docker-compose restart
|
||||
|
||||
build:
|
||||
docker-compose build
|
||||
|
||||
purge:
|
||||
docker-compose down -v --rmi all --remove-orphans
|
||||
57
README.md
57
README.md
@ -1,4 +1,57 @@
|
||||
# AIC Federated Storage Project
|
||||
|
||||
* Start both middleware AND frontend dev server simultaneously
|
||||
* See README of subfolder for further information
|
||||
## Teammembers
|
||||
|
||||
+ Tobias Eidelpes (01527193)
|
||||
+ Manuel Hude (01502712)
|
||||
+ Martin Schett (01633073)
|
||||
+ Martin Weick (01627760 )
|
||||
+ Marco Zeisler (0162830)
|
||||
|
||||
|
||||
## Who worked on what?
|
||||
|
||||
+ Tobias Eidelpes - Update Functionality, Docker Deployment, AWS Config, Presentation 2
|
||||
+ Manuel Hude - Mongo DB CRD, Parts IoT Client, Docker Deployment, Presentation 1
|
||||
+ Martin Schett - IoT Client, Recovery Logic, AWS Config, Presentation 1
|
||||
+ Martin Weick - AWS Service, IoT Client Simulation, Presentation 2
|
||||
+ Marco Zeisler - Hashing, User Frontend, Presentation 2
|
||||
|
||||
## How to start the program
|
||||
|
||||
* In the project root run: `docker-compose up -d`
|
||||
* Go to `http://localhost:8080` for the frontend
|
||||
* Run `docker ps` to see the container ID of the image aic_g4t2_iot_client
|
||||
* Enter `docker exec -it <ContainerID> /bin/bash` to enter the shell of the iot_client
|
||||
* Get a usage message by entering `help`
|
||||
|
||||
|
||||
## Technologies used
|
||||
|
||||
* Python 3.8.6 with Django for the backend
|
||||
* Angular 9 for the frontend
|
||||
* Dropbox API for an image storage
|
||||
* AWS S3 as an object storage
|
||||
* MongoDB as a metadata storage
|
||||
|
||||
## Detailed description of a usecase
|
||||
|
||||
Follow: [How to start the program](#How-to-start-the-program) to setup the program. To simulate that a device sent some
|
||||
picture enter `trigger` into the iot_client. You can now see the pictures distributed over the
|
||||
different storages. Write `set 0` to position the cursor to the first image sent. Issue `update` to update the image.
|
||||
The new image shows up in the dashboand and a new version in the corresponding storages is created. Navigate to the Map
|
||||
in the frontend to see a location marker where the image was taken.
|
||||
|
||||
|
||||
## Credentials for AWS and Dropbox
|
||||
|
||||
### AWS
|
||||
* Login URL: https://www.awseducate.com/student/s/
|
||||
* Mail: e1633073@student.tuwien.ac.at
|
||||
* Passwort: OH2uMfNTwlOYBB364zqf!
|
||||
* Bucket: https://s3.console.aws.amazon.com/s3/buckets/aic-fun-bucket-2020?region=us-east-1&tab=objects
|
||||
|
||||
### Dropbox
|
||||
|
||||
* Username: e01633073@student.tuwien.ac.at
|
||||
* Password: aicdropboxpassword
|
||||
51
docker-compose.yml
Normal file
51
docker-compose.yml
Normal file
@ -0,0 +1,51 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
mongo_db:
|
||||
image: mongo
|
||||
restart: always
|
||||
container_name: mongodb
|
||||
volumes:
|
||||
- db-data:/data/db
|
||||
ports:
|
||||
- 27017:27017
|
||||
|
||||
|
||||
middleware:
|
||||
container_name: middleware
|
||||
build:
|
||||
context: ./middleware
|
||||
dockerfile: ./Dockerfile
|
||||
command: python manage.py runserver 0.0.0.0:8000
|
||||
ports:
|
||||
- 8000:8000
|
||||
depends_on:
|
||||
- mongo_db
|
||||
|
||||
|
||||
frontend:
|
||||
container_name: frontend
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: ./Dockerfile
|
||||
ports:
|
||||
- 8080:80
|
||||
depends_on:
|
||||
- mongo_db
|
||||
|
||||
iot_client:
|
||||
container_name: iot_client
|
||||
build:
|
||||
context: ./iotclient
|
||||
dockerfile: ./Dockerfile
|
||||
depends_on:
|
||||
- frontend
|
||||
- middleware
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
volumes:
|
||||
- /aic/g2:/code/images_real
|
||||
|
||||
volumes:
|
||||
db-data: # db-data is a volume that will be generated by docker compose
|
||||
21980
frontend/package-lock.json
generated
21980
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
iotclient/Dockerfile
Normal file
16
iotclient/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM python:3.8-slim
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
|
||||
RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN python -m pip install --upgrade pip
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
COPY requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . /code/
|
||||
@ -36,7 +36,7 @@ def send_image(identifier, image_path, metadata_payload):
|
||||
return False
|
||||
|
||||
file_payload = file_encoded_b64.decode('utf-8')
|
||||
baseurl = "http://127.0.0.1:8000"
|
||||
baseurl = "http://middleware:8000"
|
||||
post_url = "/image/post"
|
||||
body = build_post_payload(identifier, metadata_payload, file_payload)
|
||||
|
||||
|
||||
1
iotclient/requirements.txt
Normal file
1
iotclient/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
requests
|
||||
@ -17,3 +17,5 @@ COPY requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . /code/
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
@ -14,7 +14,8 @@ class MongoManager:
|
||||
if MongoManager.__instance != None:
|
||||
raise Exception("This class is a singleton!")
|
||||
else:
|
||||
MongoManager.__instance = pymongo.MongoClient('127.0.0.1', port=27017, serverSelectionTimeoutMS=1000)
|
||||
print("TEST IM MANAGER")
|
||||
MongoManager.__instance = pymongo.MongoClient('mongodb://mongo_db', port=27017)
|
||||
db = MongoManager.__instance.AIC
|
||||
coll = db.metadata
|
||||
db.coll["identifier"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user