Giter VIP home page Giter VIP logo

spartan's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.