Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
cloud: update procedure to work with Heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat committed Nov 7, 2016
1 parent fff581f commit 457c172
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 60 deletions.
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ module.exports = function(grunt) {
'clean:dist',
'bower:install',
'build',
'test',
'useminPrepare',
'imagemin',
'svgmin',
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ The full documentation is available on [ReadTheDocs][].
[ReadTheDocs]: http://dashkiosk.readthedocs.io

A live installation, reset every hour, is publicly available:
- [administration panel](http://dashkiosk.app.exo.io/admin)
- [receiver](http://dashkiosk.app.exo.io/receiver)
- [administration panel](http://dashkiosk-demo.herokuapp.com/admin)
- [receiver](http://dashkiosk-demo.herokuapp.com/receiver)

Here is a demonstration video:

Expand Down
84 changes: 31 additions & 53 deletions docs/cloud.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ Cloud install
You can run *Dashkiosk* on a PaaS like `Heroku`_ or `Dokku`_. The
Chromecast support is unlikely to work in this case but the remaining
functionalities should work without any problem. The following
documentation is done using `exoscale PaaS`_ (a Swiss cloud
provider). The process should be quite similar with another provider.
documentation is done using `Heroku`_. The process should be quite
similar with another provider.

We assume that you already have an account registered on
`exoscale`_. It comes with a free trial which should be sufficient to
`Heroku`_. It comes with a free tier which should be sufficient to
test *Dashkiosk*.

Deployment tool installation
------------------------------

The first step is to install the deployment tool. For *exoscale*, this
is done with ``pip``::

$ sudo easy_install pip
$ sudo pip install -U cctrl

You should get an ``exoapp`` command. You need to add your SSH key with ``exouser key.add``.
The first step is to install the deployment tool. For *Heroku*, follow
the `install documentation`_.

Create the application
----------------------
Expand All @@ -31,17 +26,16 @@ purpose, a modified buildpack needs to be used as *Dashkiosk* is using

$ git clone https://github.com/vincentbernat/dashkiosk.git
$ cd dashkiosk
$ exoapp dashkiosk4mycompany create \
--buildpack https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt.git \
custom
$ heroku create
$ heroku config:set NPM_CONFIG_PRODUCTION=false

You can then push the application::

You'll have to replace ``dashkiosk4mycompany`` by another name. You
can then build the application with the ``push`` command::
$ git push heroku master

$ exoapp dashkiosk4mycompany push
If you want a custom branding, you have to use the following command::

If you want a custom branding, you have to modify ``Gruntfile.js`` to
change the default branding at the top of the file.
$ heroku config:set branding=exoscale

Configure a database
---------------------
Expand All @@ -50,62 +44,46 @@ By default, *Dashkiosk* will use an SQLite database. However, with a
PaaS, this means that the database will be lost at each deployment. It
is therefore more convenient to use a MySQL database::

$ exoapp dashkiosk4mycompany addon.add mysqls.tiny
$ exoapp dashkiosk4mycompany addon mysqls.tiny
Addon : mysqls.tiny
Settings
MYSQLS_DATABASE : aepfx9trwgz
MYSQLS_HOSTNAME : mysql.app.exo.io
MYSQLS_PORT : 3306
MYSQLS_PASSWORD : CfWYSgV841jS
MYSQLS_USERNAME : aepfx9trwgz

All those settings are available through environment variables of the
same name. Unfortunately, *Dashkiosk* won't use them. It is also
$ heroku addons:create heroku-postgresql:hobby-dev
$ heroku pg:wait
$ heroku config -s | grep HEROKU_POSTGRESQL
HEROKU_POSTGRESQL_RED_URL=postgres://user3123:passkja83kd8@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398

The settings are available through environment
variables. Unfortunately, *Dashkiosk* won't use them. It is also
possible to put them into a credential file but *Dashkiosk* won't know
how to use them either.

The easiest way is to arrange for those settings to be available as
environment variables under the right name::

$ exoapp dashkiosk4mycompany config.add \
db__database=aepfx9trwgz \
db__username=aepfx9trwgz \
db__password=CfWYSgV841jS \
db__options__dialect=mysql \
db__options__host=mysql.app.exo.io
$ exoapp dashkiosk4mycompany config.add SET_ENV_VARS=true

The last command ensures that the configuration variables are
available in the program environment. *Dashkiosk* will take them from
here.
$ heroku config:set db__options__dialect=postgres
$ heroku config:set db__options__host=ec2-117-21-174-214.compute-1.amazonaws.com
$ heroku config:set db__options__port=6212
$ heroku config:set db__database=db982398
$ heroku config:set db__username=user3123
$ heroku config:set db__password=passkja83kd8

Deploy the application
-------------------------

The application can now be deployed::

$ exoapp dashkiosk4mycompany deploy
$ git push heroku master

If you get a problem, use the log subcommand::

$ exoapp dashkiosk4mycompany log error
$ exoapp dashkiosk4mycompany log access
$ heroku logs --tail

Upgrading
---------

Upgrading is just a matter of pulling new changes, pushing them to the
PaaS and deploy the result::
Upgrading is just a matter of pulling new changes and pushing them to the
PaaS::

$ git pull
$ exoapp dashkiosk4mycompany push
$ exoapp dashkiosk4mycompany deploy

The result should be visible at http://dashkiosk4mycompany.app.exo.io.
$ git push heroku master

.. _Heroku: https://www.heroku.com/
.. _Dokku: https://github.com/progrium/dokku
.. _exoscale PaaS: https://www.exoscale.ch/add-on/paas/
.. _exoscale: https://www.exoscale.ch/
.. _install documentation: https://devcenter.heroku.com/articles/heroku-command-line#download-and-install
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Here is a demonstration video:
To contribute, use `GitHub`_.

.. _GitHub: https://github.com/vincentbernat/dashkiosk/
.. _administration panel: http://dashkiosk.app.exo.io/admin
.. _receiver: http://dashkiosk.app.exo.io/receiver
.. _administration panel: http://dashkiosk-demo.herokuapp.com/admin
.. _receiver: http://dashkiosk-demo.herokuapp.com/receiver

.. toctree::
:maxdepth: 2
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"dashkiosk": "./server.js"
},
"scripts": {
"postinstall": "grunt dist",
"start": "node dist/forever.js dist/server.js --port $PORT",
"test": "grunt test"
},
"repository": {
Expand Down Expand Up @@ -47,6 +49,7 @@
"blanket": "~1.2.0",
"connect-livereload": "~0.5.3",
"grunt": "~0.4.2",
"grunt-cli": "~0.1.13",
"grunt-angular-templates": "~0.5.3",
"grunt-autoprefixer": "~3.0.3",
"grunt-bower-task": "~0.4.0",
Expand Down Expand Up @@ -84,6 +87,6 @@
"time-grunt": "~1.2.1"
},
"engines": {
"node": "4.2.x || 4.1.x || 0.12.x"
"node": "6.9.x || 4.2.x || 4.1.x || 0.12.x"
}
}

0 comments on commit 457c172

Please sign in to comment.