synapse-admin
synapse-admin copied to clipboard
Default homeserver env-var via docker-compose
Hello,
I have an issue getting the default homeserver env-var running. The default value can be set by an env-var via docker-compose, see example below, or did I miss something?
synapse-admin:
container_name: synapse-admin
image: awesometechnologies/synapse-admin:latest
ports:
- "8080:80"
environment:
- "REACT_APP_SERVER=http://10.1.1.1:8008"
restart: unless-stopped
It does not work with current Dockerfile
See here: https://github.com/facebook/create-react-app/issues/982
Docker uses REACT_APP_SERVER
during the build the container and not in runtime.
Ahhh yes, thanks!
Take a look at the new README.md. Now you can pass the build variables PUBLIC_URL
and REACT_APP_SERVER
as a build arg and build the Docker image yourself in Docker Compose.
Take a look at the new README.md. Now you can pass the build variables
PUBLIC_URL
andREACT_APP_SERVER
as a build arg and build the Docker image yourself in Docker Compose.
Wouldn't it be possible to instead use those variables as environment ones like most other images do? I honestly wouldn't consider this issue 100% closed if that's not supported.
Take a look at the new README.md. Now you can pass the build variables
PUBLIC_URL
andREACT_APP_SERVER
as a build arg and build the Docker image yourself in Docker Compose.Wouldn't it be possible to instead use those variables as environment ones like most other images do? I honestly wouldn't consider this issue 100% closed if that's not supported.
Correct. This was my initial idea - so setting those options without building your own image.
Well this would require modifying the build/index.html
file while starting the docker container. In the nginx
image this can be done by using a new entrypoint.sh file like this:
FROM nginx:alpine
...
COPY docker-entrypoint.sh /docker-entrypoint.d/99-synpase-admin.sh
RUN chmod +x /docker-entrypoint.d/99-synpase-admin.sh
...
(Source: https://github.com/nginxinc/docker-nginx/blob/master/entrypoint/docker-entrypoint.sh#L16-L30)
The entrypoint file would prepend the current script import paths in /app/index.html
with the value of the envvar PUBLIC_URL
using sed
or something similar. This would allow setting PUBLIC_URL
as docker runtime envvar.
Considerations
- This will break the option to define
PUBLIC_URL
during build as it might get overwritten when starting the container. Maybe this feature could be removed all together? - I don't know if this will also work for
REACT_APP_SERVER
, as I don't know where and how React handles envvars, sadly.
Hope this will help for implementing this.
Maybe I can find time to do this myself this weekend.
Yes, a PUBLIC_URL
env variable (or other runtime configuration) would be very useful, similar to element-web's default_server_config
configuration.
If we could have official support for those of us who run synapse in a docker container that would be great. I used to run a matrix server I had built from scratch and came to rely on synapse-admin, but I recently rebuilt everything and ported the DB over to a docker system for various reasons, and I was unaware that SA wasn't going to work anymore. Its a super useful tool for anyone running an Enterprise environment. If someone feels like they could contribute that, or do it for my needs, I'm sure I could get my company to pay you for your time.