Tarmo - Tampere Mobilemap
- Install Docker based on your platform's instructions.
- Create a Python virtual environment and activate it.
pip install pip-toolspip-sync requirements-dev.txtpre-commit install
Use Node>=v16. See instructions for acquiring an NLS API key (in Finnish). Optionally, see instructions for acquiring a Digitransit API key if you want bus stops on your map.
- Build and start the development containers with
docker-compose -f docker-compose.dev.yml up -d - Populate the database by running
make test-all-layers. - Navigate into the
webdirectory. - Copy
.env.sampleas.envand fill your NLS API key (plus optionally Digitransit API key). - Install dependencies:
yarn
- Run the development server in localhost:3000:
yarn run start
- Install also main requirements to the same python virtual environment:
pip-sync requirements.txt requirements-dev.txtpre-commit install
- Run tests with
make pytest - Build and start the development containers with
docker-compose -f docker-compose.dev.yml up -d - Edit the lambda functions and restart the containers with
make rebuildto see the changes.
If test using pytest-docker get stuck, you can remove the dangling containers with:
docker ps --format '{{.Names}}' |grep pytest | awk '{print $1}' | xargs -I {} docker stop {}
docker ps --format '{{.Names}}' |grep pytest | awk '{print $1}' | xargs -I {} docker rm {}
docker network ls --format {{.Name}} |grep pytest | awk '{print $1}' | xargs -I {} docker network rm {}- Make sure your backend requirements are installed:
pip-sync requirements.txt requirements-dev.txt. - Add your changes to the model sql.
- Create a new database revision with
make revision name="describe your changes". This creates a new random id (uuid) for your migration, and two things in the alembic versions dir:- New revision file
uuid_your_message.py, - New revision sql directory
uuid.
- New revision file
- Add the needed difference SQL (generated e.g. manually or with pgdiff) as
upgrade.sqlinside the newuuiddirectory. - Add a
downgrade.sqlthat will cancel theupgrade.sqloperations in the same directory. - Run tests with
make pytestto check that your new model.sql, upgrade.sql and downgrade.sql run properly. - Run
make rebuildandmake test-create-dbto start development instance with the new model. - To update the database documentation to reflect the changes, install tbls and run
tbls doc --force. - Commit
model.sql, theuuid_your_message.pyfile anduuiddirectory content, as well as the documentation changes indbdocdirectory, to Github.

