Small REST API based web application for educational purposes
The application require Python version 3.10 or older and Poetry. In order to install the application on your local machine go through the following steps:
- clone the repo using comand
git clone https://github.com/ADv0rnik/request-emulator.git
- Install and activate virtual environment. For UNIX-based systems:
python -m venv venv
source venv/bin/activate
- Run installation of dependencies
poetry install
- Run command
source aliases
- Run command
run_emulator
The docker will run the start_app.sh
script. While running the application for first time, make sure that LOAD_FIXTURE
flag is set to True
. This will allow to upload an initial data into database.
- From root directory run command
run_emulator_test
. This will execute docker compose instructions - To check test results run
show_logs
- Remove test containers by following command
stop_tests
- While on your local machine run
install-hooks.bash
script from.\scripts
directory to set up the configuration - Git will run the
pre-commit
script each time you commit some code to remote repo
Alternatively tou might create a pre-commit hook directly inside .git/hooks
directory to be triggered on commit event
- Create a PostgreSQL instance in your railway.app account.
- Copy-paste credentials from railway.app into your .env file
- Run command
alembic upgrade head
- Run command
python run_db.py
- Create an application instance (choose a GitHub Repo for deploy)
- Copy and paste variables from .env (Note: host and port for application must be 0.0.0.0 and $PORT respectively, where $PORT - name of variable)
- Deploy will run automatically triggered by applying changes