{"id":14986873,"url":"https://github.com/nirgn975/angular-sanic-seed-project","last_synced_at":"2025-04-11T23:10:29.563Z","repository":{"id":39551095,"uuid":"61518505","full_name":"nirgn975/angular-sanic-seed-project","owner":"nirgn975","description":"💎  An opinionated Angular - Sanic RESTful seed","archived":false,"fork":false,"pushed_at":"2022-10-09T07:59:40.000Z","size":1511,"stargazers_count":55,"open_issues_count":18,"forks_count":23,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-25T19:01:34.705Z","etag":null,"topics":["angular","angular-cli","best-practices","containers","django","docker","docker-swarm","elk-stack","load-test","ngrx","postgresql","production-ready","project-template","python","restful-api","seed","tests"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nirgn975.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-20T05:11:27.000Z","updated_at":"2024-03-01T09:56:28.000Z","dependencies_parsed_at":"2022-08-26T02:00:54.286Z","dependency_job_id":null,"html_url":"https://github.com/nirgn975/angular-sanic-seed-project","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirgn975%2Fangular-sanic-seed-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirgn975%2Fangular-sanic-seed-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirgn975%2Fangular-sanic-seed-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirgn975%2Fangular-sanic-seed-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirgn975","download_url":"https://codeload.github.com/nirgn975/angular-sanic-seed-project/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492868,"owners_count":21113163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-cli","best-practices","containers","django","docker","docker-swarm","elk-stack","load-test","ngrx","postgresql","production-ready","project-template","python","restful-api","seed","tests"],"created_at":"2024-09-24T14:13:43.740Z","updated_at":"2025-04-11T23:10:29.545Z","avatar_url":"https://github.com/nirgn975.png","language":"TypeScript","readme":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n\u003cimg src=\"https://raw.githubusercontent.com/nirgn975/Angular-Django-Seed-Project/master/art/angular-django-seed-project.png\" /\u003e\n\n[![license][license-image]][license-url] [![GitHub release][github-image]][github-url] [![Build Status][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![Dependency Status][dependencyci-image]][dependencyci-url] [![Codacy Badge][codacy-image]][codacy-url] [![Maintenance][maintenance-image]][maintenance-url] [![Donate][donate-image]][donate-url]\n\nThis repo is a production ready seed project. The app shows a list of users.\n\n## Structure\n\n* The `client` contain an [Angular](https://angular.io/) app, built with [Angular-Cli](https://github.com/angular/angular-cli), and [ngrx](https://github.com/ngrx) to handle state, [Angular Material](https://github.com/angular/material2) as a design library, and have service worker, and `AOT` compiled. The app shows the users from the Sanic api.\n* The `server` contain a simple [Sanic](https://sanic.readthedocs.io) app that expose an `api` of `users`. The Python serve through a [gunicorn](http://gunicorn.org/) server installed in the container.\n* There is a `postgres` service for the database. The `database` directory contains the automatic backup script.\n* All the logs are going to `stdout` and can be collected through any service.\n* There are built in test that configured to run on `travis-ci`, and a code coverage analysis via `codecov`.\n=======\n# An opinionated Angular - Django cluster\n\n[![license][license-image]][license-url] [![Build Status][travis-image]][travis-url] [![codecov][codecov-image]][codecov-url] [![Python 3][python3-image]][python3-url] [![Updates][updates-image]][updates-url] [![Dependency Status][dependencyci-image]][dependencyci-url] [![Donate][donate-image]][donate-url]\n\nThe `server` directory contain a simple [Django](https://www.djangoproject.com/) app that expose an `api` of Django `users` with [Django REST framework](http://www.django-rest-framework.org/). The `client` directory contain an [Angular](https://angular.io/) simple app, built with [Angular-Cli](https://github.com/angular/angular-cli), [ngrx](https://github.com/ngrx) to handle state, [Angular Material](https://github.com/angular/material2) as a design library, have service worker, and ready to `AOT` compilation. The simple Angular app show the users from the Django api.\n\nThe repo is a production ready app, that uses `nginx` to serve static files (the client app and static files from the server), and `gunicorn` for the server (python) stuff. All the parts are in a separate [Docker](https://www.docker.com/) containers and we use [kubernetes](https://kubernetes.io/) to manage them.\n\n## Pre Requirements\n\n1. install [docker](https://www.docker.com/).\n2. Don't know yet.\n\n## Installation\n\nAutomatic installation of the project with docker, for development.\n\n1. Run `$ docker-compose up` to build the docker images and run them.\n3. Open the browser at [http://localhost:8000](http://localhost:8000) to see your Django (server) app.\n3. Open the browser at [http://localhost:4200](http://localhost:4200) to see your Angular (client) app.\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e b72a69f (Update dependencies (#20))\n\nThe `client` app is built via the cloud build CI on GCP and deployed to the GCP `storage`.\nThe `server` app is built via the cloud build CI as a docker image and deployed to a `GKE cluster` on GCP (managed by Kubernetes).\nThe PostgreSQL `database` is built via the cloud build CI as a docker image and deployed to a `GKE cluster` on GCP (managed by Kubernetes).\n\n## Production Installation\n\nDeploy the `client` app:\n1. Create a storage bucket with the name of the Domain you have.\n2. Create a cloud build trigger with the parameters in the [screenshot](art/client-trigger.jpg) (change the `_REGION_NAME` to the location of the bucket you created in the previous step).\n3. Now you can deploy your `client` app by creating a new tag in the `v0.0.1/prod/prod` format and push it to github (`git push --tags`).\n\nDeploy the `server` app:\n1. Create a `GKE` cluster on GCP.\n2. Create a cloud build trigger with the parameters in the [screenshot](art/servier-trigger.jpg) (change the `_REGION_NAME` to the location of the `GKE` cluster you created in step 1).\n3. Connect to the `GKE` cluster using `gcloud container clusters get-credentials prod` and then create a `tiler` using the commands:\n 1. `kubectl create serviceaccount --namespace kube-system tiller`\n 2. `kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller`\n 3. `kubectl patch deploy --namespace kube-system tiller-deploy -p '{\"spec\":{\"template\":{\"spec\":{\"serviceAccount\":\"tiller\"}}}}'`\n 4. `helm init --service-account tiller --upgrade`\n4. Then change the `helm` permissions by navigate to `server/kubernetes` in the command line and then write `kubectl apply -f helm-permissions.yaml`.\n5. Now you can deploy your `server` app by create a new tag in the `v0.0.1/prod/prod` format and push it to github (`git push --tags`).\n\nCreate a Cloud DNS record:\n1. Create a Cloud DNS record on GCP. In this record you should add an `A` record to the kubernetes cluster (the server) and place there your load balancer ip address you get in the \"Deploy the `server` app\", and a `CNAME` record to our Storage bucket (client app) [screenshot](art/cloud_dns.jpg).\n\n## Our Stack\n\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n* [Angular](https://angular.io/)\n* [Sanic](https://www.djangoproject.com/)\n* [PostgreSQL](https://sanic.readthedocs.io)\n=======\n* [Angular 2.3](https://angular.io/)\n* [Django 1.10.5](https://www.djangoproject.com/)\n* [PostgreSQL](http://www.postgresql.org/)\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e b72a69f (Update dependencies (#20))\n* [Docker](https://www.docker.com/)\n\n**Tools we use**\n\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n  * [Angular Material](https://material.angular.io)\n  * [ngrx](https://github.com/ngrx)\n  * [Peewee](http://docs.peewee-orm.com)\n  * [Kubernetes](https://kubernetes.io)\n  * [Travis-CI](https://travis-ci.org)\n  * [Codecov](https://codecov.io)\n\n## Tests\n\nThere is already tests for the `server` and the `client`, we currently at **+90** percent coverage.\n\nTo run the `client` tests and lint run the commands below in the `client` directory.\n\n```\nnpm run lint\nnpm run test\n```\n\nTo run the `server` tests and lint run the commands below in the `server` directory.\n\n```\npycodestyle --show-source --max-line-length=120 --show-pep8 .\npython manage.py test\n```\n\n## Load Tests\n\nWe also write some tests for doing load test with [locust](http://locust.io/), you can find it under `server/locustfile.py`.\n\nTo do a load test just install locust (it's in the `requirements.txt` file) go to `server` directory and run\n\n```\nlocust --host=http://localhost\n```\n\nThen open up Locust’s web interface [http://localhost:8089](http://localhost:8089).\n\n## Rolling Updates\n\nTo update any of the containers that are in a service with a new image just create a new image, for example\n\n```\ndocker build -t server:v2 .\n```\n\nAnd then update the service with the new image\n\n```\ndocker service update --image server:v2 prod_server\n```\n\n## Database Backups\n\nEach day a backup of the PostgreSQL database will be created. The daily backups are rotated weekly, so maximum 7 backup files will be at the daily directory at once.\n\nEach Saturday morning a weekly backup will be created at the weekly directory. The weekly backups are rotated on a 5 week cycle.\n\nEach month at the 1st of the month a monthly backup will be created at the monthly directory. Monthly backups are **NOT** rotated\n\nThe backups are saved at `/var/backups/postgres` at the host machine via a shared volume. It can be configured in the `docker-compose.yml` at `volumes` section of the `database` service.\n=======\n  * [Angular Material](https://material.angular.io/)\n  * [ngrx](https://github.com/ngrx)\n  * [Django REST framework](http://www.django-rest-framework.org/)\n  * [kubernetes](https://kubernetes.io/)\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e b72a69f (Update dependencies (#20))\n\n## Contribute\n\nJust fork and do a pull request (;\n\n[license-image]: https://img.shields.io/badge/license-ISC-blue.svg\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n[license-url]: https://github.com/nirgn975/Angular-Django-Seed-Project/blob/master/LICENSE\n[github-image]: https://img.shields.io/github/release/nirgn975/Angular-Django-Seed-Project.svg\n[github-url]: https://github.com/nirgn975/Angular-Django-Seed-Project/releases\n[travis-image]: https://travis-ci.org/nirgn975/Angular-Django-Seed-Project.svg?branch=master\n[travis-url]: https://travis-ci.org/nirgn975/Angular-Django-Seed-Project\n[codecov-image]: https://codecov.io/gh/nirgn975/Angular-Django-Seed-Project/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/nirgn975/Angular-Django-Seed-Project\n[dependencyci-image]: https://dependencyci.com/github/nirgn975/Angular-Django-Seed-Project/badge\n[dependencyci-url]: https://dependencyci.com/github/nirgn975/Angular-Django-Seed-Project\n[codacy-image]: https://api.codacy.com/project/badge/Grade/cdf4939e98804872b377a4120a4f4571\n[codacy-url]: https://www.codacy.com/app/nirgn975/Angular-Django-Seed-Project?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=nirgn975/Angular-Django-Seed-Project\u0026amp;utm_campaign=Badge_Grade\n[maintenance-image]: https://img.shields.io/maintenance/yes/2019.svg\n[maintenance-url]: https://github.com/nirgn975\n[donate-image]: https://img.shields.io/badge/PayPal-Donate-lightgrey.svg\n=======\n[license-url]: https://github.com/nirgn975/Angular2-Django-cluster/blob/master/LICENSE\n[travis-image]: https://travis-ci.org/nirgn975/Angular2-Django-cluster.svg?branch=master\n[travis-url]: https://travis-ci.org/nirgn975/Angular2-Django-cluster\n[codecov-image]: https://codecov.io/gh/nirgn975/Angular2-Django-cluster/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/nirgn975/Angular2-Django-cluster\n[python3-image]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/python-3-shield.svg\n[python3-url]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/\n[updates-image]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/shield.svg\n[updates-url]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/\n[dependencyci-image]: https://dependencyci.com/github/nirgn975/Angular2-Django-cluster/badge\n[dependencyci-url]: https://dependencyci.com/github/nirgn975/Angular2-Django-cluster\n[donate-image]: https://img.shields.io/badge/Donate-PayPal-lightgrey.svg\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e b72a69f (Update dependencies (#20))\n[donate-url]: https://www.paypal.me/nirgn/2\n","funding_links":["https://www.paypal.me/nirgn/2"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirgn975%2Fangular-sanic-seed-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirgn975%2Fangular-sanic-seed-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirgn975%2Fangular-sanic-seed-project/lists"}