Re: AWS ECS - containerizing WO deployments
Re: AWS ECS - containerizing WO deployments
- Subject: Re: AWS ECS - containerizing WO deployments
- From: Faizel Dakri <email@hidden>
- Date: Sun, 17 Mar 2019 23:03:42 -0500
I don’t do AWS, however I do have a prototype environment running on an
internal Ubuntu VM in which I deploy a set of docker containers: one for
database, one for web server and another for app server (my apps run in Tomcat
from WAR files, not WOMonitor—don’t know if that matters to you). Note that
all of this runs on a single VM—I haven’t split up the containers across the
network, nor have I employed anything like Docker swarm or kubernetes. Not yet,
at least. So if you’re looking for input on that front, I’m afraid I don’t have
anything to provide.
I can’t say how my application would fare in real world production use, but for
my current prototyping purposes it works well enough. I run everything on a
Ubuntu VM (hosted in a Hyper-V cluster) with the docker containers orchestrated
via docker-compose. If your AWS machine can run Docker, I would imagine that
the process to get an application running on it would not be too terribly
different, since most of it is handled by Docker.
From my experience, getting things working in Docker was not terribly hard,
especially after I was able to get the hang of docker volume mounting and
docker-compose. Docker-Compose allows you to specify all of your containers and
their dependencies in one place and then it’s easy to startup and shutdown your
application stack. You can even startup individual containers, which makes it
easy to develop and test in Eclipse against the same database that I’m running
in Docker.
In my compose file, I have three “services” defined: dbserver, appserver and
webserver. Each of these has its own Dockerfile to build an image, a set of
ports that are exposed (I expose ports on each service, however in production,
you’d only need to expose the webserver ports) and any volumes that are to be
mounted into the container. The Dockerfiles for each container range from
trivial (e.g. the postgresql dbserver only exposes a network port) to only
slightly more complex (the one for the appserver does some installs, symlinking
and copying of files).
One of the nice things about Docker-Compose is that it takes care of the
networking between containers, so you can refer to your services as hostnames
(e.g. in a connection dictionary, I can specify the database host as dbserver
to match my dbserver service). In my environment, my webserver talks to the
appserver container by specifying the name as “appserver”. Similarly, my
appserver container refers to my dbserver container as “dbserver”.
In my setup, all of my application’s required files/folders are present under a
single directory (e.g. /opt/myapp). Under that folder I have my database
directory, my config files (including the ones that will eventually make it to
/etc/WebObjects), my document root, and my web apps. I then mount that path (or
specific subfolders as needed) into my containers as a docker volume in my
compose file. For example, for the database, I might have the Postgres database
in /opt/myapp/data, which I would mount to /var/lib/postgresql/data. For the
app server and web servers, I mount the root folder (/opt/myapp) and then
either use symlinks within the container to point to specific config files or
copy over my custom config files to the container (the symlinks and file
copying is handled in the Dockerfile for that container).
There are a few improvements that I’d like to make: being able to specify
proper dependencies between containers, being able to automate the docker build
process, and having docker-compose automatically start up the environment at
machine boot.
Docker-Compose lets you specify a dependency between containers so that my
appserver container isn’t started before the dbserver container *starts*,
however there’s no guarantee that the dbserver container is actually *ready*
before the appserver starts. In practice, I’ve found that the database
container is always ready before the app server, however I believe this is
simply because it starts up faster (it’s a small Postgres server).
Since I’m prototyping, I currently deploy manually with a mvn depedency:get
from our repo manager to get the WAR files into my webapps folder—it works for
now, since it’s just me putting out test versions, however I’d like to automate
the docker build process so that it is driven from commits to the repository (I
haven’t yet set up a Jenkins environment, so that is probably the next step for
me).
Having the docker-compose environment started at boot is another improvement
high on my list. I know it can be done, and it may already be capable of doing
it, but I haven’t spent any significant energy or time investigating this as I
don’t need it at the moment.
Hope that helps.
F
--
Faizel Dakri
email@hidden <mailto:email@hidden>
> On Mar 15, 2019, at 01:23 PM, Joe Smith <email@hidden
> <mailto:email@hidden>> wrote:
>
> Does anyone have experience deploying a WO app to a Docker container.
> Customer wants deployment to AWS ECS (EC2 launch type).
>
> webserver in one container, wo app server in another, db in yet another?
>
> Joe
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden
> <mailto:email@hidden>)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden