Instant Reverse Proxy with Docker
Recently I have been using Docker to build out an Apache reverse proxy in development. The advantages of using Docker in this scenario are:
- Increased Security through isolation - Docker containers jail your application so that the main operating system hosting the container is protected. The containers are ephemeral and can be rebuilt in seconds. Some organizations rebuild their applications on a nightly basis.
- Fast Deployment - Once your docker file is setup you can deploy docker containers in seconds. This makes it very simple to graduate changes from development to production or rebuild infrastructure in DR scenario
- Cloud Friendly - Docker containers are very portable. If suddenly your organization wants to move to cloud infrastructure or hosting providers, it is a relatively simple task to move these containers. Additionally, cloud companies like Amazon, Azure are heavily invested in Docker and already have many of the tools in place for organizations using Docker.
What does this look like? To start we need to install Docker on Linux. In this example we are using Oracle Linux. Reference
Enable the ol7_addons channel in YUM. i.e.
Install the Docker engine for OEL via YUM and start the Docker Service.
Next, we need to load up a Docker image. In this example we will use the Official Apache HTTP Server docker image from the Docker hub. In particular I like the alpine branch because it is only 26 MB's!.
Just like that, you now have an Apache server running. If you browse to your servers hostname, you will see a default page that says "It works". Next we want to rebuild our Apache container so that we can modify the configuration and html files. Copy your html to /etc/docker/apache/html and copy your configuration to /etc/docker/apache/conf. Once in place you can tell the container to look in(bind mount) these host paths for this info.
Now if you browse to your servers hostname, you will see your custom content. If you have any issues starting the container, run "docker logs apache". to view the output and debug.
Now we're ready to add the Weblogic plugin for Apache to the container and proxy to the weblogic server.
- Download the Oracle WebLogic Web Server Plugins
- Setup your httpd.conf configuration to load the plugin and redirect to your weblogic server
- Rebuild your container and bind mount the apache modules directory to include all modules you want loaded on apache server. Include the weblogic plugin in this directory.
I also see this as good preparation for what may be coming. It looks like PeopleTools will eventually be delivered in a Docker image.Why do I think this?
- If you open the DPK you will see references to Docker (likely used internally)
- Oracle clearly is moving in this direction as evidenced by their git hub repository. They already have officially supported Docker images for PeopleSoft core technologies, Oracle Weblogic, Oracle Tuxedo, and Oracle Database.