CKAN + deps stup test
This commit is contained in:
parent
402ac5a469
commit
1b07ef795e
@ -22,7 +22,7 @@ RUN
|
||||
|
||||
COPY lxc
|
||||
|
||||
CMD /bin/s6-svscan /etc/services.d
|
||||
CMD s6-svscan /etc/services.d
|
||||
|
||||
LAYER activemq/delta0
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/activemq/setup
|
||||
|
||||
# Create service
|
||||
cp ${SOURCE_DIR}/etc/init.d/activemq /etc/init.d/activemq
|
||||
rc-update -u
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Configure ActiveMQ
|
||||
mkdir -p /srv/activemq/data
|
||||
chown -R 61616:61616 /srv/activemq/data
|
||||
|
||||
# Create service
|
||||
cp ${SOURCE_DIR}/etc/init.d/activemq /etc/init.d/activemq
|
||||
rc-update -u
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="ActiveMQ docker container"
|
||||
description="ActiveMQ container"
|
||||
|
||||
depend() {
|
||||
need lxc
|
||||
|
@ -41,4 +41,4 @@ VOLUME /etc/ssl/services.pem etc/ssl/services.pem
|
||||
VOLUME /srv/ckan-datapusher/conf etc/ckan-datapusher
|
||||
VOLUME /srv/ckan-datapusher/data srv/ckan-datapusher/data
|
||||
|
||||
CMD /bin/s6-svscan /etc/services.d
|
||||
CMD s6-svscan /etc/services.d
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan-datapusher
|
||||
|
||||
# Build Docker container
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher
|
||||
rc-update -u
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Configure CKAN DataPusher
|
||||
mkdir -p /srv/ckan-datapusher/conf /srv/ckan-datapusher/data
|
||||
cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher.wsgi /srv/ckan-datapusher/conf/datapusher.wsgi
|
||||
cp ${SOURCE_DIR}/srv/ckan-datapusher/conf/datapusher_settings.py /srv/ckan-datapusher/conf/datapusher_settings.py
|
||||
chown -R 8004:8004 /srv/ckan-datapusher/data
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckan-datapusher /etc/init.d/ckan-datapusher
|
||||
rc-update -u
|
||||
|
@ -1,21 +1,15 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="CKAN DataPusher docker container"
|
||||
description="CKAN DataPusher container"
|
||||
|
||||
depend() {
|
||||
need docker
|
||||
need lxc
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ckan-datapusher \
|
||||
-h ckan-datapusher \
|
||||
-v /etc/ssl/services.pem:/etc/ssl/services.pem \
|
||||
-v /srv/ckan-datapusher/conf:/etc/ckan-datapusher \
|
||||
-v /srv/ckan-datapusher/data:/srv/ckan-datapusher/data \
|
||||
ckan-datapusher
|
||||
lxc-start -n ckan-datapusher
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ckan-datapusher
|
||||
lxc-stop -n ckan-datapusher
|
||||
}
|
||||
|
@ -52,4 +52,4 @@ COPY lxc
|
||||
MOUNT /srv/ckan/conf etc/ckan
|
||||
MOUNT /srv/ckan/data srv/ckan/storage
|
||||
|
||||
CMD /bin/s6-svscan /etc/services.d
|
||||
CMD s6-svscan /etc/services.d
|
||||
|
@ -1,24 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/ckan
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Check prerequisites
|
||||
service postgres start
|
||||
service redis start
|
||||
service solr start
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan
|
||||
rc-update -u
|
||||
|
||||
# Create database
|
||||
export CKAN_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Configure CKAN Solr core
|
||||
docker exec solr solr create -p 8983 -c ckan
|
||||
lxc-execute -n solr -- solr create -p 8983 -c ckan
|
||||
cp ${SOURCE_DIR}/srv/solr/data/ckan/conf/schema.xml /srv/solr/data/ckan/conf/schema.xml
|
||||
cp ${SOURCE_DIR}/srv/solr/data/ckan/conf/solrconfig.xml /srv/solr/data/ckan/conf/solrconfig.xml
|
||||
chown 8983:8983 /srv/solr/data/ckan/conf/schema.xml
|
||||
@ -37,9 +33,9 @@ if [ ${DEBUG:-0} -eq 0 ]; then
|
||||
fi
|
||||
|
||||
# Populate database
|
||||
docker run --rm -h ckan --link postgres --link redis --link solr -v /srv/ckan/conf:/etc/ckan -v /srv/ckan/data:/srv/ckan/storage ckan paster --plugin=ckan db init -c /etc/ckan/ckan.ini
|
||||
docker run --rm -h ckan --link postgres --link redis --link solr -v /srv/ckan/conf:/etc/ckan -v /srv/ckan/data:/srv/ckan/storage ckan paster --plugin=ckanext-spatial spatial initdb -c /etc/ckan/ckan.ini
|
||||
docker run --rm -h ckan --link postgres --link redis --link solr -v /srv/ckan/conf:/etc/ckan -v /srv/ckan/data:/srv/ckan/storage ckan paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | docker exec -i postgres psql
|
||||
lxc-execute -n ckan -- paster --plugin=ckan db init -c /etc/ckan/ckan.ini
|
||||
lxc-execute -n ckan -- paster --plugin=ckanext-spatial spatial initdb -c /etc/ckan/ckan.ini
|
||||
lxc-execute -n ckan -- paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini | lxc-execute -n postgres -- psql
|
||||
chown -R 8003:8003 /srv/ckan/data
|
||||
|
||||
# Create admin account
|
||||
@ -55,6 +51,10 @@ vmmgr update-login ckan "${CKAN_ADMIN_USER}" "${CKAN_ADMIN_PWD}"
|
||||
# Install cron job
|
||||
cp ${SOURCE_DIR}/etc/periodic/hourly/ckan /etc/periodic/hourly/ckan
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/ckan /etc/init.d/ckan
|
||||
rc-update -u
|
||||
|
||||
# Stop services required for build
|
||||
service solr stop
|
||||
service redis stop
|
||||
|
@ -1,33 +1,23 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="CKAN docker container"
|
||||
description="CKAN container"
|
||||
|
||||
depend() {
|
||||
need docker ckan-datapusher postfix postgres redis solr
|
||||
need lxc ckan-datapusher postgres redis solr
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name ckan \
|
||||
-h ckan \
|
||||
--link ckan-datapusher \
|
||||
--link postfix \
|
||||
--link postgres \
|
||||
--link redis \
|
||||
--link solr \
|
||||
-v /srv/ckan/conf:/etc/ckan \
|
||||
-v /srv/ckan/data:/srv/ckan/storage \
|
||||
ckan
|
||||
lxc-start -n ckan
|
||||
}
|
||||
|
||||
start_post() {
|
||||
/usr/bin/vmmgr register-proxy ckan
|
||||
# /usr/bin/vmmgr register-proxy ckan
|
||||
}
|
||||
|
||||
stop_pre() {
|
||||
/usr/bin/vmmgr unregister-proxy ckan
|
||||
# /usr/bin/vmmgr unregister-proxy ckan
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop ckan
|
||||
lxc-stop -n ckan
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if docker ps | grep -q 'ckan$'; then
|
||||
docker exec ckan paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null
|
||||
docker exec ckan paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null
|
||||
lxc-execute -n ckan -- paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null
|
||||
lxc-execute -n ckan -- paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null
|
||||
fi
|
||||
|
@ -1,17 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/postgres
|
||||
|
||||
# Build Docker container
|
||||
cp ${SOURCE_DIR}/etc/init.d/postgres /etc/init.d/postgres
|
||||
rc-update -u
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Create Postgres instance
|
||||
mkdir -p /srv/postgres/data
|
||||
chown -R 5432:5432 /srv/postgres/data
|
||||
chmod 700 /srv/postgres/data
|
||||
docker run --rm --name postgres -h postgres -v /srv/postgres/data:/var/lib/postgresql postgres initdb -D /var/lib/postgresql
|
||||
lxc-execute -n postgres -- postgres initdb -D /var/lib/postgresql
|
||||
|
||||
# Configure Postgres
|
||||
cp ${SOURCE_DIR}/srv/postgres/data/postgresql.conf /srv/postgres/data/postgresql.conf
|
||||
@ -21,3 +17,7 @@ if [ ${DEBUG:-0} -eq 1 ]; then
|
||||
sed -i 's/^#log_destination/log_destination/' /srv/postgres/data/postgresql.conf
|
||||
sed -i 's/^#log_statement/log_statement/' /srv/postgres/data/postgresql.conf
|
||||
fi
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/postgres /etc/init.d/postgres
|
||||
rc-update -u
|
||||
|
@ -1,23 +1,19 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Postgres docker container"
|
||||
description="Postgres container"
|
||||
|
||||
depend() {
|
||||
need docker
|
||||
need lxc
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name postgres \
|
||||
-h postgres \
|
||||
-v /srv/postgres/data:/var/lib/postgresql \
|
||||
postgres
|
||||
lxc-start -n postgres
|
||||
}
|
||||
|
||||
start_post() {
|
||||
timeout -t 60 docker exec postgres sh -c 'until [ -e /var/run/postgresql/.s.PGSQL.5432 ]; do usleep 50000; done'
|
||||
ewaitfile 60 /var/lib/lxc/postgres/delta0/var/run/postgresql/.s.PGSQL.5432
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop postgres
|
||||
lxc-stop -n postgres
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ MOUNT /srv/redis/conf/redis.conf etc/redis.conf
|
||||
MOUNT /srv/redis/data var/lib/redis
|
||||
|
||||
USER 6379 6379
|
||||
CMD /usr/bin/redis-server /etc/redis.conf
|
||||
CMD redis-server /etc/redis.conf
|
||||
|
@ -1,14 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/redis
|
||||
|
||||
# Build Docker container
|
||||
docker build -t redis ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/redis /etc/init.d/redis
|
||||
rc-update -u
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Configure Redis
|
||||
mkdir -p /srv/redis/conf /srv/redis/data
|
||||
cp ${SOURCE_DIR}/srv/redis/conf/redis.conf /srv/redis/conf/redis.conf
|
||||
chown -R 6379:6379 /srv/redis/data
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/redis /etc/init.d/redis
|
||||
rc-update -u
|
||||
|
@ -1,20 +1,15 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Redis docker container"
|
||||
description="Redis container"
|
||||
|
||||
depend() {
|
||||
need docker
|
||||
need lxc
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name redis \
|
||||
-h redis \
|
||||
-v /srv/redis/conf/redis.conf:/etc/redis.conf \
|
||||
-v /srv/redis/data:/var/lib/redis \
|
||||
redis
|
||||
lxc-start -n redis
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop redis
|
||||
lxc-stop -n redis
|
||||
}
|
||||
|
@ -21,9 +21,12 @@ SCRIPT
|
||||
|
||||
# Copy basic configuration file to data location
|
||||
cp -p /opt/solr/server/solr/solr.xml /var/lib/solr/solr.xml
|
||||
|
||||
# Make start/stop script visible globally
|
||||
ln -s /opt/solr/bin/solr /usr/bin/solr
|
||||
RUN
|
||||
|
||||
MOUNT /srv/solr/data var/lib/solr
|
||||
|
||||
USER 8983 8983
|
||||
CMD /opt/solr/bin/solr start -f
|
||||
CMD solr start -f
|
||||
|
@ -1,15 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/solr
|
||||
|
||||
# Build Docker container
|
||||
docker build -t solr ${SOURCE_DIR}
|
||||
cp ${SOURCE_DIR}/etc/init.d/solr /etc/init.d/solr
|
||||
rc-update -u
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/setup
|
||||
|
||||
# Configure Solr
|
||||
mkdir -p /srv/solr/data
|
||||
cp ${SOURCE_DIR}/srv/solr/data/solr.xml /srv/solr/data/solr.xml
|
||||
cp ${SOURCE_DIR}/srv/solr/data/.solr.in.sh /srv/solr/data/.solr.in.sh
|
||||
chown -R 8983:8983 /srv/solr/data
|
||||
|
||||
# Install service
|
||||
cp ${SOURCE_DIR}/etc/init.d/solr /etc/init.d/solr
|
||||
rc-update -u
|
||||
|
@ -1,19 +1,15 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Solr docker container"
|
||||
description="Solr container"
|
||||
|
||||
depend() {
|
||||
need docker
|
||||
need lxc
|
||||
}
|
||||
|
||||
start() {
|
||||
/usr/bin/docker run -d --rm \
|
||||
--name solr \
|
||||
-h solr \
|
||||
-v /srv/solr/data:/var/lib/solr \
|
||||
solr
|
||||
lxc-start -n solr
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/bin/docker stop solr
|
||||
lxc-stop -n solr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user