OT Platform REST API 2.0.
You need:
- python 3.9.7
- postgresql server 12.9
- redis-server
- kafka 3.0.0
- JDK 11 for kafka (with jdk 8 also works)
- postgresql libraries and headers for C language backend development
yum install postgresql-server, postgresql-devel
postgresql-setup --initdb
systemctl enable postgresql.service
systemctl start postgresql.service
- Install virtual environment from requirements.txt:
python3 -m venv ./venv
source ./venv/bin/activate
pip install -r ./requirements.txt
- Create users and databases:
./docs/scripts/create_db_users.sh
./docs/scripts/create_db.sh
- Make migrations:
./docs/scripts/migrations.sh
- Create admin user:
python ./complex_rest/manage.py createsuperuser --database=auth_db
- Launch redis server:
redis-server --daemonize yes
- Launch celery workers:
./docs/scripts/start_celery.sh
- Launch kafka.
- Launch complex rest server:
source ./venv/bin/activate
python ./complex_rest/manage.py runserver [::]:8080
- Configure rest.conf:
cp ./complex_rest/rest.conf.example ./complex_rest/rest.conf
- Create virtual environment for project:
make dev
- To activate virtual environment:
source ./venv/bin/activate
- Launch services:
./start.sh
- Check
localhost:8080/admin
. Login:admin
, passwordadmin
- Use
supervisorctl
to manage services:
supervisorctl status
celery-beat RUNNING pid 74381, uptime 0:01:57
celery-worker RUNNING pid 74383, uptime 0:01:57
complex_rest RUNNING pid 74388, uptime 0:01:57
kafka RUNNING pid 75911, uptime 0:01:33
postgres RUNNING pid 74379, uptime 0:01:57
redis RUNNING pid 74380, uptime 0:01:57
zookeeper RUNNING pid 74382, uptime 0:01:57
- For testing:
make dev_test
CURRENT_UID=$(id -u):$(id -g) docker-compose -f "docker-compose-dev.yml" up -d --build
python ./complex_rest/manage.py createplugin <plugin_name>
Your plugin start template will be available in ./plugin_dev/<plugin_name>
After restarting complex_rest server open http://localhost:8080/<plugin_name>/v1/example/
You must see:
{
"message": "plugin with name <plugin_name> created successfully"
}
See creating plugin
source ./venv/bin/activate
python ./complex_rest/manage.py test ./tests/ --settings=core.settings.test
make dev_test
docker-compose -f docker-compose-dev.yml run --rm complex_rest python ./complex_rest/manage.py test ./tests --settings=core.settings.test
- Unpack tar archive to destination directory
- Make database:
./database_init.sh
- Collect static files in static directory:
./collectstatic.sh
- Run
start.sh
- Stop complex_rest
./stop.sh
- Unpack tar archive to destination directory excluding any configuration files that have been changed. Example:
tar -xzf complex_rest.tar.gz -C /opt/otp/ --exclude=complex_rest/complex_rest/rest.conf --exclude=complex_rest/complex_rest/nginx_unit.json
- Start complex rest
./start.sh
- Do migrations:
./venv/bin/python ./complex_rest/manage.py migrate --database=auth_db
./venv/bin/python ./complex_rest/manage.py migrate
- Conda
- Postgres 12.9
- Kafka 3.0.0
- Redis
- python 3.9.7 And python packages:
- Django 3.2.9
- psycopg2-binary 2.9.2
- djangorestframework 3.12.4
- pottery 2.0.0
- django-redis 5.0.0
- redis 4.0.2
- celery 5.2.1
- django-celery-beat 2.2.1
- aiokafka 0.7.2
- kafka-python 2.0.2
- supervisor 4.2.2
- django-mptt 0.13.4
- PyJWT 2.3.0
We use SemVer for versioning. For the versions available, see the tags on this repository.
See the LICENSE.md file for details