I have a Django project which is working fine on my local machine. I want to host the same on AWS, but confused on what service to use and what is the best practice to so. Do I use EC2, create a ubuntu instance on it and install Docker or use ECS ?
What is the best practice to transfer my django project to AWS. Do I create a repository on Docker hub ?
Please help me explain the best workflow on this.
My docker-compose
file looks like this:
version: '3'
services:
db:
image: mysql:latest
restart: always
environment:
- MYSQL_DATABASE=tg_db
- MYSQL_ROOT_PASSWORD=password
volumes:
- ./dbdata:/var/lib/mysql
web:
build: .
command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
Thanks!
UPDATE (Steps I took for deployment) Dockerfile
:
# Start with a python image
FROM python:3
# Some stuff that everyone has been copy-pasting
# since the dawn of time.
ENV PYTHONUNBUFFERED 1
# Install things
RUN apt-get update
# Make folders and locations for project
RUN mkdir /code
COPY . /code
WORKDIR /code/project/t_backend
# Install requirements
RUN pip install -U pip
RUN pip install -Ur requirements.txt
I used sudo docker-compose up -d
and project is running on local
Now I pushed my tg_2_web:latest
on ECR
. Where does the database
and Apache
containers come in action.
Do I have to create a separated repository for both mysql database
and apache
container.
How will I connect all the containers using ECS
?
Thanks !
The answer to this question can be really wide but just to give you a heads up on what all processes it is supposed to go through -
Packaging Images
Storing Images
Deploying images
Ref -
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html
https://aws.amazon.com/fargate/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.