forked from amitt001/pygmy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docker-compose setup & code to support it (amitt001#31)
- Loading branch information
Showing
13 changed files
with
204 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
[](https://travis-ci.org/amitt001/pygmy) | ||
 | ||
[](https://pypi.python.org/pypi/ansicolortags/) | ||
 | ||
[](https://www.paypal.me/amit19) | ||
|
||
Live version of this project @ [https://pygy.co](https://pygy.co) | ||
|
@@ -26,6 +27,7 @@ If you would like to supprt the project, I can be contacted on my email of sourc | |
- [Use MySQL](#use-mysql) | ||
- [Use Postgresql](#use-postgresql) | ||
- [Use SQLite](#use-sqlite) | ||
- [Docker](#docker-1) | ||
- [Using Pygmy API](#using-pygmy-api) | ||
- [Create User:](#create-user) | ||
- [Shell Usage](#shell-usage) | ||
|
@@ -65,6 +67,7 @@ The architecture is very loosely coupled which allows custom integrations easily | |
- DB: PostgreSQL/MySQL/SQLite | ||
- Others: SQLAlchmey, JWT | ||
- Docker | ||
- Docker-compose | ||
|
||
## Installation/Setup | ||
|
||
|
@@ -99,6 +102,10 @@ Note: | |
|
||
## DB Setup: | ||
|
||
By default Pygmy uses SQLite but anoy of the SQLite, MySQL, PostgreSQL can be used. Configs are present on pygmy.cfg file in `pygmy/config` directory. | ||
|
||
Use db specific instruction below. Make sure to check and modify values in pygmy.cfg file according to your DB setup. | ||
|
||
### Use MySQL | ||
|
||
First install `pymysql`: | ||
|
@@ -112,8 +119,14 @@ Check correct port: | |
Change below line in `pygmy/core/pygmy.cfg`: | ||
|
||
``` | ||
[database] | ||
engine: mysql | ||
url: mysql+pymysql://root:[email protected]:3306/pygmy | ||
url: {engine}://{user}:{password}@{host}:{port}/{db_name} | ||
user: root | ||
password: root | ||
host: 127.0.0.1 | ||
port: 3306 | ||
db_name: pygmy | ||
``` | ||
|
||
Enter MySQL URL | ||
|
@@ -124,16 +137,42 @@ Note: Better using Mysql with version > `5.6.5` to use default value of `CURRENT | |
|
||
### Use Postgresql | ||
|
||
`pip install psycopg2` | ||
Change below line in `pygmy/core/pygmy.cfg`: | ||
|
||
`postgres://[email protected]:5432/pygmy` | ||
``` | ||
[database] | ||
engine: postgresql | ||
url: {engine}://{user}:{password}@{host}:{port}/{db_name} | ||
user: root | ||
password: root | ||
host: 127.0.0.1 | ||
port: 5432 | ||
db_name: pygmy | ||
``` | ||
|
||
### Use SQLite | ||
|
||
SQLite is natively supported in Python | ||
|
||
`sqlite:////var/lib/pygmy/pygmy.db` | ||
|
||
``` | ||
[database] | ||
engine: sqlite3 | ||
sqlite_data_dir: data | ||
sqlite_db_file_name: pygmy.db | ||
``` | ||
|
||
## Docker | ||
|
||
Docker image name: amit19/pygmy | ||
|
||
Docker image can be build by: `docker build -t amit19/pygmy .` | ||
|
||
Both Dockerfile and docker-compose file are preset at the root of the project. | ||
|
||
To use docker-compose you need to pass DB credentials in docker-compose file | ||
|
||
## Using Pygmy API | ||
|
||
## Create User: | ||
|
@@ -263,7 +302,7 @@ See coverage report(Coverage is bad because the coverage for integration tests i | |
Thanks [batarian71](https://github.com/batarian71) for providing the logo icon. | ||
|
||
## Donations | ||
If this project help you reduce time to develop, you can buy me a cup of coffee :) | ||
If this project help you reduce time to develop, you can help me keep this project running by donating any amount you see fit :) | ||
|
||
[](https://www.paypal.me/amit19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
database: | ||
image: postgres:11 | ||
restart: always | ||
ports: | ||
- "5433:5432" | ||
volumes: | ||
- pgdata:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_PASSWORD: root | ||
POSTGRES_USER: root | ||
POSTGRES_DB: pygmy | ||
|
||
pygmy: | ||
image: pygmy:develop | ||
restart: always | ||
build: . | ||
# ports: | ||
# - "9119:9119" | ||
links: | ||
- database | ||
environment: | ||
- DB_PASSWORD=root | ||
- DB_USER=root | ||
- DB_NAME=pygmy | ||
- DB_HOST=database | ||
- DB_PORT=5432 | ||
volumes: | ||
- .:/pygmy | ||
command: gunicorn --log-file /var/log/pygmy/error_logs.log --access-logfile /var/log/pygmy/acclogs.log --log-level DEBUG --bind 0.0.0.0:9119 --workers 2 pygmy.rest.wsgi:app | ||
depends_on: | ||
- database | ||
|
||
pygmyui: | ||
image: pygmy:develop | ||
restart: always | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
links: | ||
- pygmy | ||
environment: | ||
- PYGMY_API_ADDRESS=pygmy | ||
command: sh -c "cd pygmyui && gunicorn --log-file /var/log/pygmy/uierror_logs.log --access-logfile /var/log/pygmy/uiacclogs.log --bind 0.0.0.0:8000 --workers 2 pygmyui.wsgi && cd .." | ||
depends_on: | ||
- pygmy | ||
|
||
volumes: | ||
pgdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,15 +8,19 @@ short_url = 127.0.0.1 | |
short_url_schema = http:// | ||
|
||
[database] | ||
file_name: pygmy.db | ||
# Engone can be sqlite3, postgresql, mysql | ||
engine: sqlite3 | ||
data_dir = data | ||
# url: postgres://[email protected]:5432/pygmy | ||
# mysql+pymysql://root:[email protected]:3306/pygmy | ||
user: | ||
password: | ||
host: | ||
port: | ||
# Only required if engine is sqlite3 | ||
sqlite_data_dir: data | ||
sqlite_db_file_name: pygmy.db | ||
url: {engine}://{user}:{password}@{host}:{port}/{db_name} | ||
# NOTE: Modify these fields according to your DB | ||
user: root | ||
password: root | ||
host: 127.0.0.1 | ||
# Mysql default port is 3306 | ||
port: 5432 | ||
db_name: pygmy | ||
|
||
[auth] | ||
refresh_secret = _))_((*REFRESH)(*_)+_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ short_url = 127.0.0.1 | |
short_url_schema = http:// | ||
|
||
[database] | ||
file_name: pygmy_test.db | ||
sqlite_db_file_name: pygmy_test.db | ||
engine: sqlite3 | ||
data_dir = data | ||
sqlite_data_dir = data | ||
# url: postgres://[email protected]:5432/pygmy | ||
# sqlite:////var/lib/pygmy/pygmy.db | ||
# mysql+pymysql://root:[email protected]:3306/pygmy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.