-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run apps inside Docker containers #379
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ear the logs, but we have an 'tail' query param now.
Changed the api endpoint to use a single route, with a param for the stream (stdout or stderr) Removed the 'Clear Logs' feature, as Docker does not have a easy way to do that, but we can pass a 'tail=x' param in the URL.
songz
reviewed
Sep 4, 2020
songz
reviewed
Sep 4, 2020
songz
approved these changes
Sep 6, 2020
approved - to onboard new user, did not review thoroughly. Nice comments in the code, at a high level everything makes sense. |
greencarlos
approved these changes
Sep 6, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #377
Closes #281
This PR will change the apps process management from
pm2
todocker
, running the apps inside containers to achieve better isolation, this way protecting the main system from malicious apps.Now docker is a requirement to run myProxy.
There's been a lot of changes, so read and review this PR carefully. I'm always open to your suggestions or questions.
PR Summary
pm2
when the user pushes a new commit.Changed
setup.sh
scriptdocker
is installed before executing, exiting if it's notnode:alpine
(Alpine is a lightweight linux distro, the image is based on that))post-receive
scriptcurl
to the docker socket on the machineapi/mappings.ts
pm2
to usedocker
instead, using it's API instead of exec commandsgit push
the container is started through thepost-receive
scriptnode .
in the app directory. For this to work,package.json
needs to be configured correctly by setting the app entry point file in themain
property (for example"main": "index.js"
).api/logs.ts
stdout
andstderr
endpoints into a single onepublic/client.ts
Added
new package dependency:
dockerode
, used to communicate with docker through it's APInew docker helper functions in
helpers/docker.ts
new query params for the logs api
follow: boolean
: works likeheroku logs tail
where the log keeps updating with new changes. Does not work in the browser. Useful in the terminal when used withcurl
.tail: number
: returns the last n lines from the log.new start and stop buttons in the client webpage, with the respective endpoints in the mappings api
/api/mappings/{id}/start
/api/mappings/{id}/stop
Removed
clear logs feature
/api/logs/{stream}/{domain}?tail={numLines}
deploy.config.js
is not needed anymore, all the domain configs are set when the container is createdPossible features to be developed in the future