Skip to content
This repository was 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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a2fde83 · Mar 10, 2019
Feb 3, 2019
Mar 22, 2017
Feb 3, 2019
Mar 10, 2019
Mar 3, 2019
Mar 3, 2019
May 22, 2017
Mar 4, 2017
Mar 4, 2017
Jun 25, 2018
Jun 25, 2018
Feb 3, 2019
Jan 12, 2019
Mar 30, 2018
Dec 30, 2018
Dec 27, 2018
Dec 27, 2018
Dec 28, 2018
Mar 4, 2017
Sep 2, 2017
Jan 12, 2019
Dec 27, 2018
Dec 27, 2018

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.