Skip to content

Base Services for Drift micro-framework.

License

Notifications You must be signed in to change notification settings

directivegames/drift-base

This branch is 1092 commits ahead of dgnorth/drift-base:develop.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ea38840 · Feb 21, 2025
Jun 13, 2024
Mar 1, 2023
May 21, 2020
Feb 20, 2025
Jan 14, 2025
Aug 15, 2023
Jan 14, 2025
Apr 5, 2017
Nov 7, 2022
May 10, 2023
Feb 9, 2022
Aug 13, 2024
Sep 20, 2024
Feb 8, 2025
Apr 8, 2021
Sep 24, 2016
Mar 28, 2020
May 27, 2024
Feb 21, 2025
May 6, 2020
Sep 24, 2016
Jun 8, 2023
Jun 13, 2024
Mar 6, 2024
May 21, 2020
Oct 25, 2018
Feb 8, 2025
Feb 8, 2025
Oct 6, 2018
Mar 21, 2020
Sep 6, 2022

Repository files navigation

Build Status codecov

drift-base

Base Services for Drift micro-framework.

Installation:

Run the following commands to install this project in developer mode:

pipx install poetry
pipx inject poetry poetry-plugin-export
pipx inject poetry poetry-plugin-shell
poetry install --sync --no-root

Run the following commands to enable drift and drift-config in developer mode for this project:

poetry shell  # Make sure the virtualenv is active

pip install -e "../drift[aws,test]"
pip install -e "../drift-config[s3-backend,redis-backend]"

Run localserver

This starts a server on port 10080:

poetry shell  # Make sure the virtualenv is active

make run-flask

Try it out here: http://localhost:10080/

Running Tests

  1. Launch the backend
  2. Add pycharm test config
  3. (Windows only) Install atomicwrites

The backend needs to be up and running in order to run the tests successfully. Run the following command from WSL from the project root to get postgres & redis up and running:

poetry shell  # Make sure the virtualenv is active

make run-backend

Tests that are run need to have the following environment variable set in the pycharm run/debug config:

DRIFT_APP_ROOT=C:\path_to\project_root  # replace with proper path

If on Windows, then you might also need to install the atomicwrites package for the python interperater used by the environment.

Modifying library dependencies

Python package dependencies are maintained in pyproject.toml. If you make any changes there, update the poetry.lock file as well using the following command:

poetry lock

Working with AWS

Note! For any of the following commands to work, make sure the virtualenv is active and the proper configuration database and tier is selected:

poetry shell
export DRIFT_CONFIG_URL=somecfg && export DRIFT_TIER=SOME_NAME

Building drift-base

Drift-base runs in docker. To build and push a docker image run the following:

make build
make push

This will create a docker image called directivegames/drift-base:<branch-name> and push it to dockerhub here: https://hub.docker.com/repository/docker/directivegames/drift-base/tags?page=1

You can run the container locally with the following command:

make run

Note that you must have the following environment variables set up: DRIFT_TIER and DRIFT_CONFIG_URL. See example.env.

drift-base docker images are automatically built by GutHub Actions on all branches and tagged by the branch name. If any git tag is pushed, a docker image will be built with that tag as well.

Versioned images are created in this way. Simply add a version tag to git and an image with correct version will be built. Any image built after this version tag push will export the same version in its root endpoint.

Note that new tags should only be created on the master branch, or a support/M.m branch for previous Major.minor support versions.

To create a new version of drift-base run:

git tag 1.2.3
git push --tags

About

Base Services for Drift micro-framework.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.9%
  • Other 1.1%