GoWS is a golang based static content web server.
- Clone this repository:
git clone https://github.com/redhat-cop/containers-quickstarts
cd containers-quickstarts/build-s2i-gows
- Run
ansible-galaxy install -r requirements.yml --roles-path=roles
- Login to Openshift:
oc login -u <username> https://master.example.com:8443
- Run openshift-applier:
ansible-playbook -i inventory/hosts roles/openshift-applier/playbooks/openshift-cluster-seed.yml
Now we can oc get routes
to get the hostname of the route that was just created, or click the link in the OpenShift Web Console, and test our newly published gows site.
By default our simple demo site will be deployed.
GoWS is a webserver built to do nothing more than to serve static content web sites on the smallest possible footprint. This S2I-enabled image makes this one step easier by being able to stream that content straight into the image from source.
This repo contains both a Dockerfile
for building the image and a directory of sample content.
The requirements of this image are simple. All you need are:
- An OpenShift or Minishift cluster
- A git repo with static content in it
- OpenShift Applier to build and deploy Gows. As a result you'll need to have ansible installed.
The openshift-applier will create the following OpenShift objects:
- A Project named
s2i-gows
- Three ImageStreams named
golang
,busybox
andgows
(see .openshift/templates/imagestreams/template.yml and .openshift/templates/builds/template.yml). - Four BuildConfigs named
gows-build
,gows-busybox
,gows-s2i
andgows
(see .openshift/templates/builds/template.yml) - A Service named
gows
(see .openshift/templates/deployments/template.yml) - A Route named
gows
(see .openshift/templates/deployments/template.yml)
The build supports a few environment variables to specify the source of the site. The default values can be changed by setting the variables below in the seed hosts file.
Variable Name | Default Value | Description |
---|---|---|
SITE_CONTEXT_DIR |
build-s2i-gows/demo |
Location of the site files within the git repository |
SITE_SOURCE_REPOSITORY_REF |
master |
Git branch/tag of the site files |
SITE_SOURCE_REPOSITORY_URL |
https://github.com/redhat-cop/containers-quickstarts |
Git repository of the site files |
This image supports a couple of simple environment variables for customizing directory locations.
Variable Name | Default Value | Description |
---|---|---|
SRC_DIR |
/opt/site/src |
Location to copy source from. This will not change where S2I clones the source to. Only change this value if what you are copying is a sub file or directory. |
GOWS_DIR |
/opt/site/static |
Location to copy source to. This will be where content is served from. This must match the value of GOWS_DIR at runtime |
Variable Name | Default Value | Description |
---|---|---|
GOWS_DIR |
/opt/site/static |
Location to serve static content from |
This image is available from Docker cloud:
docker pull redhatcop/build-s2i-gows
cd ./image
docker build -t redhatcop/build-s2i-gows .
oc delete project s2i-gows