mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #3112] [CLOSED] Support for unified docker using S6 from LSIO #4234
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#4234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/3112
Author: @webysther
Created: 6/5/2023
Status: ❌ Closed
Base:
main← Head:feat/docker-s6📝 Commits (6)
04273ccAdded base docker image5923393Removed not need software121c874Added S6 unified container7249152Removed files from #310726ab16eMerge pull request #2 from hoppscotch/main11f7ba9Merge branch 'main' into feat/docker-s6📊 Changes
5 files changed (+563 additions, -0 deletions)
View changed files
➕
.docker/Caddyfile(+23 -0)➕
.docker/custom-cont-init.d/build.sh(+464 -0)➕
.docker/custom-services.d/api.sh(+35 -0)➕
.docker/custom-services.d/proxy.sh(+13 -0)➕
.docker/custom-services.d/smtp.sh(+28 -0)📄 Description
Closes #3111 #3093 #3092 #3091 #3069 #3060 #3036 #3009 #3007 #2999 #2990 #2581
And this PR answer multiple questions in discussions.
Description
I published this docker to provide a glympse of what can be done, hope this help to provide a better framework for the community, best whishes.
Note¹: Is necessary include
pwgenandpython3-pipto base docker to this work, asCOPY .docker /Note²: Here have the images ready to use: https://hub.docker.com/repository/docker/webysther/hoppscotch
Supported tags and respective
Dockerfilelinkshoppscotch
Hoppscotch latest and base are based on PRs #3107 and #3112 for a version unified.
Based on LSIO Images featuring:
The architecture supported by this image is:
Version Tags
This image provides various versions that are available via tags. Please read the descriptions carefully and exercise caution when using unstable or development tags.
Application Setup
http://<host-ip>:80andhttp://<host-ip>:80/admin(admin).The application accepts a series of environment variables to further customize itself on boot.
Provided by the PRs #3107 and #3112:
-e MODE=-e ENABLE_ADMIN=-e ENABLE_API=-e ENABLE_SMTP=-e DOMAIN=-e SCHEMA=-e PROXY_HOST=-e PROXY_ENABLED=-e EXTENSIONS_ENABLED=-e TELEMETRY_ENABLED=-e THEME_COLOR=-e BG_COLOR=-e FONT_SIZE=-e ZEN_MODE=-e VITE_ADMIN_BASE_URL=-e SMTP_PROTOCOL=-e SMTP_DOMAIN=-e SMTP_PORT=-e SMTP_USER=-e SMTP_PASSWORD=-e POSTGRES_HOST=-e POSTGRES_PORT=-e POSTGRES_DB=-e POSTGRES_USER=Provided by hoppscotch:
-e DATABASE_URL=-e JWT_SECRET=-e SESSION_SECRET=-e PRODUCTION=-e TOKEN_SALT_COMPLEXITY=-e MAGIC_LINK_TOKEN_VALIDITY=-e REFRESH_TOKEN_VALIDITY=-e ACCESS_TOKEN_VALIDITY=-e REDIRECT_URL=-e WHITELISTED_ORIGINS=-e VITE_BASE_URL=-e VITE_SHORTCODE_BASE_URL=-e VITE_BACKEND_API_URL=-e VITE_BACKEND_GQL_URL=-e VITE_BACKEND_WS_URL=-e VITE_ADMIN_URL=-e VITE_APP_TOS_LINK=-e VITE_APP_PRIVACY_POLICY_LINK=-e GOOGLE_CLIENT_ID=-e GOOGLE_CLIENT_SECRET=-e GOOGLE_CALLBACK_URL=-e GOOGLE_SCOPE=-e GITHUB_CLIENT_ID=-e GITHUB_CLIENT_SECRET=-e GITHUB_CALLBACK_URL=-e GITHUB_SCOPE=-e MICROSOFT_CLIENT_ID=-e MICROSOFT_CLIENT_SECRET=-e MICROSOFT_CALLBACK_URL=-e MICROSOFT_SCOPE=-e MAILER_ADDRESS_FROM=-e MAILER_SMTP_URL=Usage
Here are some example snippets to help you get started creating a container.
docker-compose (recommended, click here for more info)
docker cli (click here for more info)
docker-compose with database
docker-compose for teams
docker-compose with UX customization
docker-compose multiple container
This configuration can be expanded to every service in container.
Feature: MODE
MODE is ENV variable with default value of single and is used to start all services but admin.
The mode nouser is focused in use standalone without need to have a user, this mode disable SMTP Server and enable ZEN_MODE by default.
The mode team enable admin.
Feature: Login with SMTP
By default a SMTP server spinup to provide the login facilite by e-mail direct in your docker log.
After put you e-mail the click to send a link you be logged to the docker logs, please use this link to login.
We recommend to setup a safe SMTP or OAUTH.
Feature: HTTP
By default the current distribution of hoppscotch don't allow you login using http, this is fixed in this PR and can be changed by the ENV SCHEMA.
Feature: Build skipped
The current hoppscotch need to be build every time if you change any ENV values, in this PR this the build process is skipped if the ENV don't change, this will not happen if you don't set JWT_SECRET and SESSION_SECRET, because the key is recreated every time the container is restarted.
Parameters
Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate
<external>:<internal>respectively. For example,-p 8080:80would expose port80from inside the container to be accessible from the host's IP on port8080outside the container.-p 80-e PUID=1000-e PGID=1000-e TZ=Etc/UTC-v /configEnvironment variables from files (Docker secrets)
You can set any environment variable from a file by using a special prepend
FILE__.As an example:
Will set the environment variable
PASSWORDbased on the contents of the/run/secrets/mysecretpasswordfile.User / Group Identifiers
When using volumes (
-vflags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the userPUIDand groupPGID.Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
In this instance
PUID=1000andPGID=1000, to find yours useid useras below:Docker Mods
LinuxServer publish various Docker Mods to enable additional functionality within the containers. The list of Mods available for this image (if any) as well as universal mods that can be applied to any one of our images can be accessed via the dynamic badges above.
Support Info
docker exec -it hoppscotch /bin/bashdocker logs -f hoppscotchdocker inspect -f '{{ index .Config.Labels "build_version" }}' hoppscotchUpdating Info
This image is static, versioned, and require an image update and container recreation to update the app inside.
Below are the instructions for updating containers:
Via Docker Compose
docker-compose pulldocker-compose pull hoppscotchdocker-compose up -ddocker-compose up -d hoppscotchdocker image pruneVia Docker Run
docker pull webysther/hoppscotch:latestdocker stop hoppscotchdocker rm hoppscotch/configfolder and settings will be preserved)docker image pruneVia Watchtower auto-updater (only use if you don't remember the original parameters)
Pull the latest image at its tag and replace it with the same env variables in one run:
You can also remove the old dangling images:
docker image pruneNote: We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using Docker Compose.
Building locally
If you want to make local modifications to these images for development purposes or just to customize the logic:
Checks
Additional Information
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.