Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.
Jeremy Echols edited this page Nov 12, 2018 · 1 revision

Docker App Proxy at UO

Server

Background

lib-staging acts as a simple "shared hosting" style setup for projects which use docker-compose. Any application which has been built with a working docker-compose.yml can be hosted on lib-staging under a custom hostname, such as myproject.lib-staging.uoregon.edu.

Use / Setup

Switch to your compose-enabled project, run the setup script, start up docker:

jechols@lib-staging:~$ cd ~/projects/oni-wrapper/open-oni
jechols@lib-staging:~/projects/oni-wrapper/open-oni$ register-app .
Choose which service(s) to expose:

1) web [not exposed]
2) rais [not exposed]
3) solr [not exposed]
4) rdbms [not exposed]

A) Abort (exit without saving)
X) Save and exit (will reload nginx)

>> 1
Configure web:

P) Set exposed port (currently 0)
H) Set host prefix (currently web; e.g., your URL will look like http://web.lib-staging.uoregon.edu)

A) Abort and return to main menu
X) Save and return to main menu

>> p
What port will the container expose? 80

>> h
What would you like the hostname to be? oni

>> x
Changes saved; returning to main menu

Choose which service(s) to expose:

1) web [host: oni; port: 80]
2) rais [not exposed]
3) solr [not exposed]
4) rdbms [not exposed]

A) Abort (exit without saving)
X) Save and exit (will reload nginx)

>> x
Saving data and writing out to staging compose file
You can now cd to /home/jechols/projects/oni-wrapper/open-oni and run docker-compose with the staging file (docker-compose.staging.yml)

Set up the magic aliasing via source setup-dc-staging, and you can perform any docker commands via something like stage up -d. Exposed ports will be mapped to the server on port 80 at the given hostname. If we wanted to export port 8080 from the ONI solr container, we might name it "oni-solr", and it would be reachable at oni-solr.lib-staging.uoregon.edu. Not oni-solr.lib-staging.uoregon.edu:8080.

Notes

  • The template for docker-gen is in this project's repository. docker-gen by itself will not give us a usable nginx configuration.
  • The "magic alias" refers to what happens when sourcing https://github.com/uoregon-libraries/docker-app-proxy/blob/master/setup-dc-staging: basically it just turns docker-compose -f docker-compose.staging.yml into a local alias, stage. It also has the advantage of detecting docker-compose.override.yml and using that for projects which need it, which avoids having to type the even longer command, docker-compose -f docker-compose.staging.yml -f docker-compose.override.yml.
Clone this wiki locally