Skip to content

Allow custom ports and environment #77

Open
jaredlander wants to merge 41 commits intoopenanalytics:masterfrom
jaredlander:master
Open

Allow custom ports and environment #77
jaredlander wants to merge 41 commits intoopenanalytics:masterfrom
jaredlander:master

Conversation

@jaredlander
Copy link

@jaredlander jaredlander commented Dec 4, 2025

Passing Environment Variables to shinyproxy

This allows users to pass environment variables through shinyproxy-operator (via docker compose) to the shinyproxy container as requested in #66.

When setting the variable set it with a SHINYPROXY_ENV_ prefix. For example setting SHINYPROXY_ENV_TEST_VAR: test_value will result in the shinyproxy-operator container have an environment variable named SHINYPROXY_ENV_TEST_VAR with a value of test_value AND the shinyproxy container will have an environment variable named TEST_VAR with a value of test_value.

Setting Custom Ports

This allows users to specify ports for caddy using SPO_CADDY_PORT_HTTP and SPO_CADDY_PORT_HTTPS as requested in #65. This will change the external ports for caddy but everything internally will still be on the standard 80/443 ports.

Automatic Image Building

Added a GitHub Action to automatically build the operator image and push to a registry as set in the repo secretes.

Copilot AI and others added 30 commits December 4, 2025 15:01
…ment variables

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
…tions

Add Copilot instructions for repository
…urable

Make Caddy container ports configurable via environment variables
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
- Reverted previous implementation that read from ShinyProxy spec
- Now reads environment variables from operator's environment with SHINYPROXY_ENV_ prefix
- Environment variables are passed to ShinyProxy container with prefix stripped
- This allows using docker-compose env files for secrets without plain text in configs
- Added comprehensive documentation with examples

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
- Validate that target key is not empty after stripping prefix
- Validate that values don't contain newline characters (security)
- Log warnings for invalid environment variables
- Update documentation with validation rules

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
- Added Dockerfile.build for building in a container with Maven and JDK 21
- Added docker-compose.build.yml for easy Docker-based builds
- Added devbox.json configuration for Devbox development environment
- Added BUILD.md with comprehensive build instructions for all options
- Users can now build without installing Maven/JDK locally

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
- Changed from 'mvn clean install' to 'mvn clean package -DskipTests' for faster builds
- 'package' is sufficient for creating the JAR without installing to local repository
- Updated Dockerfile.build, BUILD.md, and devbox.json consistently
- Addresses user feedback on build command

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
…ld simply output the artifact. Removed the docker compose option.
… up mvn dependencies and for packaging without tests. Updated BUILD.md to reflect these changes.
…proxy

Pass environment variables from operator to ShinyProxy Docker containers
…y caddy and shinyproxy still use the regular ports they expect.
Copilot AI and others added 11 commits December 4, 2025 19:00
…via secret

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
…y support

Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
Co-authored-by: jaredlander <628977+jaredlander@users.noreply.github.com>
…ld-test

Add GitHub Actions workflow for building and pushing Docker images to Azure Container Registry
…RT_0 so that we can add additional config imports and spring.config.import is no longer a forbidden configuration.
@jaredlander
Copy link
Author

Hi @LEDfan I know I added a bunch of stuff to this PR, including scaffolding like devbox and CI/CD. Is there anything I can chop away to make this easier for you to merge?

@LEDfan
Copy link
Member

LEDfan commented Feb 4, 2026

Hi @jaredlander first of all thank you for creating this PR and your patience.

I understand the need for passing environment variables, but I see a few problems with your current approach:

  • when hosting multiple shinyproxy servers (using one operator instance), all environment variables are passed to all ShinyProxy servers. This reduces the isolation between the multiple servers and might make it difficult to pass similar environment variables (but with different values) to different servers.
  • everyone that can inspect the running containers, can see all the environment variables (maybe also if you are able to see the running processes on a system). This risk is of course also present when passing environment variables when using ShinyProxy without the operator.
  • updating the environment variables requires updating the docker-compose.yml file of the operator, restarting the operator and then triggering a change of the ShinyProxy instance, such that the operator re-creates the instance.

We recently needed this feature for a customer and took a different approach (which is similar to Docker secrets):

  • adding an configuration option called additionalConfigFiles, which is a list of (absolute) paths to additional config files.

  • these files will be copied to the ShinyProxy config directory and automatically imported using spring.config.import

  • similarly to the main configuration file, the operator watches for changes in these files and will deploy a new ShinyProxy instance if the file changes

  • these files can contain any configuration (which can be merged with the main configuration). However, you can also use it to define simple key-value pairs, e.g.:

    MY_SECRET=my-value

Similar to environment variables, you can use these in the main configuration file using ${MY_SECRET}.

With this approach we solve the main reason to use environment variables, i.e. moving "secrets" outside your main file (which is typically stored in Git). However, I think this approach is a little bit more secure, and much more user friendly (because of the automatic reload).

I just pushed this code to the develop branch of this repo.


Regarding your other changes:

  • scaffolding like devbox and CI/CD: for us it would be good to remove these. We use devbox for other projects as well, but currently not for ShinyProxy. We also have internal CI/CD pipelines for building and testing (the tests also run on GHA). Similarly the docs are hosted on our website now ( https://shinyproxy.io/documentation/shinyproxy-operator/kubernetes/ ), so we'll add any new feature there before release.
  • Made it possible to specify the name of the redis and caddy images.: I'm fine with the idea, I still need to look a bit at the code
  • Changed the hard coding of SPRING_CONFIG_IMPORT to SPRING_CONFIG_IMPORT_0 so that we can add additional config imports and spring.config.import is no longer a forbidden configuration. I think this is solved by the additionalConfigFiles option in our implementation
  • Enabling the user to specify the network name for containers spawned by shinyproxy-orchestrator: also fine for me.
  • Custom ports: this would be very useful indeed!

So I'm happy to accept these smaller changes, and hope the additionalConfigFiles solves the issue with passing secrets.

@LEDfan LEDfan added this to the Next milestone Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants