This is a blog using Django, React, TypeScript, Ant Design, Jest, React Testing Library, JSON-LD, CircleCi and Teffaform/AWS.
Terraform uses AWS Fargate, RDS, S3, CloudFront, lambda and Api Gataway, etc.
cp backend/django/.env.example backend/django/.env
docker-compose up -d
docker-compose exec django /bin/bash
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py collectstatic
cd frontend
cp .env.example .env
yarn install
yarn start
$ cd terraform/init
$ cp terraform.tfbackend.example terraform.tfbackend # Update terraform.tfbackend to your settings
$ cp terraform.tfvars.example terraform.tfvars # Update terraform.tfvars to your settings
$ terraform init -backend-config=terraform.tfbackend
$ terraform apply
You need to terraform apply with terraform/init directory first
$ cd terraform/production
$ cp terraform.tfbackend.example terraform.tfbackend # Update terraform.tfbackend to your settings
$ cp terraform.tfvars.example terraform.tfvars # Update terraform.tfvars to your settings
$ terraform init -backend-config=terraform.tfbackend
$ terraform apply
- migrate Overrides and use batch-definition
aws ecs run-task \
--cluster <cluster-name> \
--task-definition <batch-definition-name> \
--network-configuration "awsvpcConfiguration={subnets=[<your-subnet-id>],securityGroups=[<your-sg-id>],assignPublicIp=ENABLED}" \
--overrides '{"containerOverrides": [{"name":"<batcn-definition-name>","command": [ "python", "manage.py", "migrate" ]}]}'
- Django createsuperuser
Overrides and use batch-definition
aws ecs run-task \
--cluster <cluster-name> \
--task-definition <batch-definition-name> \
--network-configuration "awsvpcConfiguration={subnets=[<your-subnet-id>],securityGroups=[<your-sg-id>],assignPublicIp=ENABLED}" \
--overrides '{"containerOverrides": [{"name":"<batcn-definition-name>","command": [ "python", "manage.py", "createsuperuser", "--username", "<your-name>", "--email", "<your-email>", "--noinput" ]}]}'
- Django collectstatic
Overrides and use batch-definition
aws ecs run-task \
--cluster <cluster-name> \
--task-definition <batcn-definition-name> \
--network-configuration "awsvpcConfiguration={subnets=[<your-subnet-id>],securityGroups=[<your-sg-id>],assignPublicIp=ENABLED}" \
--overrides '{"containerOverrides": [{"name":"<batcn-definition-name>","command": [ "python", "manage.py", "collectstatic", "--noinput" ]}]}'