0

I would like to setup my JHipster project on a remote server utilising docker-compose as per here.

Am I right in thinking (for the simplest approach), these are the steps I might follow:

  • Install docker on remote system.
  • Install docker-compose on remote system.
  • On laptop (with app src code) run ./mvnw package -Pprod docker:build to produce a docker image of the application.
  • Copy the image produced by this to remote server like this.
  • Install this image on remote system.
  • On laptop copy relevant yml files from src/main/docker to a directory (e.g. dir/on/remote) on the remote server.
  • Run docker-compose -f dir/on/remote/app.yml up on the remote server.

Thanks for your help.

Also any suggestions on how this process may be improved would be appreciated.

Hurricane
  • 1,454
  • 1
  • 13
  • 31

1 Answers1

1

Expecting that your server is Ubunutu, SSH to your server,

Install docker, docker-compose, install JAVA and set JAVA_HOME

Two approches

  1. create docker image and push it to docker hub if you have docker hub account
  2. create docker image within server

Second approch would be better to reduce the confusion

Clone your repo to server

cd <APPLICATION_FOLDER>

Do

./mvnw package -Pprod docker:build -DskipTests

List the images created

docker images

You can ignore -DskipTests , if you are writing test code.

Do

docker-compose -f /src/main/docker/app.yml up -d

List containers running

docker ps -a

Logs of the container

docker logs <CONTAINER_ID>
Jinna Balu
  • 6,747
  • 38
  • 47
  • Thanks for taking the time to answer. In the end I created the app image locally and copied and installed it onto my server. Both your suggestions are valid options which I may investigate in the future. – Hurricane Sep 11 '17 at 19:51
  • Do you use a nginx on your server to access your docker ? – Mercer Mar 19 '19 at 09:13
  • No what is the need of using nginx to access docker? – Jinna Balu Mar 20 '19 at 18:11