Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Merge pull request #6 from docker/comanageservices
Browse files Browse the repository at this point in the history
Comanageservices
  • Loading branch information
Jim Van Fleet committed Sep 13, 2016
2 parents 2f71915 + 3af95c8 commit 1cfe641
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 34 deletions.
4 changes: 2 additions & 2 deletions BINSCRIPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you are reading this file in BINSCRIPTS.md, your container project is likely
To use these scripts yourself, issue this command:

```
curl "https://github.internet2.edu/raw/docker/util/master/bin/install.sh?token=AAAAEddkrL9MeeA6VWcNn_PgV30r4lD1ks5XogeiwA%3D%3D" | bash
curl "https://github.internet2.edu/raw/docker/util/master/bin/install.sh?token=AAAAE4VRBLPB8VExPHSR5nCe791IAYqaks5Xzug5wA%3D%3D" | bash
```

### common.bash
Expand Down Expand Up @@ -38,4 +38,4 @@ This will also install a Jenkinsfile to your repository, if it doesn't have one.


### Testing
#### test.sh
#### test.sh
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,19 @@ VOLUME /opt/shibboleth/ssl/

# Required volumes for mounting Apache SSL files into container
VOLUME /opt/httpd/ssl/
#Added ssl default conf
RUN ln -s /opt/etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf

#Added shib module apache
RUN ln -s /opt/etc/httpd/conf.modules.d/00-shib.conf /etc/httpd/conf.modules.d/00-shib.conf
RUN ln -s /usr/lib64/shibboleth/mod_shib_24.so /etc/httpd/modules/mod_shib_24.so

#Add httpd configuration
RUN ln -s /opt/etc/httpd/conf.d/ports.conf /etc/httpd/conf.d/ports.conf
RUN ln -s /opt/etc/httpd/conf.d/handlers.conf /etc/httpd/conf.d/handlers.conf
RUN ln -s /opt/etc/httpd/conf.d/virtual_host_80.conf /etc/httpd/conf.d/00-comanage-80.conf

# Port
EXPOSE 80 443

CMD ["/opt/bin/start.sh"]
CMD ["/opt/bin/start.sh"]
20 changes: 19 additions & 1 deletion container_files/bin/configure_httpd.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
#!/bin/bash

log="/tmp/httpd.log"
date >> $log
echo "Configuring httpd: " >> $log

echo "Configuring httpd: " > $log
sed -i "s|COMANAGE_SERVER_FQDN|$COMANAGE_SERVER_FQDN|g" /opt/etc/httpd/conf.d/virtual_host_80.conf >> $log
sed -i "s|COMANAGE_SERVER_FQDN|$COMANAGE_SERVER_FQDN|g" /opt/etc/httpd/conf.d/virtual_host_443.conf >> $log
if [[ $CHANGE_TO_SSL_HTTPD_KEY && ${CHANGE_TO_SSL_HTTPD_KEY-x} ]]; then
sed -i "s|CHANGE_TO_SSL_HTTPD_KEY|$CHANGE_TO_SSL_HTTPD_KEY|g" /opt/etc/httpd/conf.d/virtual_host_443.conf >> $log
else
echo "CHANGE_TO_SSL_HTTPD_KEY variable is not used" >> $log
fi
if [[ $CHANGE_TO_SSL_HTTPD_CERT && ${CHANGE_TO_SSL_HTTPD_CERT-x} ]]; then
sed -i "s|CHANGE_TO_SSL_HTTPD_CERT|$CHANGE_TO_SSL_HTTPD_CERT|g" /opt/etc/httpd/conf.d/virtual_host_443.conf >> $log
else
echo "CHANGE_TO_SSL_HTTPD_CERT variable is not used" >> $log
fi

echo "Removing Listen 80 in httpd.conf" >> $log
sed -i 's/^Listen 80$//' /etc/httpd/conf/httpd.conf
date >> $log
echo "Configuration of httpd completed " >> $log
28 changes: 22 additions & 6 deletions container_files/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,35 @@ then
else
echo "COmanage was configured" >>$log
echo "COmanage was configured"
echo "Starting apache" >>$log
echo "Starting apache"
echo "Starting apache and shibd" >>$log
echo "Starting apache shibd"
/usr/local/bin/httpd-shib-foreground
fi
else
echo "Composed so waiting for MariaDB: " > $log
date >> $log
echo "Testing connectivity to database before continue with install" >> $log
echo "Testing connectivity to database before continue with install"
/opt/wait-for-it/wait-for-it.sh $MYSQL_HOST:3306 -t $WAIT_TIME --strict -- /opt/bin/main.sh

/opt/wait-for-it/wait-for-it.sh $MYSQL_HOST:3306 -t $WAIT_TIME --strict -- /opt/bin/main.sh >> $log
echo "Mariadb default port is open and test connection ok"
echo "Mariadb default port is open and test connection ok" >> $log
echo "Testing connectivy to database before continue with install" >> $log
echo "Testing connectivy to database before continue with install"
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;"
laststatus="$?"
echo "checking connectivity" >> $log
while [ "$laststatus" != "0" ]; do
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;"
laststatus="$?"
sleep 5
date >> $log
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE"
echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE" >> $log
done
echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error" >> $log
echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error"
date >> $log
echo "Starting apache" >>$log
echo "Starting apache"
echo "Starting apache and shibd" >>$log
echo "Starting apache shibd"
/usr/local/bin/httpd-shib-foreground
fi
3 changes: 3 additions & 0 deletions container_files/etc/httpd/conf.d/handlers.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
AddType text/html .php
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
2 changes: 2 additions & 0 deletions container_files/etc/httpd/conf.d/ports.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Listen 80 http
Listen 443 https
6 changes: 6 additions & 0 deletions container_files/etc/httpd/conf.d/ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
Listen 80 http
Listen 443 https

AddType text/html .php
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"

LoadModule mod_shib /usr/lib64/shibboleth/mod_shib_24.so

<VirtualHost _default_:80>
ServerName http://COMANAGE_SERVER_FQDN:80
UseCanonicalName On
RedirectMatch (.*) https://COMANAGE_SERVER_FQDN$1
</VirtualHost>

SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

<VirtualHost _default_:443>
ServerName https://COMANAGE_SERVER_FQDN:443
UseCanonicalName On
Expand Down Expand Up @@ -103,5 +81,4 @@ Redirect "/registry/users/logout" "https://COMANAGE_SERVER_FQDN/Shibboleth.sso/L
Require all denied
</Files>

</VirtualHost>

</VirtualHost>
5 changes: 5 additions & 0 deletions container_files/etc/httpd/conf.d/virtual_host_80.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<VirtualHost _default_:80>
ServerName http://COMANAGE_SERVER_FQDN:80
UseCanonicalName On
RedirectMatch (.*) https://COMANAGE_SERVER_FQDN$1
</VirtualHost>
1 change: 1 addition & 0 deletions container_files/etc/httpd/conf.modules.d/00-shib.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LoadModule mod_shib /usr/lib64/shibboleth/mod_shib_24.so

0 comments on commit 1cfe641

Please sign in to comment.