{"id":13505681,"url":"https://gitlab.com/verbose-equals-true/django-postgres-vue-gitlab-ecs","last_synced_at":"2025-03-30T00:31:27.313Z","repository":{"id":50544164,"uuid":"10908355","full_name":"verbose-equals-true/django-postgres-vue-gitlab-ecs","owner":"verbose-equals-true","description":"An example project that demonstrates local development, CI/CD and production setup for a full stack web app using Django, Django REST Framework, Django Channels, Postgres, VueJS, Redis, Celery, GitLab CI and AWS technologies deployed with CDK.","archived":false,"fork":false,"pushed_at":null,"size":null,"stargazers_count":136,"open_issues_count":5,"forks_count":58,"subscribers_count":null,"default_branch":"develop","last_synced_at":"2024-11-01T03:32:45.394Z","etag":null,"topics":["aws","cdk","celery","django","django-channels","drf","ecs","fargate","gitlab","postgres","vue"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":null,"metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-19T01:06:19.545Z","updated_at":"2023-03-27T15:50:02.895Z","dependencies_parsed_at":"2022-09-04T00:40:14.811Z","dependency_job_id":null,"html_url":"https://gitlab.com/verbose-equals-true/django-postgres-vue-gitlab-ecs","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/verbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/verbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/verbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories/verbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners/verbose-equals-true","download_url":"https://gitlab.com/verbose-equals-true/django-postgres-vue-gitlab-ecs/-/archive/develop/django-postgres-vue-gitlab-ecs-develop.zip","host":{"name":"gitlab.com","url":"https://gitlab.com","kind":"gitlab","repositories_count":4518426,"owners_count":6902,"icon_url":"https://github.com/gitlab.png","version":null,"created_at":"2022-05-30T11:31:42.605Z","updated_at":"2024-07-18T11:24:13.055Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/gitlab.com/owners"}},"keywords":["aws","cdk","celery","django","django-channels","drf","ecs","fargate","gitlab","postgres","vue"],"created_at":"2024-08-01T00:01:11.535Z","updated_at":"2025-03-30T00:31:22.301Z","avatar_url":null,"language":null,"funding_links":[],"categories":["Training Materials and Sample Code"],"sub_categories":["Multi-accounts setup"],"readme":"## Project Documentation\n\nDocumentation for this project can be found here:\n\n[https://verbose-equals-true.gitlab.io/django-postgres-vue-gitlab-ecs/](https://verbose-equals-true.gitlab.io/django-postgres-vue-gitlab-ecs/)\n\n## Project Architecture Overview\n\nHere is an overview of the project architecture, including the CI/CD pipeline and the AWS infrastructure that will be automatically provisioned through the AWS Cloud Development Kit:\n\n![png](/architecture.png)\n\n(This diagram was created with [draw.io](https://draw.io). Here's the link to the a read-only version of the diagram on draw.io: [https://drive.google.com/file/d/1gU61zjoW80fCusUcswU1zhEE5VFB1Z5U/view?usp=sharing](https://drive.google.com/file/d/1gU61zjoW80fCusUcswU1zhEE5VFB1Z5U/view?usp=sharing)\n\n### Legend\n\n1 - GitLab is used to host the source code, test the source code and deploy the application to AWS.\n\n2 - Unit testing (see `.gitlab-ci.yml`)\n\n2a - Pytest\n\n2b - Jest\n\n2c - Cypress\n\n3 - Deployment phase (see `/gitlab-ci/aws/cdk.yml`)\n\n3a - Quasar PWA assets are built if there are changes in the `quasar` directory\n\n3b - AWS Cloud Development Kit (CDK) defines all infrastructure in AWS (4a - 12)\n\n3c - AWS CLI is used to run Fargate tasks through manual GitLab CI jobs\n\n4 - CDK Assets (ECR and S3 buckets that CDK uses internally to manage build assets and artifacts)\n\n4a - Elastic Container Repository is used to manage the Django docker image used in various parts of the application\n\n4b - S3 bucket used to store files associated with CDK and CloudFormation\n\n5 - Route53 is used to route traffic to the CloudFront distribution\n\n6 - CloudFront distribution that serves as the \"front desk\" of the application. It routes requests to to the correct CloudFront Origin\n\n7 - CloudFront Origin Configurations\n\n7a - S3 bucket for Quasar PWA assets\n\n7b - Application Load Balancer for Django application (`/api/`, `/admin/`, `/flower/`, `/ws/`, `/graphql/`)\n\n7c - S3 bucket for Django assets (static files, public media and private media)\n\n8 - Web server and websocket servers\n\n8a - Fargate service running uvicorn process (REST, GraphQL, Django Channels)\n\n8b - Autoscaling Group for Fargate Service that serves Django API\n\n9 - Celery and celery worker autoscaling\n\n9a - Fargate service that is autoscaled between 0 and `N` Fargate tasks for a given celery queue\n\n9b - Scheduled Event that triggers a Lambda to make a request to Django backend which collects celery queue metrics and published metrics to CloudWatch using boto3\n\n9c - Lambda event the makes a request to `/api/celery-metrics/`\n\n9d - CloudWatch alarm that is used to scale the Fargate service for a celery queue\n\n9e - Autoscaling group for celery Fargate service\n\n10 - Fargate tasks that run Django management commands such as `migrate` and `collectstatic`. These are triggered from manual GitLab CI jobs using the AWS CLI (3c)\n\n11 - ElastiCache for Redis, used for Caching, Celery Broker, Channels Layer, etc.\n\n12 - Aurora Postgres Serverless\n\n## Local Development\n\nFirst, copy `.env.template` to a new file in the project's root directory called `.env`. This file will be read by `docker-compose` in the next step. Adjust any of the values in this file if needed, or add new variables for any secret information you need to pass to docker-compose (or to docker containers).\n\n```sh\ndocker-compose up\n```\n\nOpen `http://localhost` in your browser.\n\nYou can specify environment variables for docker-compose by adding an `.env` file to the root of the project based on `.env.template`.\n\n### Social Authentication Keys\n\nTo use social sign on in local development, you will need to create an application with the given provider such as GitHub, Google, Facebook, etc.\n\n#### GitHub\n\nGo to [https://github.com/settings/applications/new](https://github.com/settings/applications/new), and add the following:\n\n- Application Name: A name for the development application, such as `My App Dev`\n- Homepage URL: `http://localhost`\n- Application description: (optional)\n- Authorization callback URL `http://localhost/auth/github/callback` (this route is defined in `quasar/src/router/routes.js`)\n\nIn the `.env` file, add the `Client ID` of your GitHub OAuth App as the `GITHUB_KEY` variable, and add the `Client Secret` as the `GITHUB_SECRET` variable.\n\n## VuePress Documentation\n\nThis project uses VuePress for documentation. To view the documentation site locally, run the following command:\n\n```bash\ndocker-compose -f compose/docs.yml up --build\n```\n\nThis will make the docs available at `http://localhost:8082/docs/`. Hot-reloading through websockets is supported, so changes will show up as they are saved in your code editor.\n\n### Access Django Shell in Jupyter Notebook\n\nWith all containers running, run the following commands:\n\n```\ndocker exec -it backend bash\n# cd notebooks/\n# ../manage.py shell_plus --notebook\n```\n\nor use this single command:\n\n```\ndocker exec -it backend bash -c 'cd notebooks \u0026\u0026 ../manage.py shell_plus --notebook'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fverbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs","html_url":"https://awesome.ecosyste.ms/projects/gitlab.com%2Fverbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/gitlab.com%2Fverbose-equals-true%2Fdjango-postgres-vue-gitlab-ecs/lists"}