Created
June 1, 2018 17:54
-
-
Save mwkorver/bc493dc2ad3b49c6e5844ec162a6bffd to your computer and use it in GitHub Desktop.
dockerized mapserver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-boothook | |
#!/bin/bash | |
set -x | |
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 | |
# fix for "unable to resolve host" error even when dns hostnames/resolution are turned on for VPC | |
echo "127.0.0.1 $(hostname)" >> /etc/hosts | |
# copy shapefiles from S3 bucket | |
aws s3 sync s3://umgeocon/shpfl /home/ec2-user/mapfiles | |
# copy map file, this file includes keys | |
aws s3 cp s3://umgeocon/mapfiles/test.map /home/ec2-user/mapfiles/test.map | |
if [ -x "$(command -v docker)" ] | |
then | |
echo "This is a reboot" | |
else | |
echo "Running first time install scripts." | |
yum update -y | |
DEBIAN_FRONTEND=noninteractive | |
# install docker | |
yum install -y docker | |
service docker start | |
docker run --detach -v /home/ec2-user/mapfiles:/mapfiles:ro --publish 8080:80 --name mapserver geodata/mapserver | |
# log file setup in the now running mapserver container | |
# the location of the log file is dependent on what you specify in your map file. | |
# looks like - CONFIG "MS_ERRORFILE" "/var/log/ms_error.log" in map file | |
docker exec mapserver touch /var/log/ms_error.log | |
docker exec mapserver chown www-data /var/log/ms_error.log | |
docker exec mapserver chmod 644 /var/log/ms_error.log | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment