Skip to content

Commit 7265cf2

Browse files
author
stanislav-web
committed
[build] #16 add documentation
1 parent 65dca7e commit 7265cf2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+113
-181
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
### PyRuc is the service for maintaining user accounts (UAC)
1+
### PyRuc (Python Redis Users Controller)
2+
PyRuc is the service for maintaining new and existing users accounts
3+
24
[![Coverage Status](https://coveralls.io/repos/github/stanislav-web/PyRuc/badge.svg?branch=master)](https://coveralls.io/github/stanislav-web/PyRuc?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/810e623b6db74357ba10915f4247aa6d)](https://www.codacy.com/app/stanisov/PyRuc?utm_source=github.com&utm_medium=referral&utm_content=stanislav-web/PyRuc&utm_campaign=Badge_Grade) [![GitHub license](https://img.shields.io/github/license/stanislav-web/PyRuc.svg)](https://github.com/stanislav-web/PyRuc/blob/master/LICENSE)
35

46
| Python | Status |
@@ -20,36 +22,44 @@
2022
- Gevent as default async worker for Gunicorn
2123
- Python flask
2224
- Twilio SMS notifier
23-
- ELK client for as log transport
25+
- Logstash client as logs filter to Elastic
2426
- JWT authentication
2527
- Redis as persistent user's storage
2628

29+
##### Configuration
30+
```bash
31+
/app/env/development.env
32+
/app/env/production.env
33+
```
34+
You also could setup your build out of the docker container.
35+
Please install `dotenv` pip package for realize your custom environments
36+
2737
##### Installation
2838
- Docker
2939
```bash
3040

3141
# ENV development: using /app/env/development.env
32-
docker-compose --file docker-compose.dev.yml up --build
42+
> docker-compose --file docker-compose.dev.yml up --build
3343

3444
# ENV production: using /app/env/production.env
35-
docker-compose --file docker-compose.prod.yml up --build
36-
45+
> docker-compose --file docker-compose.prod.yml up --build
3746
```
3847
- Manualy & Run
3948
```bash
40-
pip install -r requirements.txt
41-
gunicorn -c config.py server --reload
49+
> cd app
50+
> pip install -r requirements.txt
51+
> gunicorn -c config.py server --reload
4252
```
53+
4354
##### Try API
4455
[http://drunk-start.surge.sh](http://drunk-start.surge.sh)
4556

46-
4757
##### Diagrams
4858
![Registration](images/registration.png)
4959
![Authentication](images/authentication.png)
5060
![Restore](images/restore.png)
5161

5262
#### Tests
5363
```bash
54-
cd app && coverage run setup.py test
55-
```
64+
> cd app && coverage run setup.py test
65+
```

app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis User Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.

app/env/production.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ SERVER_PORT=5001
2020

2121
REDIS_HOST=redis
2222
REDIS_PORT=6379
23-
REDIS_PASSWORD=d70e25e734dedbd1ca52fe81459b23af88f82819d06a823e07a79a86955e8ac8
2423
REDIS_DBNO=1
24+
REDIS_PASSWORD=d70e25e734dedbd1ca52fe81459b23af88f82819d06a823e07a79a86955e8ac8
2525
REDIS_SOCKET_TIMEOUT=10
2626
REDIS_SOCKET_CONNECT_TIMEOUT=3
2727
REDIS_MAX_CONNECTIONS=3

app/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
""" PyRuc-UAC-SERVICE
4+
""" PyRuc-Python Redis Users Controller
55
Copyright (C) 2007 Free Software Foundation, Inc.
66
Everyone is permitted to copy and distribute verbatim copies of this license document,
77
but changing it is not allowed.

app/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
""" PyRuc-UAC-SERVICE
4+
""" PyRuc-Python Redis Users Controller
55
Copyright (C) 2007 Free Software Foundation, Inc.
66
Everyone is permitted to copy and distribute verbatim copies of this license document,
77
but changing it is not allowed.

app/src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis Users Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.

app/src/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis Users Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.
@@ -23,7 +23,11 @@
2323
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
2424
logger = logging.getLogger(config.APPLICATION)
2525
logger.setLevel(config.APPLICATION_LOG_LEVEL)
26-
logger.addHandler(logstash.TCPLogstashHandler(config.LOGSTASH_HOST, config.LOGSTASH_PORT, version=1))
26+
logger.addHandler(logstash.TCPLogstashHandler(config.LOGSTASH_HOST,
27+
config.LOGSTASH_PORT,
28+
message_type=config.LOGSTASH_NODENAME,
29+
fqdn=True,
30+
version=1))
2731

2832
try:
2933
application = Flask(config.APPLICATION)

app/src/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis Users Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.
@@ -18,4 +18,5 @@
1818
APPLICATION_LIMIT_PER_MIN = os.getenv('APPLICATION_LIMIT_PER_MIN', '100000 per minute')
1919
APPLICATION_LIMIT_STORAGE_URI = os.getenv('APPLICATION_LIMIT_STORAGE_URI', 'redis://127.0.0.1:6379')
2020
LOGSTASH_HOST = os.getenv('LOGSTASH_HOST', '127.0.0.1')
21-
LOGSTASH_PORT = os.getenv('LOGSTASH_PORT', 6000)
21+
LOGSTASH_PORT = int(os.getenv('LOGSTASH_PORT', 6000))
22+
LOGSTASH_NODENAME = os.getenv('LOGSTASH_NODENAME', 'pyruc')

app/src/modules/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis Users Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.

app/src/modules/mod_authentication/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
""" PyRuc-UAC-SERVICE
3+
""" PyRuc-Python Redis Users Controller
44
Copyright (C) 2007 Free Software Foundation, Inc.
55
Everyone is permitted to copy and distribute verbatim copies of this license document,
66
but changing it is not allowed.

0 commit comments

Comments
 (0)