From 7860cbb90d6b6295a158bc15e70d1fd7a133b334 Mon Sep 17 00:00:00 2001 From: m5r Date: Sat, 23 Oct 2021 23:43:26 +0200 Subject: [PATCH] deploy redis to fly.io --- deployments/quirrel-redis/Dockerfile | 6 ++++++ deployments/quirrel-redis/fly.toml | 5 +++++ deployments/quirrel-redis/readme.md | 13 +++++++++++++ deployments/quirrel-redis/start-redis-server.sh | 4 ++++ 4 files changed, 28 insertions(+) create mode 100644 deployments/quirrel-redis/Dockerfile create mode 100644 deployments/quirrel-redis/fly.toml create mode 100644 deployments/quirrel-redis/readme.md create mode 100644 deployments/quirrel-redis/start-redis-server.sh diff --git a/deployments/quirrel-redis/Dockerfile b/deployments/quirrel-redis/Dockerfile new file mode 100644 index 0000000..728d49e --- /dev/null +++ b/deployments/quirrel-redis/Dockerfile @@ -0,0 +1,6 @@ +FROM redis:alpine + +ADD start-redis-server.sh /usr/bin/ +RUN chmod +x /usr/bin/start-redis-server.sh + +CMD ["start-redis-server.sh"] diff --git a/deployments/quirrel-redis/fly.toml b/deployments/quirrel-redis/fly.toml new file mode 100644 index 0000000..325e613 --- /dev/null +++ b/deployments/quirrel-redis/fly.toml @@ -0,0 +1,5 @@ +app = "quirrel-redis-prod" + +[[mounts]] + destination = "/data" + source = "redis_data" diff --git a/deployments/quirrel-redis/readme.md b/deployments/quirrel-redis/readme.md new file mode 100644 index 0000000..9e22725 --- /dev/null +++ b/deployments/quirrel-redis/readme.md @@ -0,0 +1,13 @@ +# Redis + +Redis instance running on fly.io + +### How to + +```shell +flyctl launch --name quirrel-redis-prod +node -e "console.log(crypto.randomBytes(16).toString('hex'))" # copy its output +flyctl secrets set REDIS_PASSWORD= # paste the 32-character long password copied previously +flyctl volumes create redis_data --region cdg +flyctl deploy +``` diff --git a/deployments/quirrel-redis/start-redis-server.sh b/deployments/quirrel-redis/start-redis-server.sh new file mode 100644 index 0000000..c963d92 --- /dev/null +++ b/deployments/quirrel-redis/start-redis-server.sh @@ -0,0 +1,4 @@ +#!/bin/sh +sysctl vm.overcommit_memory=1 +sysctl net.core.somaxconn=1024 +redis-server --requirepass $REDIS_PASSWORD --dir /data/ --appendonly yes