#community-help

Creating Dockerfile for Typesense with Environment Variables

TLDR andrew inquired about creating an ideal Dockerfile for Typesense. Jason provided instructions on how to set it up properly, also mentioning that environment variables are documented on their official webpage. After testing these instructions, andrew indeed managed to make it work using Railway.

Powered by Struct AI

1

1

10
10mo
Solved
Join the chat
Jan 25, 2023 (11 months ago)
andrew
Photo of md5-c5d0a7d308a69bafd1d0dbc38e6f4136
andrew
04:14 PM
Hi there me again. Just checking but what does an ideal dockefile including envs look like for typesense? I am still trying to explore fly.io but also just found railway.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:11 PM
There’s no standard dockerfile per se, because you should be able to use our published docker container without any modifications
10:11
Jason
10:11 PM
All the environment variables are documented at the top of this page: https://typesense.org/docs/0.23.1/api/server-configuration.html#using-a-configuration-file
andrew
Photo of md5-c5d0a7d308a69bafd1d0dbc38e6f4136
andrew
10:14 PM
Jason if I provided no command line args, will it default to the ini file. Reason I am asking is most of the documentation is on passing arguements to docker run instead of a docker file, so i run into issues setup the data dir and etc. I am thinking maybe I could do a copy
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:21 PM
No, it doesn’t default to the ini file. You still need to pass in a command line argument to the typesense process running inside the docker container, indicating the location of the ini file
10:25
Jason
10:25 PM
Could you try something like this:

FROM typesense/typesense:0.24.0.rcn58
RUN mkdir -p /etc/typesense
COPY typesense-server.ini /etc/typesense
EXPOSE 8108
ENTRYPOINT ["/opt/typesense-server", "--config=/etc/typesense/typesense-server.ini"]
10:26
Jason
10:26 PM
You’d need to have a file called typesense-server.ini in the same directory as this dockerfile

1

andrew
Photo of md5-c5d0a7d308a69bafd1d0dbc38e6f4136
andrew
10:29 PM
Let me try it
Jan 26, 2023 (10 months ago)
andrew
Photo of md5-c5d0a7d308a69bafd1d0dbc38e6f4136
andrew
12:26 AM
Got it working with Railway!

1

12:26
andrew
12:26 AM
But not sure if they have persistent storage..

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3011 threads (79% resolved)

Join Our Community

Similar Threads

Problems with Typesense Deployment on Railway

Peter asked for advice on deploying Typesense on Railway and experienced crash issues despite appropriate dockerfile configuration and error handling, Kishore Nallan has yet to offer a solution.

6
15mo

Resolving Issues with Infix and Prefix in Query Searches

Daren struggled with searches missing values in production. Jason and Kishore Nallan offered insights and created new features to help solve the problem, which was then tested and deployed by Daren.

2

38
5mo
Solved

Using Typesense in Docker Container – Importing JSONL File

Hakim faced 'Empty reply from server' error when importing a JSONL file into a Typesense-Docker container. Kishore Nallan and Jason suggested checking the docker logs and increasing default RAM and CPU allocation. Finally, Hakim successfully indexed the documents using a PHP script.

9
16mo
Solved

Typesense nodes setup using environment variable

Pradyuman requested a feature to set Typesense nodes using environment variables. Jason found the idea useful but suggested opening a GitHub issue, which Pradyuman did promptly. The feature is not likely to be added in the upcoming release due to timing.

2

14
25mo

Deploying Typesense in GCP Cloud Run

Christian had difficulties obtaining an API key for deploying Typesense in GCP Cloud Run. Kishore Nallan guided on API key creation when setting up Typesense server and suggested checking the Typesense self-hosting guide. Christian decided to run the Typesense in Kubernetes instead of Cloud Run. Nasim thanked Christian for sharing findings.

1

20
19mo