I couldn’t find a complete example of running typesense internally which only supports ipv4. This example works so far and passed ipv6 to ipv4. I’m pretty new at this so if there is a glaring mistake let me know. I am able to connect from another app via the typesense python client. This is just to run a single server but if you are doing more you could probably figure it out.
- Set app name of internal typesense app and volume name for typesense data in fly.toml
- Set TYPESENSE_API_KEY environment variable for the typesense internal app using `flyctl secrets set -a the-name-of-your-fly-app TYPESENSE_API_KEY=yourapikey
- Set appropriate version of typesense docker image to use in Dockerfile, ie.
FROM typesense/typesense:0.24.0.rcn21
Dockerfile
FROM typesense/typesense:0.24.0.rcn21
RUN apt-get update && apt-get install -y supervisor socat
RUN mkdir -p /var/log/supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ENTRYPOINT ["/usr/bin/supervisord"]
supervisord.conf
[supervisord]
nodaemon=true
logfile=/var/log/supervisor/supervisord.log
childlogdir=/var/log/supervisor
loglevel=debug
[program:socat]
command=socat TCP6-LISTEN:%(ENV_TYPESENSE_IP6PORT)s,bind=[::],reuseaddr,ipv6only=1,fork TCP4:127.0.0.1:%(ENV_TYPESENSE_IP4PORT)s
[program:typesense]
command=/opt/typesense-server --data-dir=%(ENV_TYPESENSE_DATA_DIR)s --api-key=%(ENV_TYPESENSE_API_KEY)s --api-address localhost --api-port=%(ENV_TYPESENSE_IP4PORT)s
fly.toml
app = "the-name-of-your-fly-app"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[build]
dockerfile = "Dockerfile"
[env]
TYPESENSE_DATA_DIR="/data"
TYPESENSE_IP6PORT=8080
TYPESENSE_IP4PORT=8062
[mounts]
source="your_typesense_data_volume"
destination="/data"
Hope this helps someone.