Skip to content

Conversation

@FoxxMD
Copy link

@FoxxMD FoxxMD commented Jun 20, 2024

Saw your post in r/selfhosted. I have experience with node-based, web applications written to be deployed with docker so I thought I'd give some suggestions on how to setup your project for more painless experience for both you and your users.

If you have any questions about these changes I'm happy to expand on why I made them or what they do.

FoxxMD added 6 commits June 20, 2024 09:41
Lets other developers know what the minimum and suggested node version to use should be.
Provides a deterministic package dependency tree for other developers to ensure everyone is using the same versions. Additionally, ensures docker images are reproducible.
* User generated data paths should not be coupled to static/internal folders -- makes data more portable
* Use an ENV, CONFIG_DIR, to allow user to set base path for user-generated dirs
* Use alpine base image for smaller footprint
* Install ffmpeg as depedency for ffprobe usage
* Use linuxserver.io (LSIO) to fix potential file permission problems
  * https://docs.linuxserver.io/general/understanding-puid-and-pgid/
  * Document PUID/PGID usage in readme
* Use separate directory for user-generated data (CONFIG_DIR=/config)
  * Document volume mounting to persist user data
* Use s6 init
  * On startup ensures CONFIG_DIR and subfolders exist and have correct permissions
  * Better management of long-running node process
@FoxxMD
Copy link
Author

FoxxMD commented Jun 20, 2024

P.S. did not include this in the PR because its an opinionated approach (and a bit of self-advertising) but you may want to check out my logging library https://foxxmd.github.io/logging . It's an easy way to set up powerful logging usable for both you and your users and would be useful once you need more than the basic node console logging.

@FoxxMD
Copy link
Author

FoxxMD commented Jun 20, 2024

To use the github actions workflow to deploy automatically to dockerhub and github packages

Triggers on these actions and publishes accordingly:

  • On commit to main branch => published to dockerhub/ghcr latest tag
  • On commit to experimental branch => published to dockerhub/ghcr experimental tag
  • On release => published to dockerhub/ghcr using release tag

To enable

  • Go to repository settings -> secrets and variables -> actions
    • Add repository secrets
      • DOCKER_USERNAME - your dockerhub username
      • DOCKER_PASSWORD - your dockerhub password
    • Add repository variables
      • DOCKERHUB_IMAGE_NAME - the full name of the dockerhub image IE davidguva/openvidreview
      • GHCR_IMAGE_NAME - the full name of the GHCR image IE ghcr.io/davidguva/openvidreview
      • If neither of the above variables are included then the job will not run
  • Go to repository settings -> Actions -> General
    • Action permissions -> Allow all actions...
    • Workflow permissions -> Read and write permissions
    • Save

Depending on which you use you'll want to add them to readme. Using a badge like Docker Pulls and/or as links in the docker install section and comments in docker-compose.yaml

@FoxxMD FoxxMD changed the title Add node version constraints and nvmrc Improve docker, dev, and user experience Jun 20, 2024
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.

1 participant