Configure a Dedicated Redis Port
Overview
Appcircle runners send live build logs to the Appcircle server through Redis. On an Appcircle server configured with HTTPS, Redis shares port 443 with the web services. The front proxy of the server reads the domain name of every new connection and forwards it internally, either to the web services or to Redis. This internal hop costs proxy CPU on every connection, including the web and API traffic that never goes to Redis.
You can give Redis its own port instead. Port 443 then carries only web traffic, the internal hop is removed, and the front proxy handles more traffic with the same resources.
The default configuration is suitable for most installations. Consider a dedicated Redis port when your Appcircle server handles high request volumes, for example CodePush updates rolled out to a large number of devices at the same time.
This feature is included in the Appcircle server package version 3.34.0 or later.
This page applies to Appcircle servers configured with HTTPS (external.scheme: https). With HTTP, Redis already uses its own port (6379 by default), so no change is needed.
What Changes
- Redis is served with TLS on the port you choose, using the same SSL certificate as the rest of the Appcircle server.
- Redis is no longer reachable on port
443. - Every Appcircle runner must connect to Redis on the new port.
Prerequisites
-
Choose a port that is free on the Appcircle server and allowed by your security policy. The examples on this page use
6380. -
Allow the Appcircle runners to connect directly to the Appcircle server on that port.
-
If there is no load balancer in front of the Appcircle server, allow the port in your firewall in the same way as the existing runner access to the Appcircle server.
-
If a load balancer is in front of the Appcircle server, make the
redissubdomain (for exampleredis.appcircle.spacetech.com) resolve to the IP address of the Appcircle server instead of the load balancer, and allow the runners to reach the Appcircle server on the new port in your firewall. Runners connect to Redis by this host name, so their Redis traffic goes straight to the Appcircle server while web traffic on port443keeps using the load balancer. After this change theredissubdomain is only used for Redis, so pointing it to the Appcircle server does not affect any other service.cautionIf your DNS uses a wildcard record (for example
*.appcircle.spacetech.com) that points to the load balancer, add a separate record for theredissubdomain. A specific record takes precedence over the wildcard.
-
-
If the Appcircle server uses
firewalld, open the port on the server:sudo firewall-cmd --add-port=6380/tcp --permanentsudo firewall-cmd --reload -
The SSL certificate does not change. It already covers the
redissubdomain, which the Appcircle server requires.
With rootless Podman, ports above 1024 can be published directly, so the new port does not need a port redirection like 443 does.
Configuring the Appcircle Server
Be aware that this process will cause downtime since it requires a restart of the Appcircle server.
-
Log in to your Appcircle server via SSH or a remote connection.
-
Change to the directory containing the Appcircle server configuration.
cd appcircle-server -
Open the
global.yamlfile in a text editor.infoThe
spacetechin the example codes below are example project name.Please find your own project name and replace
spacetechwith your project name.To see projects, you can check the
projectsdirectory.ls -l ./projectsvi ./projects/spacetech/global.yaml -
Add the
portkey underwebEventRedis.external.cautionIf the
webEventRedisentry already exists in yourglobal.yamlfile, for example with a customsubdomain, add theportkey to the existing entry instead of creating a new one.webEventRedis:external:port: 6380 -
After saving the configuration changes, restart your Appcircle server to apply the new settings.
- Shutdown Appcircle server.
./ac-self-hosted.sh -n "spacetech" down- Apply configuration changes.
./ac-self-hosted.sh -n "spacetech" export- Boot Appcircle server.
./ac-self-hosted.sh -n "spacetech" uptipYou should check the status of the Appcircle server after boot for any possible errors.
./ac-self-hosted.sh -n "spacetech" check
Updating the Appcircle Runners
After the Appcircle server restarts, runners that still use port 443 cannot reach Redis. Their builds keep running, but live build logs are not streamed until the runner is updated. Update every runner right after the Appcircle server.
-
On the runner machine, change to the directory of the Appcircle runner, where
appsettings.jsonis located. -
Set
ASPNETCORE_REDIS_STREAM_ENDPOINTto the Redis subdomain of your Appcircle server with the new port.echo "$(jq '.ASPNETCORE_REDIS_STREAM_ENDPOINT="redis.appcircle.spacetech.com:6380,ssl=true"' appsettings.json)" > appsettings.json -
Restart the runner service so that it uses the new endpoint.
./ac-runner service -c restartFor more details, see managing the self-hosted runner service.
If your runners are macOS virtual machines created from a base image, update appsettings.json in the base runner VM as well, so that new runner VMs use the new port. See configuring the runner service on the runner VM.
Verifying the Configuration
-
From a runner machine, check that Redis answers on the new port with TLS.
openssl s_client -connect redis.appcircle.spacetech.com:6380 -servername redis.appcircle.spacetech.com </dev/nullThe command should complete the TLS handshake and show the SSL certificate of your Appcircle server. A connection timeout usually means the port is blocked between the runner and the Appcircle server.
-
Start a build and confirm that its live logs appear on the Appcircle dashboard.
Reverting to the Default Configuration
-
Remove the
portkey underwebEventRedis.externalin theglobal.yamlfile. -
Restart your Appcircle server.
- Shutdown Appcircle server.
./ac-self-hosted.sh -n "spacetech" down- Apply configuration changes.
./ac-self-hosted.sh -n "spacetech" export- Boot Appcircle server.
./ac-self-hosted.sh -n "spacetech" uptipYou should check the status of the Appcircle server after boot for any possible errors.
./ac-self-hosted.sh -n "spacetech" check -
Set
ASPNETCORE_REDIS_STREAM_ENDPOINTback to port443on every runner and restart the runner service.echo "$(jq '.ASPNETCORE_REDIS_STREAM_ENDPOINT="redis.appcircle.spacetech.com:443,ssl=true"' appsettings.json)" > appsettings.json./ac-runner service -c restart -
If you pointed the
redissubdomain to the IP address of the Appcircle server because of a load balancer, point it back to the load balancer, since Redis is served on port443again.
The Appcircle DMZ server does not handle Redis traffic, so this configuration does not require any change on the DMZ server.
Need help?
Get help from Appcircle's support team, or see how others are using Appcircle by joining our Slack Channel.
