Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit 4d7db97

Browse files
committed
rebase
1 parent d680f24 commit 4d7db97

30 files changed

+874
-37
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<<<<<<< HEAD
2+
=======
3+
4+
>>>>>>> b72a69f (Update dependencies (#20))
15
# Created by https://www.gitignore.io/api/python,django,node,sass,virtualenv,jetbrains
26

37
### Python ###
@@ -221,6 +225,7 @@ fabric.properties
221225
# .idea/misc.xml
222226
# *.ipr
223227

228+
<<<<<<< HEAD
224229

225230
### OSX ###
226231
*.DS_Store
@@ -246,4 +251,6 @@ Network Trash Folder
246251
Temporary Items
247252
.apdisk
248253

254+
=======
255+
>>>>>>> b72a69f (Update dependencies (#20))
249256
# End of https://www.gitignore.io/api/python,django,node,sass,virtualenv,jetbrains

.travis.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
matrix:
23
include:
34
- language: python
@@ -39,3 +40,59 @@ matrix:
3940
- npm run test
4041
- npm run build
4142
- npm run e2e
43+
=======
44+
sudo: required
45+
dist: trusty
46+
47+
addons:
48+
apt:
49+
sources:
50+
- google-chrome
51+
packages:
52+
- google-chrome-stable
53+
54+
language: node_js
55+
node_js:
56+
- "6"
57+
- "7"
58+
59+
services:
60+
- postgresql
61+
62+
cache:
63+
npm: true
64+
directories:
65+
- client/node_modules
66+
67+
before_install:
68+
- npm install -g npm@latest local-web-server codecov
69+
- export CHROME_BIN=chromium-browser
70+
- export DISPLAY=:99.0
71+
- sh -e /etc/init.d/xvfb start
72+
73+
install:
74+
# Client
75+
- cd client && npm install
76+
77+
# Server
78+
- cd ../server && pip install coverage pycodestyle
79+
- pip install -r requirements.txt
80+
- psql -c 'create database server;' -U postgres
81+
82+
script:
83+
# Client
84+
- cd ../client && npm run lint
85+
- npm run test
86+
- ng build --prod --aot
87+
- cd dist && ws --port 4200&
88+
- npm run e2e
89+
90+
# Server
91+
- cd ../server && coverage run --source='.' manage.py test
92+
- coverage xml
93+
- pycodestyle --show-source --max-line-length=119 --show-pep8 .
94+
- python manage.py test
95+
96+
after_script:
97+
- cd .. && codecov
98+
>>>>>>> b72a69f (Update dependencies (#20))

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
<img src="https://raw.githubusercontent.com/nirgn975/Angular-Django-Seed-Project/master/art/angular-django-seed-project.png" />
23

34
[![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]
@@ -11,6 +12,28 @@ This repo is a production ready seed project. The app shows a list of users.
1112
* There is a `postgres` service for the database. The `database` directory contains the automatic backup script.
1213
* All the logs are going to `stdout` and can be collected through any service.
1314
* There are built in test that configured to run on `travis-ci`, and a code coverage analysis via `codecov`.
15+
=======
16+
# An opinionated Angular - Django cluster
17+
18+
[![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]
19+
20+
The `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.
21+
22+
The 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.
23+
24+
## Pre Requirements
25+
26+
1. install [docker](https://www.docker.com/).
27+
2. Don't know yet.
28+
29+
## Installation
30+
31+
Automatic installation of the project with docker, for development.
32+
33+
1. Run `$ docker-compose up` to build the docker images and run them.
34+
3. Open the browser at [http://localhost:8000](http://localhost:8000) to see your Django (server) app.
35+
3. Open the browser at [http://localhost:4200](http://localhost:4200) to see your Angular (client) app.
36+
>>>>>>> b72a69f (Update dependencies (#20))
1437
1538
The `client` app is built via the cloud build CI on GCP and deployed to the GCP `storage`.
1639
The `server` app is built via the cloud build CI as a docker image and deployed to a `GKE cluster` on GCP (managed by Kubernetes).
@@ -39,13 +62,20 @@ Create a Cloud DNS record:
3962

4063
## Our Stack
4164

65+
<<<<<<< HEAD
4266
* [Angular](https://angular.io/)
4367
* [Sanic](https://www.djangoproject.com/)
4468
* [PostgreSQL](https://sanic.readthedocs.io)
69+
=======
70+
* [Angular 2.3](https://angular.io/)
71+
* [Django 1.10.5](https://www.djangoproject.com/)
72+
* [PostgreSQL](http://www.postgresql.org/)
73+
>>>>>>> b72a69f (Update dependencies (#20))
4574
* [Docker](https://www.docker.com/)
4675

4776
**Tools we use**
4877

78+
<<<<<<< HEAD
4979
* [Angular Material](https://material.angular.io)
5080
* [ngrx](https://github.com/ngrx)
5181
* [Peewee](http://docs.peewee-orm.com)
@@ -106,12 +136,19 @@ Each Saturday morning a weekly backup will be created at the weekly directory. T
106136
Each month at the 1st of the month a monthly backup will be created at the monthly directory. Monthly backups are **NOT** rotated
107137

108138
The 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.
139+
=======
140+
* [Angular Material](https://material.angular.io/)
141+
* [ngrx](https://github.com/ngrx)
142+
* [Django REST framework](http://www.django-rest-framework.org/)
143+
* [kubernetes](https://kubernetes.io/)
144+
>>>>>>> b72a69f (Update dependencies (#20))
109145
110146
## Contribute
111147

112148
Just fork and do a pull request (;
113149

114150
[license-image]: https://img.shields.io/badge/license-ISC-blue.svg
151+
<<<<<<< HEAD
115152
[license-url]: https://github.com/nirgn975/Angular-Django-Seed-Project/blob/master/LICENSE
116153
[github-image]: https://img.shields.io/github/release/nirgn975/Angular-Django-Seed-Project.svg
117154
[github-url]: https://github.com/nirgn975/Angular-Django-Seed-Project/releases
@@ -126,4 +163,18 @@ Just fork and do a pull request (;
126163
[maintenance-image]: https://img.shields.io/maintenance/yes/2019.svg
127164
[maintenance-url]: https://github.com/nirgn975
128165
[donate-image]: https://img.shields.io/badge/PayPal-Donate-lightgrey.svg
166+
=======
167+
[license-url]: https://github.com/nirgn975/Angular2-Django-cluster/blob/master/LICENSE
168+
[travis-image]: https://travis-ci.org/nirgn975/Angular2-Django-cluster.svg?branch=master
169+
[travis-url]: https://travis-ci.org/nirgn975/Angular2-Django-cluster
170+
[codecov-image]: https://codecov.io/gh/nirgn975/Angular2-Django-cluster/branch/master/graph/badge.svg
171+
[codecov-url]: https://codecov.io/gh/nirgn975/Angular2-Django-cluster
172+
[python3-image]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/python-3-shield.svg
173+
[python3-url]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/
174+
[updates-image]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/shield.svg
175+
[updates-url]: https://pyup.io/repos/github/nirgn975/angular2-django-cluster/
176+
[dependencyci-image]: https://dependencyci.com/github/nirgn975/Angular2-Django-cluster/badge
177+
[dependencyci-url]: https://dependencyci.com/github/nirgn975/Angular2-Django-cluster
178+
[donate-image]: https://img.shields.io/badge/Donate-PayPal-lightgrey.svg
179+
>>>>>>> b72a69f (Update dependencies (#20))
129180
[donate-url]: https://www.paypal.me/nirgn/2

client/.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
7+
# dependencies
8+
/node_modules
9+
10+
# IDEs and editors
11+
/.idea
12+
.project
13+
.classpath
14+
.c9/
15+
*.launch
16+
.settings/
17+
18+
# IDE - VSCode
19+
.vscode/*
20+
!.vscode/settings.json
21+
!.vscode/tasks.json
22+
!.vscode/launch.json
23+
!.vscode/extensions.json
24+
25+
# misc
26+
/.sass-cache
27+
/connect.lock
28+
/coverage/*
29+
/libpeerconnection.log
30+
npm-debug.log
31+
testem.log
32+
/typings
33+
34+
# e2e
35+
/e2e/*.js
36+
/e2e/*.map
37+
38+
#System Files
39+
.DS_Store
40+
Thumbs.db

client/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# Client
22

3+
<<<<<<< HEAD
34
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.7.
5+
=======
6+
The front end (client) side of the project written in Angular, with Angular-CLI, ngrx, and material2.
7+
8+
## Prerequisites
9+
>>>>>>> b72a69f (Update dependencies (#20))
410
511
## Development server
612

13+
<<<<<<< HEAD
714
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
815

916
## Code scaffolding
@@ -25,3 +32,21 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
2532
## Further help
2633

2734
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
35+
=======
36+
## Manual Installation
37+
38+
1. Run `npm install` to install dependencies
39+
2. Run `npm start` to fire up the dev server
40+
3. Open browser to [http://localhost:4200](http://localhost:4200)
41+
42+
## Tests
43+
44+
* Run `npm run lint` to check for TSLint mistakes
45+
* Run `npm test` to execute the unit tests via Karma
46+
* Run `npm run e2e` to execute the end-to-end tests via Protractor
47+
48+
## Deploy
49+
50+
1. Run `ng build -prod -aot` to build the project
51+
2. Run `npm run sw` to generate the service worker file (in dist directory)
52+
>>>>>>> b72a69f (Update dependencies (#20))

client/angular-cli.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.28.3",
4+
"name": "client"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": [
11+
"assets",
12+
"favicon.ico"
13+
],
14+
"index": "index.html",
15+
"main": "main.ts",
16+
"polyfills": "polyfills.ts",
17+
"test": "test.ts",
18+
"tsconfig": "tsconfig.json",
19+
"prefix": "app",
20+
"styles": [
21+
"styles.scss"
22+
],
23+
"scripts": [],
24+
"environments": {
25+
"source": "environments/environment.ts",
26+
"dev": "environments/environment.ts",
27+
"prod": "environments/environment.prod.ts"
28+
}
29+
}
30+
],
31+
"e2e": {
32+
"protractor": {
33+
"config": "./protractor.conf.js"
34+
}
35+
},
36+
"lint": [
37+
{
38+
"files": "src/**/*.ts",
39+
"project": "src/tsconfig.json"
40+
},
41+
{
42+
"files": "e2e/**/*.ts",
43+
"project": "e2e/tsconfig.json"
44+
}
45+
],
46+
"test": {
47+
"karma": {
48+
"config": "./karma.conf.js"
49+
}
50+
},
51+
"defaults": {
52+
"styleExt": "scss",
53+
"prefixInterfaces": false,
54+
"inline": {
55+
"style": false,
56+
"template": false
57+
},
58+
"spec": {
59+
"class": false,
60+
"component": true,
61+
"directive": true,
62+
"module": false,
63+
"pipe": true,
64+
"service": true
65+
}
66+
}
67+
}

client/e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { ClientPage } from './app.po';
2+
3+
describe('client App', function() {
4+
let page: ClientPage;
5+
6+
beforeEach(() => {
7+
page = new ClientPage();
8+
});
9+
10+
it('should display message saying app works', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('app works!');
13+
});
14+
});

client/e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, element, by } from 'protractor';
2+
3+
export class ClientPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

client/karma.conf.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,38 @@ module.exports = function (config) {
1212
require('karma-coverage-istanbul-reporter'),
1313
require('@angular-devkit/build-angular/plugins/karma')
1414
],
15+
<<<<<<< HEAD
1516
client: {
1617
clearContext: false // leave Jasmine Spec Runner output visible in browser
18+
=======
19+
files: [
20+
{ pattern: './src/test.ts', watched: false }
21+
],
22+
preprocessors: {
23+
'./src/test.ts': ['angular-cli']
24+
},
25+
mime: {
26+
'text/x-typescript': ['ts','tsx']
27+
},
28+
remapIstanbulReporter: {
29+
reports: {
30+
html: 'coverage',
31+
lcovonly: './coverage/coverage.lcov'
32+
}
33+
>>>>>>> b72a69f (Update dependencies (#20))
1734
},
1835
coverageIstanbulReporter: {
1936
dir: require('path').join(__dirname, './coverage/client'),
2037
reports: ['html', 'lcovonly', 'text-summary'],
2138
fixWebpackSourcePaths: true
2239
},
40+
<<<<<<< HEAD
2341
reporters: ['progress', 'kjhtml'],
42+
=======
43+
reporters: config.angularCli && config.angularCli.codeCoverage
44+
? ['progress', 'karma-remap-istanbul']
45+
: ['progress'],
46+
>>>>>>> b72a69f (Update dependencies (#20))
2447
port: 9876,
2548
colors: true,
2649
logLevel: config.LOG_INFO,

0 commit comments

Comments
 (0)