View Christos Tranoris's profile on LinkedIn


Visit The Model Driven Software Network

Who's online

There are currently 0 users and 16 guests online.

Recent comments

Syndicate

Syndicate content

Deploy nginx-jetty-mysql with docker compose

In this post I'm sharing with you a short project for deploying both static content and a backend application with nginx as a reverse proxy using https to serve:

  • a web front end (e.g. static html/js pages)
  • a backend application hostd in jetty web server (for example it servers a restful API)

Nginx as a reverse proxy helps to have a single point of https access for serving both the web and the API.
You don't need to have installed in your host nothing but the docker and docker-compose.

The source code can be found at github.com/ctranoris/docker-compose-nginx-jetty-mysql
the main docker-compose.yaml file deploys the three containers and exposes ports and links like the following images shows:
 

Some things to know:

  • after cloning the project set some permissions in jetty folder the home owner to owned by jetty:jetty (uid 999, gid 999): sudo chown -R 999:999 home/
    you need to adjust the Mysql settings in the docker compose file or any other links
  • Adjust the nginx.conf file
  • add certificates nginx\certificates for https support
  • deploy any static content if you wish for example under  \nginx\mystaticwebpages
  • java wars files under \jetty\wars and their web app xml configurations under jetty\webapps

mysql\data are exposed to your host
a simple
docker-compose up -d
should bring the three containers up.
Use
docker ps
to check if everything is up and running. For example:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESbbc7945bf4d2 jetty "/docker-entrypoin..." 46 hours ago Up 42 hours 0.0.0.0:8080->8080/tcp ajettyb1856eea6f4a mysql:5.7 "docker-entrypoint..." 46 hours ago Up 42 hours 0.0.0.0:3306->3306/tcp amysqlb3937638ed65 nginx "nginx -g 'daemon ..." 46 hours ago Up 42 hours 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp anginx
With
docker exec -it ajetty bash
you can connect to a container with a terminal. or with
docker attach ajetty
you can attach to the container and monitor the output of the executed command in the container.
 
 
 
 

Posted in Submitted by tranoris on November 8, 2017 - 11:55.



Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.