/service-launcher

A service to help companies get support for their product or service.

Primary LanguagePython

Launcher Service

A service for companies to quickly deploy a website which can issue support tokens as part of a campaign. These tokens can be used to reward early adopters and supporters of the product or service.

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-launcher --remote prod --region eu && \
heroku addons:create heroku-postgresql:hobby-dev --app service-launcher && \
heroku config:set \
    DJANGO_SECRET=`openssl rand -base64 32` \
    DJANGO_SETTINGS_MODULE="config.settings" \
    --app service-launcher
  • 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

service-launcher

Launcher Dashboard

Make sure you have nodejs and yarn or npm installed

cd launcher_dashboard

yarn install or npm install

yarn start or npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn build or npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
The app is ready to be deployed!

This project was bootstrapped with Create React App.