version 1.1

This commit is contained in:
2024-10-09 15:06:56 +02:00
parent d81fb678e3
commit 836a412a6d
536 changed files with 63922 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#########################################
#
# README
#
#########################################
Docker configuration :
A docker-compose file bind 4 different docker-files to work together :
- cstl-data : A shared volume. Designed to contain all data from Constellation-SDI and its admin database (BACKUP).
- FTP : An FTP service to publish reference files and results Its data can be mounted from host by editing docker-compose configuration.
- db : PostgreSQL service to use with Constellation.
- Constellation : WFS service for geographic references.
Volume management :
It is possible to use volumes on cstl-data and ftp container, to mount constellation / ftp data from host. By decommenting volumes section from the docker-compose file, and changing the left part (host) by the path on your host you want to use, you can make data independant from containers.
/!\ For the ftp volumes, you should be cautious about right management. If you want to make some directories/files read-only for the FTP user, you have to ensure that your owner on host has a different UID from the one in the docker file. If user UIDs are the same, your host files will be considered as owned by the container ftp user. To fully configure user mapping between host and container, you may want to look about user namespace feature.
+41
View File
@@ -0,0 +1,41 @@
FROM alpine:3.3
RUN mkdir /opt
WORKDIR /opt
# Download, verify and configure JRE package
# Copied from https://gist.github.com/rhuss/6d3c0c687fb4ec39c3e4 (wget / glibc config)
RUN apk add --update wget ca-certificates && \
cd /tmp && \
wget "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.21-r2/glibc-2.21-r2.apk" \
"https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.21-r2/glibc-bin-2.21-r2.apk" && \
apk add --allow-untrusted glibc-2.21-r2.apk glibc-bin-2.21-r2.apk && \
/usr/glibc/usr/bin/ldconfig /lib /usr/glibc/usr/lib
RUN wget -O jre8u77.tgz -c --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jre-8u77-linux-x64.tar.gz
RUN echo "7e7d8d0918b4f81f6adde9fcb853a036 jre8u77.tgz" > checkJavaMd5
RUN md5sum -c checkJavaMd5
RUN tar -zxf jre8u77.tgz
RUN rm jre8u77.tgz checkJavaMd5
RUN apk del wget ca-certificates
ENV JAVA_HOME /opt/jre1.8.0_77
# Download and verify Tomcat (7.0.69) package
RUN wget -O tomcat-md5 http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz.md5 && \
wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.69/bin/apache-tomcat-7.0.69.tar.gz
RUN md5sum -c tomcat-md5 && rm tomcat-md5
# Extract / configure Tomcat
RUN tar -zxf apache-tomcat-7.0.69.tar.gz && \
rm apache-tomcat-7.0.69.tar.gz
ADD setenv.sh /opt/apache-tomcat-7.0.69/bin/
#RUN chmod 774 /opt/apache-tomcat-7.0.69/bin/catalina.sh
VOLUME /opt/apache-tomcat-7.0.69/webapps /var/rhomeo/cstl
ENTRYPOINT ["/opt/apache-tomcat-7.0.69/bin/catalina.sh"]
CMD ["run"]
+3
View File
@@ -0,0 +1,3 @@
export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket
export JAVA_OPTS="-Xms512m -Xmx1G -Dfile.encoding=UTF-8 -Dgeotk.image.cache.size=128m"
+11
View File
@@ -0,0 +1,11 @@
FROM alpine:3.3
RUN mkdir /var/rhomeo
WORKDIR /var/rhomeo
RUN mkdir pgdata cstl
VOLUME /var/rhomeo/pgdata /var/rhomeo/cstl
CMD echo 'Data Container for Constellation service.'
+57
View File
@@ -0,0 +1,57 @@
FROM ubuntu:14.04
MAINTAINER Alexis Manin <alexis.manin@geomatys.com>
# fix locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV PG_VERSION 9.4
ENV PGIS_VERSION 2.1
# Add the PostgreSQL PGP key to verify their Debian packages
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN apt-key adv \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main $PG_VERSION" \
> /etc/apt/sources.list.d/pgdg.list && \
apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y \
curl \
libpq5 \
psmisc \
postgresql-$PG_VERSION \
postgresql-client-$PG_VERSION \
postgresql-$PG_VERSION-postgis-$PGIS_VERSION
#>> Cleanup
RUN rm -rf /var/lib/apt/lists/* /tmp/* && \
apt-get autoremove -y && \
apt-get autoclean
# install gosu
RUN curl -o /usr/local/bin/gosu -sSL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture)" \
&& chmod +x /usr/local/bin/gosu
ENV PGDATA /var/rhomeo/pgdata
VOLUME /var/rhomeo/pgdata
ADD entrypoint-postgres.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 5432
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["postgres"]
+65
View File
@@ -0,0 +1,65 @@
#!/bin/sh
set -e
STDERR () {
cat - 1>&2
}
if [ "$1" = 'postgres' ]; then
# exit if postgres directory does not already exist
[ -d "$PGDATA" ] || (echo "PGDATA=$PGDATA does not exist" | STDERR && exit 1)
echo '##### chown'
chown -R postgres "$PGDATA"
# if data directory does not have any files
# initialize database in its place
if [ -z "$(ls -A "$PGDATA")" ]; then
gosu postgres /usr/lib/postgresql/$PG_VERSION/bin/initdb --encoding="UTF8"
sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf
{ echo; echo 'host all all 0.0.0.0/0 md5'; } >> "$PGDATA"/pg_hba.conf
echo '##### start postgresql for cstl init'
exec gosu postgres /usr/lib/postgresql/$PG_VERSION/bin/"$@" -D "$PGDATA" -c config_file="$PGDATA"/postgresql.conf &
# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"
sleep 5
echo 'creating cstl user'
gosu postgres createuser -d -r -s cstl
echo 'created cstl user'
gosu postgres createdb -O cstl -E UTF8 -T template0 constellation
echo 'creating cstl db'
# alter cstl user and role
gosu postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE constellation to cstl; ALTER ROLE cstl WITH PASSWORD 'admin'"
echo 'altered cstl user'
# create rhomeo database for referential geodata
echo 'creating rhomeo user'
gosu postgres createuser -d -r -s rhomeo
echo 'created rhomeo user'
gosu postgres createdb -O rhomeo -E UTF8 -T template0 referential
echo 'creating referential db'
gosu postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE referential to rhomeo; ALTER ROLE rhomeo WITH PASSWORD 'espaces naturels !'"
echo 'altered rhomeo user'
echo 'creating postgis extension'
gosu postgres psql -d referential -c "CREATE EXTENSION postgis;"
echo 'created postgis extension'
kill -INT `head -1 "$PGDATA"/postmaster.pid`
sleep 5
echo 'kill postgresql'
fi
fi
# command is a postgres executable hence execute it as postgres user
if [ -x /usr/lib/postgresql/"$PG_VERSION"/bin/"$1" ]; then
echo "executing as postgres user"
exec gosu postgres /usr/lib/postgresql/$PG_VERSION/bin/"$@" -D "$PGDATA" -c config_file="$PGDATA"/postgresql.conf
else
echo "executing what else"
exec "$@"
fi
+50
View File
@@ -0,0 +1,50 @@
version: '2'
services:
cstl-data:
build: cstl-data
# Note : Activates following lines to mount Constellation data (integrated files + admin database) from host file-system.
# volumes:
# - /data/dir/pgdata:/var/rhomeo/pgdata
# - /data/dir/cstl:/var/rhomeo/cstl
db:
build: db
depends_on:
- cstl-data
volumes_from:
- cstl-data
ports:
- "5433:5432"
ftp:
build: ftp
# Note : Activates following lines to mount ftp data from host file-system.
# volumes:
# - /data/dir:/var/rhomeo/ftp
hostname: rhomeo-ftp
ports:
- "20:20"
- "21:21"
cstl:
build: constellation
depends_on:
- cstl-data
- db
volumes_from:
- cstl-data
volumes:
- ./webapps:/opt/apache-tomcat-7.0.69/webapps
ports:
- "8080:8080"
- "8000:8000"
links:
- db
environment :
DB_URL: postgres://cstl:admin@db:5432/constellation
DATABASE_URL: postgres://cstl:admin@db:5432/constellation
EPSG_DATABASE_URL: postgres://cstl:admin@db:5432/constellation
DATA: /var/rhomeo/cstl
CSTL_URL: http://constellation.cenra-outils.org
+32
View File
@@ -0,0 +1,32 @@
FROM alpine:3.3
MAINTAINER Alexis Manin <alexis.manin@geomatys.com>
# fix locale
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Install needed programs
RUN apk update
RUN apk add vsftpd
RUN apk add supervisor
# Configure FTP service
ADD vsftpd.conf /etc/
# Supervisor configuration
ADD supervisord.conf /etc/
RUN mkdir -p /var/rhomeo/ftp
# Configure FTP users
RUN addgroup ftpusers
ADD userpass /tmp/
RUN adduser rhomeoftp -G ftpusers -h /var/rhomeo/ftp < /tmp/userpass && rm /tmp/userpass
VOLUME /var/rhomeo/ftp
EXPOSE 20 21
ENTRYPOINT ["supervisord"]
+12
View File
@@ -0,0 +1,12 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord.log
logfile_maxbytes=2MB
logfile_backups=10
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[program:vsftpd]
command=/usr/sbin/vsftpd /etc/vsftpd.conf
+2
View File
@@ -0,0 +1,2 @@
espaces naturels !
espaces naturels !
+162
View File
@@ -0,0 +1,162 @@
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default)
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in your local time zone. The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
#secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
# FTP directory
local_root=/var/rhomeo/ftp
# Fix for socket error
seccomp_sandbox=NO
#allow_writeable_chroot=YES
# Enable passive mode
pasv_enable=No
#pasv_min_port=40000
#pasv_max_port=40100
listen_port=21
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
docker-compose stop
docker-compose kill
docker-compose up -d db
sleep 10
docker-compose up