Skip to content

crintus/service-gitos

Repository files navigation

Service Gitos

A framework that can be used as a base to build service on Rehive

Prerequisites

Make sure you have the following installed

  • Docker
  • Travis CLI
  • Heroku CLI

Local setup

Create a vitual environment and activate it

If you are new to this, virtualenv with virtualenvwrapper is a straight forward and relatelive simple was to use virtual environments. The The Hitchhiker’s Guide to Python! has a nice tutorial for setting up virtualenv and virtualenvwrapper

Install requirements

pip install -r requirements.txt

Run the postgres container in the background

docker-compose up -d postgres

Run docker ps to make sure your container is running.

Migrate all the data to the database

./manage.py migrate

Setup all the static files

./manage.py collectstatic

Run the webserver to see if all is working

./manage.py runserver

Local development

Run the postgres container in the background (if not already running)

docker-compose up -d postgres

Run the webserver

./manage.py runserver

Deployments

Deployements are automated using Travis CI and Heroku. Pushes to the master branch will trigger a build via Travis. Once the build passes, Travis will deploy the branch to Heroku.

  • Make sure your project is on github
    • Add the following file, if not already on github. It is excluded in the .gitignore file by default
    git add -f config/static/api/
    
  • Sign up on (travis.org)[https://travis-ci.org/] if you repo is open source or (travis.com)[https://travis-ci.com/] for private repos
  • Sync your account
  • Turn on the switch for your repository
  • Sign up on (Heroku)[https://signup.heroku.com/]
  • Login and authenticate your heroku-cli so that you can use the heroku-cli to create our production app.
heroku login
  • Run the following command locally to initialize your project
heroku create service-gitos --remote prod --region eu && \
heroku addons:create heroku-postgresql:hobby-dev --app service-gitos && \
heroku config:set \
    DJANGO_SECRET=`openssl rand -base64 32` \
    DJANGO_SETTINGS_MODULE="config.settings" \
    --app service-gitos
  • Encrypt your Heroky credentials and allow Travis to view them for deployments
travis encrypt HEROKU_AUTH_TOKEN="$(heroku auth:token)" --add
  • Commit and push the changes to master to trigger the first build

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published