To configure the soketi server when using it with Docker, you can use an environment file (.env) or pass environment variables directly in your docker-compose.yml file or docker run command. Here's how you can do it using both methods:
Using an .env File
- Create an
.envfile in your project directory with the necessary environment variables for soketi. For example:
APP_ID=my-app-id
APP_KEY=my-app-key
APP_SECRET=my-app-secret
- In your
docker-compose.ymlfile, specify the.envfile using theenv_filedirective:
version: '3'
services:
soketi:
image: soketi/soketi:latest
ports:
- "6001:6001"
env_file:
- .env
- Run
docker-compose upto start the soketi server with the environment variables from your.envfile.
Using Inline Environment Variables
Alternatively, you can specify environment variables directly in your docker-compose.yml file using the environment directive:
version: '3'
services:
soketi:
image: soketi/soketi:latest
ports:
- "6001:6001"
environment:
APP_ID: my-app-id
APP_KEY: my-app-key
APP_SECRET: my-app-secret
Or, if you're using the docker run command, you can pass environment variables with the -e flag:
docker run -p 6001:6001 \
-e APP_ID=my-app-id \
-e APP_KEY=my-app-key \
-e APP_SECRET=my-app-secret \
soketi/soketi:latest
Troubleshooting
If some environment variables do not seem to work, make sure that:
- The environment variable names are correct and match the ones expected by soketi.
- There are no typos or syntax errors in your
.envfile ordocker-compose.ymlfile. - You are using the latest version of the soketi image that supports the environment variables you are trying to configure.
If you continue to have issues, refer to the soketi documentation or the specific issue you linked to for more context and potential solutions. It's also possible that there might be a bug or limitation in the soketi server that you might need to report or find a workaround for.