Some notes on how to install and configure Redis for your Glitch project.
$ wget http://download.redis.io/redis-stable.tar.gz
$ tar -xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
You can install it to the .local/bin
sub directory under your project.
# from your project directory
$ cp src/redis-cli .local/bin
$ cp src/redis-server .local/bin
$ rm -rf redis-stable*
Also, add the following to your .gitignore
.rediscli_history
We'll configure how and where data is stored.
Create a .redis
to hold Redis server configurations
$ cat > /app/.redis <<- EOM
> dir /app/.data
> appendonly yes
> daemonize yes
> EOM
/app/.data
is where Redis will write it's append fileappendonly
tells Redis to use AOF persistence which is more durable for our context (Glitch sleeps after 5mins on non activity)daemonize
runs Redis in backgroundCreate .data
directory if it doesn't already exists
$ mkdir -p /app/.data
You can start Redis manually like so
$ redis-server /app/.redis
...or start if you're using Node
{ // package.json
...
"scripts": {
"start-redis": "/app/.local/bin/redis-server /app/.redis"
"start": "npm run start-redis && ...."
}
}