Skip to content

Commit 2af6aea

Browse files
Merging changes from cedadev fork (#45)
* 2.0 integration (#44) * Changes from cedadev fork (#43) * Postgres container working * Improvements to solr, tomcat and index-node * Improved postgres container * SLCS is working * idp-node seems to be working * Changes to support URL prefix * Proxy -> CoG working * Solr + Zookeeper working * Index node working + certificates * Revamped configuration + index node * Use a common config container * ORP seems to be working * Setup container + fixes to compose * SLCS working * Auth app seems to run, but isn't working properly * Should have been in last commit * Set theme jekyll-theme-cayman * Testing GitHub pages for project * Testing Github pages site * Create architecture.md * Create comparison.md * Quick start done * Comparison with previous impl * Container architecture docs * Add version and hub to docker-compose * Docs on configuration * Changes while doing Helm integration * Changes to support OpenShift deployment * Fix problem with ORP trusting IDP * Changes to make hub and version flexible * Fix certificates, move generation of Java certs into containers * Publishing seems to be working apart from some issues with facets * Fix description of init * Get index node to query Solr for facets correctly * Add Travis support * Extend Travis timeout * Fix timeout but still get output * Fixed omission of while loop * Bring docker push into actual command * Bring back-to-top link to top * Small modifications to configs in prep for future work * Added helm-values command + pinned conda version in publisher * Make HTTPS everywhere the default * Fix compose file for newly required variable * Make containers work as non-root * Improved postgres containers for permissions and separated cogdb * Revert to master + slave for Solr * Set up CI for ESGF-based repository * Update Travis script * More tweaks to Travis job * Update .travis.yml
1 parent 1f41ee5 commit 2af6aea

File tree

378 files changed

+5745
-23110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+5745
-23110
lines changed

.env

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Default environment values used by ESGF/Docker
22
# Note that any value defined in the shell takes precedence over values defined in this file.
33

4-
ESGF_HOSTNAME=my-node.esgf.org
5-
ESGF_CONFIG=~/esgf_config
6-
ESGF_DATA_DIR=/tmp
7-
ESGF_VERSION=1.0
8-
ESGF_IMAGES_HUB=esgfhub
4+
ESGF_HUB=esgfhub
5+
ESGF_PREFIX=
6+
ESGF_VERSION=latest

.travis.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
sudo: required
2+
3+
services:
4+
- docker
5+
6+
addons:
7+
apt:
8+
packages:
9+
- docker-ce
10+
11+
branches:
12+
only:
13+
- master
14+
- devel
15+
16+
script:
17+
- |
18+
function periodic_echo {
19+
while true; do
20+
sleep 60
21+
echo "Ensuring execution continues..."
22+
done
23+
}
24+
function keep_alive {
25+
periodic_echo &
26+
local echo_pid=$!
27+
$@ &
28+
local command_pid=$!
29+
wait $command_pid
30+
local command_status=$?
31+
kill -9 $echo_pid
32+
if [ "$command_status" -ne "0" ]; then
33+
exit $command_status
34+
fi
35+
return 0
36+
}
37+
# If the build is for a tag, use that as the image tag
38+
# If not, use the output of git-describe
39+
export ESGF_VERSION="${TRAVIS_TAG:-"$(git describe --always --tags)"}"
40+
keep_alive docker-compose build
41+
# If this is a pull request, we are done - all we wanted to do is check it builds
42+
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
43+
echo "PR #${TRAVIS_PULL_REQUEST} built successfully - exiting"
44+
exit
45+
fi
46+
# If it is not a pull request, then push the tag to Docker Hub
47+
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
48+
keep_alive docker-compose push
49+
# If building master, retag with "latest" and push to Docker Hub
50+
# If building devel, retag with "devel" and push to Docker Hub
51+
# Any other branch (which shouldn't happen due to the whitelist above), we are done
52+
if [ "$TRAVIS_BRANCH" = "master" ]; then
53+
export ESGF_VERSION="latest"
54+
elif [ "$TRAVIS_BRANCH" = "devel" ]; then
55+
export ESGF_VERSION="devel"
56+
else
57+
exit
58+
fi
59+
keep_alive docker-compose build
60+
keep_alive docker-compose push
61+
62+
notifications:
63+
email: false
64+
slack:
65+
secure: v3c0zFQbSa5D+tE6CpMZwztWCt7jYeMZeQlgwCrGHCTWduCQhbeeHjzjWLyqqEag/ecvm2k40zWOSFF9HBDwStnXDaW0LmRRhtAQgapNlCvtAxa5IQhTcPtMfki0CrA8xj58SCfHdGbVDRquwNUuvahlhg45ddJBO1mw8hrMS1KRutE3AAZUVTdVJ2N7D6x7qA7i2hKVKjGfGlmHN+eA5ja/nW0J28XRKRXX6ztfelWIy7RNMWnhy/bsjkHNeiaIV6UztTKRi0mIzZSu/DXGM9VvrUleNUTqn/w/CumNnIh+Oboktl1jarGojnW0njRPqZbQ0Xm9mxc/vAcA0vFjLUVdae/fTNKojW2j8GZ2dOf9bFabdLflup6KAlF1+8PoSW9vDtSquYt8Ez1KpTm5YxkwGtf74KklEzDNqVoCrOK8uZWYOd05g0A32FbRZDlPGdouk1oz8Tw0ShOTtUd96pd69l8PsViXN7PkLh8UQ3yQv8E/A3Y7SHYUnFbQPN0uANwhqE9S0m9X/FQHRL2KGNXdnBTUKXaa7nRGxol57lXwWTIQbRwyBfYQf174yfMroZZO12lhmdBDzau5gtKBnPt33lbbjoGQBgRrF2zWukRKuMWOg8H8UiHMgJhcK6MFfMQeB/B0SOw/3t3sLGNm/1grbkiS/8lOOs1d2ZBdK5s=

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
# esgf-docker
2-
ESGF software stack as Docker images
2+
3+
ESGF software stack as Docker images.
4+
5+
## Documentation
6+
7+
For documentation, please visit [cedadev.github.io/esgf-docker](https://cedadev.github.io/esgf-docker).

auth/Dockerfile

Lines changed: 69 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,81 @@
1-
# ESGF-Auth client application.
1+
#####
2+
## Image for running the ESGF Auth client Django application
3+
##
4+
## To avoid including unnecessary build dependencies in the final image, we use
5+
## a builder image to check out the code and build wheels for all our dependencies
6+
#####
27

3-
ARG ESGF_IMAGES_HUB=esgfhub
4-
ARG ESGF_VERSION=devel
5-
ARG ESGF_REPO=http://distrib-coffee.ipsl.jussieu.fr/pub/esgf
8+
ARG ESGF_HUB=esgfhub
9+
ARG ESGF_PREFIX=
10+
ARG ESGF_VERSION=latest
611

7-
FROM $ESGF_IMAGES_HUB/esgf-node:$ESGF_VERSION
8-
MAINTAINER Earth System Grid Federation <[email protected]>
12+
# This build stage is required because COPY --from=$ARG is not supported
13+
# https://github.com/moby/moby/issues/34482
14+
FROM ${ESGF_HUB}/${ESGF_PREFIX}configure:${ESGF_VERSION} as configuration
15+
16+
FROM python:2.7-slim AS esgf-auth-build
17+
18+
# Install git for checking out the source code and pulling dependencies
19+
RUN apt-get update && \
20+
apt-get install -y git && \
21+
rm -rf /var/lib/apt/lists/*
22+
23+
# Clone the github repo and checkout the specified version
24+
ARG ESGF_AUTH_GIT_VERSION=master
25+
RUN git clone https://github.com/ESGF/esgf-auth.git /application && \
26+
cd /application && \
27+
git checkout $ESGF_AUTH_GIT_VERSION && \
28+
rm -rf .git && \
29+
cd -
930

10-
# installation directory
11-
ENV ESGF_AUTH_INSTALL_DIR=/usr/local/esgf-auth
31+
# Create wheels from the requirements
32+
RUN mkdir /pip-wheels && \
33+
pip wheel --wheel-dir /pip-wheels git+https://github.com/philipkershaw/crypto-cookie.git && \
34+
pip wheel --wheel-dir /pip-wheels psycopg2 && \
35+
pip wheel --wheel-dir /pip-wheels -r /application/requirements.txt
1236

13-
# library dependencies
14-
RUN yum -y update; yum -y install libffi-devel; yum clean all
1537

16-
# create python virtual environment
17-
RUN mkdir -p $ESGF_AUTH_INSTALL_DIR && \
18-
cd $ESGF_AUTH_INSTALL_DIR && \
19-
virtualenv venv
38+
#############
39+
## Stage 2 ##
40+
#############
41+
42+
FROM ${ESGF_HUB}/${ESGF_PREFIX}django:${ESGF_VERSION}
43+
44+
MAINTAINER Earth System Grid Federation <[email protected]>
2045

21-
# install source code
22-
RUN mkdir -p $ESGF_AUTH_INSTALL_DIR/src
46+
# Copy the application and wheels from the build stage
47+
COPY --from=esgf-auth-build /application /application
48+
COPY --from=esgf-auth-build /pip-wheels /pip-wheels
2349

24-
# install crypto cookie
25-
RUN cd $ESGF_AUTH_INSTALL_DIR && \
26-
source venv/bin/activate && \
27-
cd src && \
28-
git clone https://github.com/philipkershaw/crypto-cookie.git && \
29-
cd crypto-cookie && \
30-
python setup.py install
50+
# Install the dependency wheels (remove the wheels when we are done)
51+
RUN pip install --no-index --find-links=/pip-wheels -r /application/requirements.txt && \
52+
pip install --no-index --find-links=/pip-wheels crypto-cookie && \
53+
pip install --no-index --find-links=/pip-wheels psycopg2 && \
54+
rm -rf /pip-wheels
3155

32-
# copy mock configuration file which is read by settings.py during the database creation
33-
COPY conf/esgf_auth_config.json /esg/config/esgf_auth_config.json
56+
# Because esgf-auth has no setup.py, we can't use pip install -e /application
57+
# Instead, we add /application to the PYTHONPATH
58+
ENV PYTHONPATH /application:$PYTHONPATH
3459

35-
# install esgf-auth
36-
RUN cd $ESGF_AUTH_INSTALL_DIR && \
37-
source venv/bin/activate && \
38-
cd src && \
39-
git clone https://github.com/lukaszlacinski/esgf-auth.git && \
40-
cd esgf-auth && \
41-
pip install -r requirements.txt && \
42-
python ./manage.py migrate
60+
# Install ESGF Auth settings wrappers
61+
COPY python/*.py /usr/local/lib/python2.7/site-packages/
4362

44-
# change permission on parent directory and database file so user apache can write
45-
RUN chmod a+w /usr/local/esgf-auth/src/esgf-auth && \
46-
chmod a+w /usr/local/esgf-auth/src/esgf-auth/db.sqlite3
63+
# Install configuration files
64+
# Ensure the config directory is owned by the Django user and root group
65+
RUN mkdir -p /esg/config && chown 1001:0 /esg/config && chmod 775 /esg/config
66+
COPY --chown=1001:0 --from=configuration /esg/config /esg/config
67+
# Make sure the config interpolation runs first by giving it a low ordinal
68+
COPY --from=configuration /opt/esgf-docker/scripts/interpolate-configs.sh /django-init.d/01-interpolate.sh
69+
# Install the template auth config file
70+
ENV ESGF_AUTH_CONFIG_FILE /esg/auth/esgf_auth_config.json
71+
# Ensure /esg/auth exists and is owned by the Django user and root group
72+
RUN mkdir -p /esg/auth && chown 1001:0 /esg/auth && chmod 775 /esg/auth
73+
COPY conf/esgf_auth_config.json.template "$ESGF_AUTH_CONFIG_FILE.template"
74+
# This script interpolates the auth config files with additional environment variables
75+
COPY scripts/auth-configure.sh /django-init.d/02-auth-configure.sh
4776

48-
VOLUME /usr/local/esgf-auth
77+
# Run as the Django user unless otherwise specified
78+
USER 1001
4979

50-
CMD ["supervisord", "--nodaemon", "-c", "/etc/supervisord.conf"]
80+
# The "command" is just the settings module to use
81+
CMD ["esgf_auth_settings"]

auth/conf/esgf_auth_config.json

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ESGF_HOSTNAME": "$ESGF_HOSTNAME",
3+
"ESGF_SECRET_KEY": "$ESGF_COOKIE_SECRET_KEY",
4+
"WEBAPP_SECRET_KEY": "$ESGF_AUTH_SECRET_KEY"
5+
}

auth/conf/settings.py

Lines changed: 0 additions & 159 deletions
This file was deleted.

auth/conf/supervisord.esgf-auth.conf

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)