Skip to content
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 vic-machine-server container build #6518

Conversation

andrewtchin
Copy link
Contributor

Towards #6037

Adds container build and upload to Drone

Copy link
Contributor

@mhagen-vmware mhagen-vmware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@mdharamadas1 mdharamadas1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@zjs
Copy link
Member

zjs commented Oct 5, 2017

Is the Dockerfile in this PR just a placeholder, or something you want us to review?

@andrewtchin
Copy link
Contributor Author

@zjs the Dockerfile is for real

# gcloud auth login
# gcloud docker -- push gcr.io/eminent-nation-87317/vic-machine-server:1.x

FROM golang:1.8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need to start from golang:1.8? Since vic-machine-server is already compiled, can we use a lighter-weight base image? (Should we be using photon, or even scratch?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to photon - I get docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory". when using scratch


FROM golang:1.8

COPY bin/vic-machine-server /vmware/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we somehow capture the version of vic-machine-sever in the container image? I'm not sure what the best practice for this would be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this to a later update since we are only tagging latest and @mdharamadas1 will be figuring out how we do versioning with the improved CI


COPY bin/vic-machine-server /vmware/

ENTRYPOINT /vmware/vic-machine-server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it would be helpful to include some ENV instructions to define defaults and serve as documentation. Something like:

ENV HOST 0.0.0.0
ENV PORT 80
ENV TLS_PORT 443

And then it seems like we should use EXPOSE instructions so that the container can just be used with -P:

EXPOSE 80
EXPOSE 443

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the ENVs but on the appliance, vic-machine-server can't listen on 80/443 since there are already services running there. Do you still want me to put the EXPOSEs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added EXPOSE since it doesn't hurt anything and can be useful for testing


COPY bin/vic-machine-server /vmware/

ENTRYPOINT /vmware/vic-machine-server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be documenting where/how we expect certificates to be supplied?

Copy link
Contributor Author

@andrewtchin andrewtchin Oct 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this acceptable?

docker run -it  -p 9443:443 -p 8080:80 -v ~/certs:/data -e TLS_CERTIFICATE=/data/server.cert.pem -e TLS_PRIVATE_KEY=/data/server.key.pem vic-machine-server
2017/10/06 13:47:02 Serving vic machine at http://[::]:80
2017/10/06 13:47:02 Serving vic machine at https://[::]:443
chin@CORPORATE:~|⇒  curl http://10.17.109.141:8080/container/version
v1.2.0-rc1-0-68b5a25e%
chin@CORPORATE:~|⇒  curl -k https://10.17.109.141:9443/container/version
v1.2.0-rc1-0-68b5a25e%

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to mount a volume and set a directory env var or have a default certs directory where vic-machine-server looks for key/cert/ca files with standard names?

Copy link
Member

@zjs zjs Oct 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd make sense to have a default certs directory (and file names), and express that as default values for the TLS_CERTIFICATE and TLS_PRIVATE ENV values.

Then the person running the container can either expose the files in the expected place (e.g., just specify -v ~/certs:/data) or put it somewhere else and override the ENV (e.g., specify -v ~/certs:/other/data -e TLS_CERTIFICATE=/other/data/server.cert.pem -e TLS_PRIVATE_KEY=/other/data/server.key.pem)

I think this gives us reasonable default behavior without constraining use of the container.


FROM golang:1.8

COPY bin/vic-machine-server /vmware/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be trying to follow Linux Filesystem Hierarchy, which might suggest putting this in /usr/local/bin, instead of putting this in a custom directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@andrewtchin andrewtchin force-pushed the 6037/containerize-service branch 2 times, most recently from fb2d077 to b065b4c Compare October 9, 2017 14:43
@andrewtchin andrewtchin merged commit 9f9e9b9 into vmware:feature/vic-machine-service Oct 9, 2017
@andrewtchin andrewtchin deleted the 6037/containerize-service branch October 9, 2017 20:24
zjs pushed a commit to zjs/vic that referenced this pull request Oct 9, 2017
zjs pushed a commit that referenced this pull request Oct 25, 2017
jzt pushed a commit to jzt/vic that referenced this pull request Oct 25, 2017
zjs pushed a commit that referenced this pull request Oct 31, 2017
zjs pushed a commit that referenced this pull request Nov 6, 2017
zjs pushed a commit that referenced this pull request Nov 6, 2017
zjs pushed a commit to zjs/vic that referenced this pull request Nov 7, 2017
zjs pushed a commit to zjs/vic that referenced this pull request Nov 7, 2017
zjs pushed a commit that referenced this pull request Nov 15, 2017
zjs pushed a commit that referenced this pull request Nov 16, 2017
zjs pushed a commit that referenced this pull request Nov 20, 2017
AngieCris pushed a commit to AngieCris/vic that referenced this pull request Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants