# para saber sua tag:
make get_last_tag ENV=DEV
# para fazer o deploy
make gcp_deploy_dev TAG=XXX
se for desenvolvimento local, entre na pasta de dev e use o makefile dentro desta pasta
This is an implementation of a database as a service api written in python + django. It will try to follow some hypermedia concepts throughout the api calls.
Below: Screenshot from the admin user.
image 1: Listing databases and their summary information.
image 2: example database view and all its credentials.
DBaaS requires the following:
- python >= 2.7.5
- virtualenv >= 1.7.2
- virtualenvwrapper >= 3.5
- mysql server and client, version 5.5.x
- mongo client = 2.4 (used by the clone feature)
- redis (broker for async tasks with celery)
- and all packages in requirements.txt file (there is a shortcut to install them)
- Install Docker and Docker Compose
Go to the project path and run these following commands:
# create python container
$make dev_docker_build
$make dev_docker_setup [optional_mysql_dump_file_path]
$make dev_docker_migrate
$make dev_docker_run
To generate a migration, you should run:
$make dev_docker_generate_migration app=my_app
And then, to apply the changes to the bank:
$make dev_docker_migrate
You can explore spacific docker settings in this link
mkvirtualenv dbaas
workon dbaas
Install the required python packages by:
make pip
Database setup for migrations:
-
Connect to the local database.
mysql -u root -p <GENERATED-PASSWORD>
-
Change root password to an empty string.
ALTER USER 'root'@'localhost' IDENTIFIED BY '';
-
Create
dbaas
database.CREATE DATABASE dbaas;
Run migrations to mysql database:
make run_migrate
Install redis and start celery:
make run_celery
Create the tables structure (see the next item)
DBaaS uses south to maintain the migrations up-to-date. However, you can just run syncdb to create the table structures. There is a shortcut to help you with that, including some minimum operational data on DB.
make reset_data
make pip && make test
make docker_build && make test_with_docker
make run
In your browser open the URL: http://localhost:8000/admin/
To run celery locally use the following command:
cd {APP DIR}
make run_celery
Listed below are some articles that describe details associated with this project.
This guide will help you to understand the basic DBaaS architecture.
The running instructions in the execution order.
The documentation of API which allows you to maintain yours databases.
About drivers used to support to new databases.
Guide to avoid usual problems.
Guide to use this project with containers.
This project is licensed under the BSD 3-Clause "New" or "Revised" License - read LICENSE file for details.