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

Dockerization via fabric8 plugin #50

Merged
merged 9 commits into from
May 28, 2019
Merged

Conversation

vtelensky
Copy link
Collaborator

  • Basic dockerization via fabric8 plugin

Copy link
Owner

@sparkoo sparkoo left a comment

Choose a reason for hiding this comment

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

what is purpose of src/main/resources/boxes/f25/f25_1_virtualbox.box file? I don't like it.

pom.xml Outdated
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.28.0</version>
Copy link
Owner

Choose a reason for hiding this comment

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

could you please extract all version string to variables https://github.com/sparkoo/boxitory/blob/devel/pom.xml#L66

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@sparkoo
Copy link
Owner

sparkoo commented Mar 26, 2019

Is it all and working? I would welcome some doc as I'd like to try it myself :)

@vtelensky
Copy link
Collaborator Author

vtelensky commented Apr 7, 2019

I have created very minimalistic configuration of docker image. Please see README.md and try to run it. It will need some more upgrades to be more configurable similarly as via application.properties. I will create different task for that.

@vtelensky vtelensky closed this Apr 13, 2019
@vtelensky vtelensky reopened this Apr 13, 2019
… file (server.port property), comment to box.home property, tweaking .gitignore
@vtelensky
Copy link
Collaborator Author

vtelensky commented Apr 13, 2019

I have added ability to read application.properties file and use server.port value for exposing container port the same as it is setup in properties file. Setting up application behaviour via properties file is a bit tricky for containerized apps. It should be done differently eg. via environment vars specified by --env param of docker command. Env vars are lately passed to some shell script which is starting app via jar file. It is usual way in those kind of scenarios. We can discuss later on some beer.

@sparkoo
Copy link
Owner

sparkoo commented Apr 15, 2019

What is intended usage of docker image? I'd like to build an image and the run it instead of running java -jar .... I've accomplished that with building an image with mvn clean package docker:build as you've wrote to doc. Then I've ran the image with mount volume like this docker run --rm -p 8083:8083 -v $( echo $PWD ):/home/boxitory boxitory having application.properties and boxes in $PWD.
Is this how it should be used?

@sparkoo
Copy link
Owner

sparkoo commented Apr 15, 2019

If ^^^ is intended usage, I'm satisfied with that. It just needs to be documented.
I can see one remaining issue here. In container, boxitory gives me path inside the container in response, e.g. sftp://some@server:/home/boxitory/boxes/f28/f28_1_vbox.box, /home/boxitory being path inside the container. The path exists just inside the container and if I request that url from another machine, it of course does not work. Do you have any solution how to solve this?

@vtelensky
Copy link
Collaborator Author

vtelensky commented May 20, 2019

What is intended usage of docker image? I'd like to build an image and the run it instead of running java -jar .... I've accomplished that with building an image with mvn clean package docker:build as you've wrote to doc. Then I've ran the image with mount volume like this docker run --rm -p 8083:8083 -v $( echo $PWD ):/home/boxitory boxitory having application.properties and boxes in $PWD.
Is this how it should be used?

There are several ways how to use it. The way which you have explained is also possible. The thing is that by your way you are running image directly via docker command and you are utilize mvn plugin fabric8 only for building the image. By running mvn docker:run plugin runs docker command with exception that there are preconfigured parameter for -p and -v. We should discuss what would be the intended way of running docker image. I think usage of fabric8 decouples users from knowledge of Docker.

@vtelensky
Copy link
Collaborator Author

If ^^^ is intended usage, I'm satisfied with that. It just needs to be documented.
I can see one remaining issue here. In container, boxitory gives me path inside the container in response, e.g. sftp://some@server:/home/boxitory/boxes/f28/f28_1_vbox.box, /home/boxitory being path inside the container. The path exists just inside the container and if I request that url from another machine, it of course does not work. Do you have any solution how to solve this?

I have setup that the host path to boxes and container path to boxes are the same. For the time being I've set it up as /tmp/boxes. Can be changed. Try to run in via mvn plugin and we can discuss how to resolve this.

@sparkoo
Copy link
Owner

sparkoo commented May 21, 2019

I'm not sure about latest changes. I would reduce requirements to two cases:

  • run container with maven plugin. I'm happy with boxes at .boxes/ dir here as this should be ran just in dev phase and it can be overwritten by dev easily.
  • build image and run container. Here we need 3 things to get in/out of container. Boxes dir, application.properties and logs.
    ** boxes can stay in /home/boxitory/boxes inside container and you have to bind the volume -v /boxes/at/host:/home/boxitory/boxes
    ** application.properties should be also easily injectable with -v /path/to/application.properties:/home/boxitory/application.properties
    ** logs should be also easily doable by -v /host/logs:/home/boxitory/logs

<!--suppress UnresolvedMavenProperty -->
<volume>${app.properties.path}:${box.container.home}/application.properties</volume>
<!--suppress UnresolvedMavenProperty -->
<volume>${app.logs}:${box.container.home}/logs</volume>
Copy link
Owner

Choose a reason for hiding this comment

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

Build is not failing at my local neither. Travis complains about logs dir. Shouldn't this line be without /logs? Same as on line 218 where also isn't /boxes directory.

@sparkoo
Copy link
Owner

sparkoo commented May 22, 2019

I've run build locally and it built docker image when just doing mvn clean install. I'd like to build docker image with extra command, not by default.

@vtelensky
Copy link
Collaborator Author

I've disabled fabric8 plugin executions during all the maven phases. You can still use the plugin by commands I've documented.

@sparkoo sparkoo merged commit 370316f into sparkoo:devel May 28, 2019
@sparkoo
Copy link
Owner

sparkoo commented May 28, 2019

thaanks! created boxitory image on dockerhub https://cloud.docker.com/u/sparkoo/repository/docker/sparkoo/boxitory 🐳

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.

2 participants