This repo includes:
- Python Flask backend server used to get information from the inference server, process and store the data in PostgreSQL
- Dockerfiles & docker-compose configurations for easy launch of the backend including all dependencies
- Connect to AWS waste-reduction account
- Create a new EC2 instance from the
Launch instances
wizard- Give it a name
- Click
Browse more AMIs
- In search bar search for
ami-013d3da30d7c5977d
and choose fromCommunity AMIs
- Deep Learning Base AMI ( Ubuntu 18.04) Version 55.0 (pressSelect
) - Instance type:
t2.micro
- Key pair - choose the
ireland-eu-west-1-waste-reduction-key.pem
- Allow all network traffics
- Allow SSH traffic from
- Allow HTTPS traffic from the internet
- Allow HTTP traffic from the internet
- Choose 128GB
- Press
Launch instance
- To log in to the instance use:
ssh -i ireland-eu-west-1-waste-reduction-key.pem ubuntu@<instance_public_ip>
sudo apt-get -y update
# postgresql
sudo apt install postgresql postgresql-contrib
sudo apt-get -y install python-psycopg2
sudo apt-get -y install libpq-dev
sudo systemctl start postgresql.service
# python
cd waste_reduction_api_backend
pip3 install -r requirements.txt
python3 run.py
Note that in case you are using the backend as a service, you should use:
sudo nano /lib/systemd/system/waste-reduction-backend.service
[Unit]
Description=Waste Reduction Backend Service
After=network-online.target
[Service]
ExecStart=/home/ubuntu/waste_reduction_api_backend/src/start.sh
User=ubuntu
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable waste-reduction-backend.service
sudo systemctl start waste-reduction-backend.service
sudo systemctl status waste-reduction-backend.service