Running Cronicle on an Amazon Lightsail Instance

I was looking for a crontab replacement with a more robust UI and stumbled into Cronicle and decided to give it a try using AWS Lightsail. These steps are really more for my own reference but I figure someone might find them useful. Getting Cronicle on Lightsail is pretty straight forward but I did run into a few things that I didn’t want to have to Google in the future.

Here are the basic steps to get a working instance of Cronicle up and running followed by the action bash commands:

  • Browse to your Lightsail console
  • Create a NodeJS instance
  • SSH into the new instance
  • Create a folder for the app
  • Install the bits
  • Setup a basic configuration
  • Configure an Apache virtual host
$ sudo mkdir /opt/bitnami/apps
$ sudo chown bitnami /opt/bitnami/apps
$ cd apps
$ cd /opt/bitnami/apps
$ mkdir cronicle
$ cd cronicle
$ curl -L https://github.com/jhuckaby/Cronicle/archive/v1.0.0.tar.gz | tar zxvf - --strip-components 1
$ npm install
$ node bin/build.js dist
$ /opt/bitnami/apps/cronicle/bin/control.sh setup
$ ./bin/control.sh start

Then, edit /opt/bitnami/apache/httpd.conf and uncomment proxy_wstunnel module which is needed because Cronicle uses websockets.

$ cd /opt/bitnami/apache/conf
$ sudo vi httpd.conf
# search for proxy_wstunnel and uncomment that line

Next, is to setup an Apache Virtual Host, credit to this SO post for a working configuration:

In /opt/bitnami/apache/conf/vhost simply create a new .conf file and add the following, note 3012 is the default port for Cronicle:

<VirtualHost *:80>
    ServerName www.example.com
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*)           ws://localhost:3012/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*)           http://localhost:3012/$1 [P,L]
</VirtualHost>

Restart Apache:

$ sudo /opt/bitnami/ctlscript.sh restart apache

You should now be able to browse to http://<instance_public_ip> and login.

I followed this up by adding an DNS A record pointing to this IP address and done.