Use install binary to copy / create CKAN files

This commit is contained in:
Disassembler 2020-03-16 19:13:43 +01:00
parent 4e0cbe0dcb
commit b55a5dfdbd
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
2 changed files with 19 additions and 26 deletions

@ -1 +1 @@
Subproject commit c1e60a4adf6339c0390e66ab07b63a242442d52a Subproject commit fc42131bb6acaa9d474930add14f9e7fdf055bf5

View File

@ -12,14 +12,12 @@ CKAN_CONF="${VOLUMES_DIR}/ckan/ckan_conf"
CKAN_DATA="${VOLUMES_DIR}/ckan/ckan_data" CKAN_DATA="${VOLUMES_DIR}/ckan/ckan_data"
# Create Postgres instance # Create Postgres instance
mkdir -p ${POSTGRES_DATA} install -o 105432 -g 105432 -m 700 -d ${POSTGRES_DATA}
chown -R 105432:105432 ${POSTGRES_DATA}
chmod 700 ${POSTGRES_DATA}
spoc-container exec ckan-postgres -- initdb -D /var/lib/postgresql spoc-container exec ckan-postgres -- initdb -D /var/lib/postgresql
# Configure Postgres # Configure Postgres
cp postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf install postgres_data/postgresql.conf ${POSTGRES_DATA}/postgresql.conf
cp postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf install postgres_data/pg_hba.conf ${POSTGRES_DATA}/pg_hba.conf
# Create database # Create database
export CKAN_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export CKAN_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
@ -28,41 +26,36 @@ spoc-container start ckan-postgres
envsubst <createdb.sql | spoc-container exec ckan-postgres -- psql envsubst <createdb.sql | spoc-container exec ckan-postgres -- psql
# Configure Redis # Configure Redis
mkdir -p ${REDIS_CONF} ${REDIS_DATA} install -o 100000 -g 100000 -d ${REDIS_CONF}
cp redis_conf/redis.conf ${REDIS_CONF}/redis.conf install -o 106379 -g 106379 -d ${REDIS_DATA}
chown -R 100000:100000 ${REDIS_CONF} install -o 106379 -g 106379 redis_conf/redis.conf ${REDIS_CONF}/redis.conf
chown -R 106379:106379 ${REDIS_DATA}
spoc-container start ckan-redis spoc-container start ckan-redis
# Configure Solr # Configure Solr
mkdir -p ${SOLR_DATA} install -o 108983 -g 108983 -d ${SOLR_DATA}
cp ${LAYERS_DIR}/solr6_6.5.1-200313/opt/solr/server/solr/solr.xml ${SOLR_DATA}/solr.xml install -o 108983 -g 108983 ${LAYERS_DIR}/solr6_6.5.1-200313/opt/solr/server/solr/solr.xml ${SOLR_DATA}/solr.xml
chown -R 108983:108983 ${SOLR_DATA}
spoc-container start ckan-solr spoc-container start ckan-solr
# Configure CKAN Solr core # Configure CKAN Solr core
spoc-container exec ckan-solr -- solr create -p 8983 -c ckan spoc-container exec ckan-solr -- solr create -p 8983 -c ckan
spoc-container stop ckan-solr spoc-container stop ckan-solr
cp solr_data/ckan/conf/schema.xml ${SOLR_DATA}/ckan/conf/schema.xml install -o 108983 -g 108983 solr_data/ckan/conf/schema.xml ${SOLR_DATA}/ckan/conf/schema.xml
cp solr_data/ckan/conf/solrconfig.xml ${SOLR_DATA}/ckan/conf/solrconfig.xml install -o 108983 -g 108983 solr_data/ckan/conf/solrconfig.xml ${SOLR_DATA}/ckan/conf/solrconfig.xml
chown -R 108983:108983 ${SOLR_DATA}
spoc-container start ckan-solr spoc-container start ckan-solr
# Configure CKAN DataPusher # Configure CKAN DataPusher
mkdir -p ${DATAPUSHER_CONF} ${DATAPUSHER_DATA} install -o 100000 -g 100000 -d ${DATAPUSHER_CONF}
cp datapusher_conf/datapusher.wsgi ${DATAPUSHER_CONF}/datapusher.wsgi install -o 108080 -g 108080 -d ${DATAPUSHER_DATA}
cp datapusher_conf/datapusher_settings.py ${DATAPUSHER_CONF}/datapusher_settings.py install -o 100000 -g 100000 datapusher_conf/datapusher.wsgi ${DATAPUSHER_CONF}/datapusher.wsgi
chown -R 100000:100000 ${DATAPUSHER_CONF} install -o 100000 -g 100000 datapusher_conf/datapusher_settings.py ${DATAPUSHER_CONF}/datapusher_settings.py
chown -R 108080:108080 ${DATAPUSHER_DATA}
# Configure CKAN # Configure CKAN
mkdir -p ${CKAN_CONF} ${CKAN_DATA} install -o 100000 -g 100000 -d ${CKAN_CONF}
install -o 108080 -g 108080 -d ${CKAN_DATA}
export CKAN_SECRET=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') export CKAN_SECRET=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
export CKAN_UUID=$(cat /proc/sys/kernel/random/uuid) export CKAN_UUID=$(cat /proc/sys/kernel/random/uuid)
envsubst <ckan_conf/ckan.ini >${CKAN_CONF}/ckan.ini envsubst <ckan_conf/ckan.ini | install -o 100000 -g 100000 /dev/stdin ${CKAN_CONF}/ckan.ini
cp ckan_conf/who.ini ${CKAN_CONF}/who.ini install -o 100000 -g 100000 ckan_conf/who.ini ${CKAN_CONF}/who.ini
chown -R 100000:100000 ${CKAN_CONF}
chown -R 108080:108080 ${CKAN_DATA}
# Populate database # Populate database
spoc-container exec ckan -- paster --plugin=ckan db init -c /etc/ckan/ckan.ini spoc-container exec ckan -- paster --plugin=ckan db init -c /etc/ckan/ckan.ini