Tag Archives: #aws

Setting up Redis Stack on AWS Lightsail using Docker

I’ve been using Bitnami’s redis server on the default NodeJS instance on Lightsail but unfortunately, it’s not the full stack so it’s missing GEO, JSON and full text search support which is a bit of a bummer. So, to solve that problem I decided to see if I could setup Redis Stack using docker on a Lightsail instance. I decided not to use LS container support as I can get an 8GB instance for $40/month, vs. a similar container instance at $100/month.

Redis Stack Cloud on us-west-2 for 5GB of RAM runs $105/month (as of April ’23) without HA.

To start, I created a Debian OS only instance and installed docker:

Install Docker Engine on Debian

Start docker at boot:

$ sudo systemctl enable docker.service
$ sudo systemctl enable containerd.service

And install docker-compose:

$ sudo apt install docker-compose

Next, install both make and gcc to build redis-cli:

Debian Linux Install GNU GCC Compiler

Basically, use this:

$ sudo apt-get update
$ sudo apt-get install build-essential

Next, I wanted just redis-cli installed so here are the steps for building redis-cli:

Install just redis-cli on Ubuntu, Debian

$ cd /tmp
$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ cp src/redis-cli /usr/local/bin/
$ chmod 755 /usr/local/bin/redis-cli

BUT, I ran into this error running make:

Error jemalloc/jemalloc.h: No such file or directory when making Redis

…and fixed it following the instructions:

$ cd /tmp/redis-stable
$ make distclean
$ make

Next, I copied my docker-compose.yaml (see below) and redis.conf files to the instance at:


Here’s my docker-compose.yaml

version: '3'
    restart: always
    container_name: redis-stack
    command: redis-server /usr/local/etc/redis/redis.conf
    image: redis/redis-stack-server:latest
      - '6379:6379'
      - ./redis-data:/data
      - ./conf/redis/redis.conf:/usr/local/etc/redis/redis.conf

I’m not going to replicate my redis.conf file as it’s too long but I set “requirepass” with the password I’m using which is picked up by redis-server.

For redis-cli you’ll want to set REDISCLI_AUTH variable in /etc/environment:


Next, start docker and run docker-compose:

$ sudo systemctl start docker
$ sudo docker-compose up -d

Test using the CLI:

$ export REDISCLI_AUTH=<password>
$ redis-cli> ping

Update May 8, 2023
I found that the various modules included as part of Redis Stack were not loading due to my overriding redis.conf so I had to add the following to my conf file:

loadmodule /opt/redis-stack/lib/rejson.so
loadmodule /opt/redis-stack/lib/redisgraph.so
loadmodule /opt/redis-stack/lib/redistimeseries.so
loadmodule /opt/redis-stack/lib/redisbloom.so
loadmodule /opt/redis-stack/lib/redisearch.so


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]

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.