Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.
/ spartan Public archive

Spartan is a sports tracker for strength and GPS based activities.

Notifications You must be signed in to change notification settings

podusowski/spartan

Repository files navigation

Spartan

Personal activity tracker for both strength and cardio (GPS tracked) excercises.

Live version is here: http://145.239.84.96 (I couldn't find any cool domain, sorry :))

Deployment and development

Spartan is built into single Docker image which serve the application and static files on port 8000. There is also a Makefile for common tasks so you won't need to remember all those docker parameters. Obviously you need to have Docker installed. On newest Ubuntu you can do this through sudo apt install docker.io.

Tests

Spartan has two level of testing. Unit tests lives near application modules, eg training/tests/test_hexagons.py while higher level testing are in global tests directory.

All of them are managed by pytest which is integrated with django. The easiest way to run them is to use make test as it will handle all docker stuff.

How to run locally

You can start debug server using docker-compose:

docker-compose up

It will run the same docker image that is used in production but with DEBUG environment variable passed into the container. DEBUG will change some things.

  • Python logger is set to debug level
  • SQLite is used as database, db.sqlite3 will be created in current directory

After starting, application will be available on port 8000.

Deployment

Spartan image doesn't come with the database (except the SQLite which is used only in DEBUG mode) so you have to install it manually (on your host OS or by using docker aswell - docker-compose might be usefull in this case).

When you have your database ready, you can pass its configuration though environment variables: DB_ENGINE DB_NAME DB_USER DB_PASSWORD DB_HOST. You can check django documentation to find out what to put in here.

When you have those covered, you can start the container and leave the management to Docker by using --restart always flag to run command. This way, the container will be running on your machine all the time.

At this point, you database is most likely empty so before using the application, you have to migrate the models.

[TODO]

Deployment (new)

Spartan comes with docker-compose configuration which should be preferred way to start the application.

docker-compose build
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Django models are migrated at each startup in dokcer-entrypoint.sh.

About

Spartan is a sports tracker for strength and GPS based activities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •