-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add Express-Gateway to the official images #3980
Conversation
@yosifkit Any chance you guys could have a look into this? |
@tianon Sorry to ping you personally — I realized you have been merging some pull requests lately and I was wondering whether you could help me with this. Is there anything else I should be doing here? Thanks! |
Hello! ✨ Thanks for your interest in contributing to the official images program. 💭 As you may have noticed, we've usually got a pretty decently sized queue of new images (not to mention image updates and maintenance of images under @docker-library which are maintained by the core official images team). As such, it may be some time before we get to reviewing this image (image updates get priority both because users expect them and because reviewing new images is a more involved process than reviewing updates), so we apologize in advance! Please be patient with us (and avoid poking us about your image via other communication means -- rest assured, we've seen your PR and it's in the queue). ❤️ We do try to proactively add and update the "new image checklist" on each PR, so if you haven't looked at it yet, that's a good use of time while you wait. ☔ Thanks! 💖 💙 💚 ❤️ |
Thanks @docker-library-bot ❤️ Sorry for the delay! I think my first concern here is around the location of the There's quite a bit of content in https://github.com/docker-library/official-images#review-guidelines that I think will be helpful (especially "repeatability"), but there are also little things that'll need updating like swapping |
Hey, thanks a lot for the reply! Good point about the separate repository. This was something I wanted to do since the beginning, but given we have some automation on the repository (we automatically build Docker Images and other stuff when we publish a new version) I wanted to make sure that
…before split and change the whole automation system into two parts. I'd be more than happy to make the change once we're all set with the review. Does that sound good to you?
Oh cool, I didn't know such thing. Why is that happening when writing the |
@tianon I've just merged a change that's changing the CMD statement. Is there anything else you want me to address before I start moving the Docker images in their own repository? |
Sure, fair enough -- will you still be maintaining the older versions, or will they be dropped? (It's up to you -- the guideline we usually recommend is that you should only maintain whatever current releases are actively maintained upstream unless you've got a good reason to deviate.)
See https://docs.docker.com/engine/reference/builder/#cmd:
You've got a couple other items being Just to be clear: is Express-Gateway something users would run as a standalone service? Or is it more similar to something like Django (and thus more likely to be listed in a project's |
Definitely. Express Gateway is an API Gateway proxying request and manipulating then. You download the image and it's up and running listening on a port.
I think these files are already included in the yarn package. That would just be matter of moving files around. I'll figure this out.
That makes sense. Perfect! |
@tianon Are multi stage builds supported? |
Thanks @TimWolla. I can live with that for now! |
Actually I have got a followup question — is there any way to provide a redirect from the old image |
@tianon Any update on this? |
Hey @tianon — thanks for stopping by again here
Yes! They've been included because of the changes you requested :)
Yes; we have an internal hot reload mechanism (https://www.express-gateway.io/docs/runtime/) that lets you modify the configuration (and the gateway would reload) AND an Admin API that'll change the Gateway's configuration which will be reflected on the files stored there also.
It is — the idea is that the Admin API should not be exposed on the external network by default. If you want to do that, you will need to proxy it using the gateway itself (so you can secure it) or make the change explicit. Does that make sense to you? |
@tianon I pushed another commit pointing Express Gateway to 1.13.x and with the |
What does it do if the provided VOLUME is empty, like it will be if a user
bind-mounts instead of making a new "Docker volume"? If the user lets
Docker create a new volume, it'll get pre-filled with the content of the
image at the volume location, which will be this default configuration
you've provided, but in every other case it'll stay empty, which I imagine
will probably make Express-Gateway fail to start?
|
Yes, it won't be able to start saying there are missing files @tianon Any suggestions on how to handle this better? |
If there's not a way to convince Express-Gateway itself to regenerate in the face of an empty directory (or for it to provide sane defaults that can then be modified and saved via the Admin API endpoints you referenced), then I guess the best/only option is probably something hacky like what the WordPress image does -- put the default configuration files elsewhere, during startup detect whether key files we expect exist, and if they don't, copy in the defaults. It definitely seems weird that the API is allowed to mutate the configuration, but if that's how it's supposed to work, so be it! |
@tianon Thanks for the response! I'm so glad we're interacting so quickly after all this time waiting!
I guess this could be done in a Followup question on that — why is crashing not an option? Wouldn't be ok to say "yeah ok thanks for the volume but I need some files into?" Just out of curiosity.
I can understand the concern however we have a reason; I do not want to annoy you with the details :) |
I've added now a |
@tianon Ping |
1 similar comment
@tianon Ping |
Ok, let's get back on this! 😅 ❤️ (Your patience is very much appreciated.) The The entrypoint (https://github.com/ExpressGateway/docker-express-gateway/blob/d836632e50e5a26a9fdb33fa384e253a0cd11fb2/alpine/docker-entrypoint.sh) doesn't currently meet our https://github.com/docker-library/official-images#consistency requirements -- here's what I'd recommend:
There's a similar approach in https://github.com/mongo-express/mongo-express-docker which might be useful as an example (although it uses a dummy Also, you've currently got your default config content split between the files you To clarify what I meant by "included in the yarn package", I meant some of these: $ find / -name gateway.config.yml -o -name system.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/getting-started/config/gateway.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/getting-started/config/system.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/basic/config/gateway.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/basic/config/system.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/config/gateway.config.yml
/usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/config/system.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/bin/generators/gateway/templates/getting-started/config/gateway.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/bin/generators/gateway/templates/getting-started/config/system.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/bin/generators/gateway/templates/basic/config/gateway.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/bin/generators/gateway/templates/basic/config/system.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/lib/config/gateway.config.yml
/usr/local/share/.cache/yarn/v2/npm-express-gateway-1.14.0-3948cb03ca51f0d629576af07fee2275eb4bcf8e/lib/config/system.config.yml If any of these is suitable for the initial volume initialization, then you might be able to skip those (Those files in Other than that, I think this looks OK and we should look to get you across the finish line here shortly. 👍 |
Correct. I've restored it and updated the template.
Done
Done
That's a way. Or, in case the docker builds you guys do allow to set ´--shm-size´ option during the build phase, then I could use that as a cache directory so its content gets discarded automatically once the build is done. Good point also about the gateway and system configuration file. I'll look into the alternatives to see if that makes sense or not. |
@tianon Done! I should have addressed all your comments! |
This is looking really good. 👍 I'm still confused about (Reviewing docs PR now. 🤘) |
There are also now Most of the time, relying on Docker's autocopy when using a |
Yeah I forgot about the model files, I'll have a look into this later. Thanks for pointing it out @yosifkit |
I only have two minor comments that could be addressed in a later PR. There is no Diff:diff --git a/_bashbrew-arches b/_bashbrew-arches
index e69de29..fe5f0f6 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -0,0 +1,5 @@
+express-gateway:1.14.0 @ amd64
+express-gateway:1.14.0 @ arm64v8
+express-gateway:1.14.0 @ i386
+express-gateway:1.14.0 @ ppc64le
+express-gateway:1.14.0 @ s390x
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..41d2f39 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,3 @@
+express-gateway:1.x
+express-gateway:1.14.x
+express-gateway:1.14.0
diff --git a/express-gateway_1.14.0/Dockerfile b/express-gateway_1.14.0/Dockerfile
new file mode 100644
index 0000000..8c1bf54
--- /dev/null
+++ b/express-gateway_1.14.0/Dockerfile
@@ -0,0 +1,21 @@
+FROM node:10-alpine
+
+LABEL maintainer Vincenzo Chianese, vincenzo@express-gateway.io
+
+ARG EG_VERSION=1.14.0
+
+RUN yarn global add express-gateway@$EG_VERSION && yarn cache clean
+
+ENV NODE_ENV production
+ENV NODE_PATH /usr/local/share/.config/yarn/global/node_modules/
+ENV EG_CONFIG_DIR /var/lib/eg
+
+ENV CHOKIDAR_USEPOLLING true
+
+VOLUME /var/lib/eg
+
+EXPOSE 8080 9876
+
+COPY docker-entrypoint.sh /usr/local/bin/
+ENTRYPOINT ["docker-entrypoint.sh"]
+CMD ["node", "-e", "require('express-gateway')().run();"]
diff --git a/express-gateway_1.14.0/docker-entrypoint.sh b/express-gateway_1.14.0/docker-entrypoint.sh
new file mode 100755
index 0000000..bc2f7b6
--- /dev/null
+++ b/express-gateway_1.14.0/docker-entrypoint.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+set -e
+
+if [ ! -e /var/lib/eg/gateway.config.yml ]; then
+ echo >&2 "gateway.config.yml file not found in $PWD - copying now..."
+
+ cp /usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/basic/config/gateway.config.yml \
+ /var/lib/eg/gateway.config.yml
+fi
+
+if [ ! -e /var/lib/eg/models ]; then
+ mkdir /var/lib/eg/models
+fi
+
+if [ ! -e /var/lib/eg/system.config.yml ]; then
+ echo >&2 "system.config.yml file not found in $PWD - copying now..."
+
+ cp /usr/local/share/.config/yarn/global/node_modules/express-gateway/bin/generators/gateway/templates/basic/config/system.config.yml \
+ /var/lib/eg/system.config.yml
+fi
+
+if [ ! -e /var/lib/eg/users.json ]; then
+ echo >&2 "users.json file not found in $PWD - copying now..."
+
+ cp /usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/config/models/users.json \
+ /var/lib/eg/models/users.json
+fi
+
+if [ ! -e /var/lib/eg/applications.json ]; then
+ echo >&2 "applications.json file not found in $PWD - copying now..."
+
+ cp /usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/config/models/applications.json \
+ /var/lib/eg/models/applications.json
+fi
+
+if [ ! -e /var/lib/eg/credentials.json ]; then
+ echo >&2 "credentials.json file not found in $PWD - copying now..."
+
+ cp /usr/local/share/.config/yarn/global/node_modules/express-gateway/lib/config/models/credentials.json \
+ /var/lib/eg/models/credentials.json
+fi
+
+
+exec "$@" Build test of #3980; 448b4b4; $ bashbrew build express-gateway:1.x
Building bashbrew/cache:f18bd66f26817536a90a575553e018d8eda1dd56e1d6d164cd42626d0e4c6ede (express-gateway:1.x)
Tagging express-gateway:1.x
Tagging express-gateway:1.14.x
Tagging express-gateway:1.14.0
$ test/run.sh express-gateway:1.x
testing express-gateway:1.x
'utc' [1/4]...passed
'cve-2014--shellshock' [2/4]...passed
'no-hard-coded-passwords' [3/4]...passed
'override-cmd' [4/4]...gateway.config.yml file not found in / - copying now...
system.config.yml file not found in / - copying now...
users.json file not found in / - copying now...
applications.json file not found in / - copying now...
credentials.json file not found in / - copying now...
passed
|
The output could be useful to users, so I would just skip them if the command isn't # maybe like this?
if [ "$1" = 'node' ]; then
# do copy stuff
fi
exec "$@" |
Is it ok if I address this in a following PR? |
Fine by me. It passes the tests we have 😄 |
This is so great! Finally it happened! |
Hello guys,
I'd love Express-Gateway, the project we're building, be part of the Docker Official Image program.
I'm quite sure we'll have a lot to work on, but this is a start.
Thanks a lot!
Checklist for Review
NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)
foobar
needs Node.js, hasFROM node:...
instead of grabbingnode
via other means been considered?)ifFROM scratch
, tarballs only exist in a single commit within the associated history?