Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

📡 Redsmin proxy deamon - Access local redis instance from Redsmin

License

NotificationsYou must be signed in to change notification settings

Redsmin/proxy

Repository files navigation

Build StatusCoverage StatusSupportFollow

Docker HubDocker hubNPM versionDownloads

We announce changes on our Twitter account@redsmin, ourFacebook page.


Environment variables options:

  • CONFIG_FILE: configuration file to read (if any), default:/path/to/redsmin-proxy/etc/redsmin.json
  • REDIS_URI: Redis URI or socket path, defaultredis://127.0.0.1:6379
  • REDIS_AUTH: Redis authentication password, defaultnull
  • REDSMIN_KEY: your Redsmin server connection key, default''

Advanced configuration:

  • REDSMIN_PORT: where redsmin proxy should connect, default:993
  • REDSMIN_HOSTNAME: where redsmin proxy should connect, defaultssl.redsmin.com
  • DEBUG: debug mode, defaultfalse
  • PrefixREDIS_URI withrediss:// to connect to Redis using TLS encryption

Is the communication safe between my server and Redsmin? (Yes)

Yes, Redsmin and Redsmin proxy communicate through a secure connection using theTLS 1.2 protocol so no one will be able to inspect the data looking at the traffic.


How to start Redsmin proxy

Docker

Start and connect Redsmin proxy to a local Redis server

Let say you startedredis-server on your machine and then want to start redsmin-proxy from docker.If you are on MacOSX or Windows the following command won't work (if you are on Linux the following line will work):

docker run -it --rm --net=host --name redsmin-proxy -e REDSMIN_KEY=YOUR_REDSMIN_KEY -e REDIS_URI="redis://127.0.0.1:6379" redsmin/proxy

It does not work because on non-linux environment the docker daemon is running inside a VM and yourredis-server is running on your host machine, thus accessing 127.0.0.1 from the docker daemon will simply hit the VM loopback.

So we simply need to specify theHOST_IP (replace it with your own local IP, you may want to useifconfig to find it) instead of127.0.0.1:

docker run -it --rm --name redsmin-proxy -e REDSMIN_KEY=YOUR_REDSMIN_KEY -e REDIS_URI="redis://HOST_IP:6379" redsmin/proxy

On MacOSX, this should work and let redsmin-proxy connect to a Redis container on the same host:

docker run -it --rm --name redsmin-proxy -e REDSMIN_KEY=YOUR_REDSMIN_KEY -e REDIS_URI="redis://docker.for.mac.localhost:6379" redsmin/proxy

Start and connect Redsmin proxy to an network-wide available Redis
docker run -it --rm --name redsmin-proxy -e REDSMIN_KEY=YOUR_REDSMIN_KEY -e REDIS_URI="redis://192.168.3.50:6379" redsmin/proxy

Whereredis://192.168.3.50:6379 will be the ip address and port of the running Redis server andYOUR_REDSMIN_KEY is yourRedsmin key.

Start and connect Redsmin proxy to a Redis container

Let first say you've started a Redis container:

docker run --name my-redis --rm redis

You canlink redsmin proxy container to the redis one with `--link:

docker run -it --rm --name redsmin-proxy --link my-redis:local-redis -e REDSMIN_KEY=YOUR_KEY -e REDIS_URI="redis://local-redis:6379" redsmin/proxy

Docker auto-restart

If you want to leverage dockerauto-restart docker feature, use the--restart=always command.

MacOS, Debian/Ubuntu
npm install redsmin --globalREDIS_URI="redis://127.0.0.1:6379" REDSMIN_KEY="redsmin-token" redsmin

Windows (PowerShell)
npm install redsmin --global$env:REDIS_URI="redis://127.0.0.1:6379"$env:REDSMIN_KEY="redsmin-token"redsmin
Windows (CMD.exe)
npm install redsmin --globalset REDIS_URI=redis://127.0.0.1:6379set REDSMIN_KEY=redsmin-tokenredsmin

Note: don't use double quotes for values on windows (bad 🔴 :set KEY="VALUE", good ✅ :set KEY=VALUE)


How to start Redsmin proxy with a password protected redis

MacOS, Debian/Ubuntu
npm install redsmin --globalREDIS_URI="redis://127.0.0.1:6379" REDIS_AUTH="auth-pass" REDSMIN_KEY="redsmin-token" redsmin

Windows
npm install redsmin --globalset REDIS_URI=redis://127.0.0.1:6379set REDIS_AUTH=auth-passset REDSMIN_KEY=redsmin-tokenredsmin

Note: don't use double quotes for values on windows (bad 🔴 :set KEY="VALUE", good ✅ :set KEY=VALUE)


How to start Redsmin proxy with a redis listening on a unix-socket

MacOS, Debian/Ubuntu
npm install redsmin --globalREDIS_URI="/tmp/redis.sock" REDSMIN_KEY="5517e20046f4c7530d000357" redsmin

Windows
npm install redsmin --globalset REDIS_URI=/tmp/redis.sockset REDSMIN_KEY=5517e20046f4c7530d000357redsmin

Note:

  • don't use double quotes for values on windows (bad 🔴 :set KEY="VALUE", good ✅ :set KEY=VALUE)
  • you may need to usesudo to access to the socket.

How to start Redsmin proxy reading a configuration file

First create a json configuration file, for instance/etc/redsmin.json:

{"key":"redsmin-token","redis":"redis://127.0.0.1:6379","auth":""}

Then start redsmin proxy with:

MacOS, Debian/Ubuntu
CONFIG_FILE="/etc/redsmin.json" redsmin
Windows
set CONFIG_FILE="/etc/redsmin.json"redsmin

MacOS, Debian/Ubuntu
REDIS_URI="redis://127.0.0.1:6379" REDSMIN_KEY="redsmin-token1" redsmin&REDIS_URI="redis://127.0.0.1:6380" REDSMIN_KEY="redsmin-token2" redsmin&REDIS_URI="redis://127.0.0.1:6381" REDSMIN_KEY="redsmin-token3" redsmin&REDIS_URI="redis://127.0.0.1:6382" REDSMIN_KEY="redsmin-token4" redsmin&
Windows
set REDIS_URI="redis://127.0.0.1:6379"set REDSMIN_KEY=redsmin-token1START /B redsminset REDIS_URI="redis://127.0.0.1:6380"set REDSMIN_KEY=redsmin-token2START /B redsminset REDIS_URI="redis://127.0.0.1:6381"set REDSMIN_KEY=redsmin-token3START /B redsminset REDIS_URI="redis://127.0.0.1:6382"set REDSMIN_KEY=redsmin-token4START /B redsmin

Note:

  • of course we could have used multipleCONFIG_FILE instead of environment variables.

How to keep redsmin proxy up once I disconnect

With nohup

The easiest way is to usenohup that will keep redsmin-proxy running even once the SSH session is closed. Simply connect to the server that contains Redis, run the commands below, don't forget to replaceYOUR_REDSMIN_TOKEN with theREDSMIN_TOKEN you had when creating the proxy connection from Redsmin app.

echo'#!/usr/bin/env bash'>> redsmin-proxy.shecho'while true; do REDSMIN_KEY=YOUR_REDSMIN_TOKEN redsmin; sleep 1; done;'>> redsmin-proxy.shchmod +x redsmin-proxy.shnohup ./redsmin-proxy.sh&

To check that everything is alright or to debug Redsmin proxy, you can usetail -f nohup.out.

With nohup (one-liner)

nohup bash -c "while true; do REDSMIN_KEY=YOUR_REDSMIN_TOKEN redsmin; sleep 1; done" &

With screen

On MacOS, Ubuntu/Debian, the simplest way is to usescreen:

# start screenscreen# start redsmin-proxyREDIS_URI="redis://127.0.0.1:6379" REDSMIN_KEY="redsmin-token1" redsmin# Ctrl+A+D to detach from screen# and then to reattach to the screen session:screen -r

With a process manager

But you could also useUpstart,systemd,supervisord orpm2 on these system.

On Windows you will need tocreate a service or usepm2.

With Systemd

Create the service at/etc/systemd/system/redsmin.service

[Unit]Description = Redsmin ProxyAfter = network.target[Service]Type = simpleEnvironment = REDIS_URI=redis://127.0.0.1:6379 REDSMIN_KEY=your-token-hereExecStart = /usr/bin/redsmin $REDIS_URI $REDSMIN_KEYTimeoutStartSec = infinityRestart = on-abort[Install]WantedBy = multi-user.target

Reload systemd bysystemctl daemon-reload.

You can now start/stop/restart redsmin like any other systemd service, likesystemctl start redsmin.

With Supervisord

Create a config file with these contents:

[program:redsmin]command = /usr/bin/redsminautostart = trueautorestart = trueenvironment = REDIS_URI="redis://127.0.0.1:6379",REDSMIN_KEY="your-token-here"

Reload supervisord config bysupervisorctl reread && supervisorctl update

We will happily merge into this repository any pull-request describing a configuration file for any other process runner.


I'm behind a firewall, what rule should I add?

Redsmin proxy connects tossl.redsmin.com on port993 with a secureTLS socket connection. For troubleshooting:What ip/port should I locally open to use Redsmin proxy.


How to uninstall Redsmin Proxy

MacOS, Debian/Ubuntu
npm uninstall redsmin -g

Throubleshooting

Ready check failed: NOAUTH Authentication required

It means that your Redis server required a password and that no password is configured in Redsmin Proxy. To fix this start Redsmin proxy with theREDIS_AUTH environment variable.

About

📡 Redsmin proxy deamon - Access local redis instance from Redsmin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp