Update lxcfiles to LXC 3

This commit is contained in:
Disassembler 2018-09-07 15:47:44 +02:00
parent bed2d7f5f6
commit 89126185eb
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
20 changed files with 36 additions and 51 deletions

View File

@ -1,3 +0,0 @@
#!/bin/sh
/bin/true

View File

@ -1,5 +0,0 @@
#!/bin/execlineb -P
fdmove -c 2 1
s6-setuidgid 61616:61616
/srv/activemq/bin/activemq console

View File

@ -22,4 +22,5 @@ COPY lxc
MOUNT /srv/activemq/data srv/activemq/data MOUNT /srv/activemq/data srv/activemq/data
CMD s6-svscan /etc/services.d USER 61616 61616
CMD /srv/activemq/bin/activemq console

View File

@ -3,13 +3,13 @@
description="ActiveMQ container" description="ActiveMQ container"
depend() { depend() {
need lxc need cgroups
} }
start() { start() {
/usr/bin/lxc-start -n activemq /usr/bin/lxc-start activemq
} }
stop() { stop() {
/usr/bin/lxc-stop -n activemq /usr/bin/lxc-stop activemq
} }

View File

@ -4,5 +4,3 @@ LAYER shared/alpine
SCRIPT SCRIPT
apk --no-cache add s6 apk --no-cache add s6
RUN RUN
COPY /usr/sbin/init.lxc.static

View File

@ -4,7 +4,7 @@ set -e
SOURCE_DIR=$(realpath $(dirname "${0}"))/basic SOURCE_DIR=$(realpath $(dirname "${0}"))/basic
# Install packages # Install packages
apk --no-cache add curl bridge e2fsprogs-extra gettext iptables kbd-misc libressl python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux apk --no-cache add curl bridge e2fsprogs-extra gettext iptables kbd-misc libacap libressl libseccomp python3 py3-bcrypt py3-cffi py3-dnspython py3-jinja2 py3-requests py3-six py3-werkzeug nginx util-linux
if [ ${DEBUG:-0} -eq 1 ]; then if [ ${DEBUG:-0} -eq 1 ]; then
# Install some utilities for DEBUG mode # Install some utilities for DEBUG mode
apk --no-cache add git file htop less openssh-server openssh-sftp-server apk --no-cache add git file htop less openssh-server openssh-sftp-server
@ -39,7 +39,6 @@ cp ${SOURCE_DIR}/etc/iptables/rules-save /etc/iptables/rules-save
cp ${SOURCE_DIR}/etc/network/interfaces /etc/network/interfaces cp ${SOURCE_DIR}/etc/network/interfaces /etc/network/interfaces
service networking restart service networking restart
service iptables restart service iptables restart
echo -e "172.17.0.1 host\n172.17.0.1 postfix" >>/etc/hosts
# Download and configure acme.sh # Download and configure acme.sh
mkdir /etc/acme.sh.d mkdir /etc/acme.sh.d
@ -47,8 +46,9 @@ wget https://raw.githubusercontent.com/Neilpang/acme.sh/master/acme.sh -O /usr/b
sed -i 's|$HOME/.$PROJECT_NAME|/etc/acme.sh.d|' /usr/bin/acme.sh sed -i 's|$HOME/.$PROJECT_NAME|/etc/acme.sh.d|' /usr/bin/acme.sh
chmod +x /usr/bin/acme.sh chmod +x /usr/bin/acme.sh
# Download LXC # Download and configure LXC
wget https://dl.dasm.cz/lxc.tar.xz -O - | tar xJf - -C / wget https://dl.dasm.cz/lxc.tar.xz -O - | tar xJf - -C /
echo -e "172.17.0.1 host" >>/etc/hosts
# Copy VMMgr resources # Copy VMMgr resources
cp ${SOURCE_DIR}/etc/init.d/vmmgr /etc/init.d/vmmgr cp ${SOURCE_DIR}/etc/init.d/vmmgr /etc/init.d/vmmgr
@ -63,7 +63,7 @@ vmmgr create-selfsigned
cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf cp ${SOURCE_DIR}/etc/nginx/nginx.conf /etc/nginx/nginx.conf
# Configure services # Configure services
for SERVICE in cgroups consolefont crond iptables nginx ntpd swap vmmgr; do for SERVICE in consolefont crond iptables nginx ntpd swap vmmgr; do
rc-update add ${SERVICE} boot rc-update add ${SERVICE} boot
service ${SERVICE} start service ${SERVICE} start
done done

View File

@ -1,3 +0,0 @@
#!/bin/sh
/bin/true

View File

@ -1,6 +1,5 @@
#!/bin/execlineb -P #!/bin/execlineb -P
fdmove -c 2 1
foreground { /bin/add-ca-cert } foreground { /bin/add-ca-cert }
s6-setuidgid 8004:8004 s6-setuidgid 8004:8004
/usr/sbin/uwsgi --plugin python --http-socket 0.0.0.0:8080 --wsgi-file /etc/ckan-datapusher/datapusher.wsgi --enable-threads /usr/sbin/uwsgi --plugin python --http-socket 0.0.0.0:8080 --wsgi-file /etc/ckan-datapusher/datapusher.wsgi --enable-threads

View File

@ -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/conf etc/ckan-datapusher
VOLUME /srv/ckan-datapusher/data srv/ckan-datapusher/data VOLUME /srv/ckan-datapusher/data srv/ckan-datapusher/data
CMD s6-svscan /etc/services.d CMD /bin/execlineb -P /run

View File

@ -3,13 +3,13 @@
description="CKAN DataPusher container" description="CKAN DataPusher container"
depend() { depend() {
need lxc need cgroups
} }
start() { start() {
lxc-start -n ckan-datapusher lxc-start ckan-datapusher
} }
stop() { stop() {
lxc-stop -n ckan-datapusher lxc-stop ckan-datapusher
} }

View File

@ -52,4 +52,4 @@ COPY lxc
MOUNT /srv/ckan/conf etc/ckan MOUNT /srv/ckan/conf etc/ckan
MOUNT /srv/ckan/data srv/ckan/storage MOUNT /srv/ckan/data srv/ckan/storage
CMD s6-svscan /etc/services.d CMD /bin/s6-svscan /etc/services.d

View File

@ -14,7 +14,7 @@ export CKAN_DS_PWD=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
# Configure CKAN Solr core # Configure CKAN Solr core
lxc-execute -n solr -- solr create -p 8983 -c ckan # TODO lxc-execute 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/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 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 chown 8983:8983 /srv/solr/data/ckan/conf/schema.xml
@ -33,9 +33,9 @@ if [ ${DEBUG:-0} -eq 0 ]; then
fi fi
# Populate database # Populate database
lxc-execute -n ckan -- paster --plugin=ckan db init -c /etc/ckan/ckan.ini lxc-execute 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 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-attach -n postgres -- psql lxc-execute ckan -- paster --plugin=ckan datastore set-permissions -c /etc/ckan/ckan.ini # TODO | lxc-attach -n postgres -- psql
chown -R 8003:8003 /srv/ckan/data chown -R 8003:8003 /srv/ckan/data
# Create admin account # Create admin account

View File

@ -3,11 +3,11 @@
description="CKAN container" description="CKAN container"
depend() { depend() {
need lxc ckan-datapusher postgres redis solr need cgroups ckan-datapusher postgres redis solr
} }
start() { start() {
lxc-start -n ckan lxc-start ckan
} }
start_post() { start_post() {
@ -19,5 +19,5 @@ stop_pre() {
} }
stop() { stop() {
lxc-stop -n ckan lxc-stop ckan
} }

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
# TODO
if docker ps | grep -q 'ckan$'; then if docker ps | grep -q 'ckan$'; then
lxc-execute -n ckan -- paster --plugin=ckan tracking update -c /etc/ckan/ckan.ini >/dev/null lxc-execute 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 lxc-execute ckan -- paster --plugin=ckan search-index rebuild -r -c /etc/ckan/ckan.ini >/dev/null
fi fi

View File

@ -21,4 +21,4 @@ RUN
MOUNT /srv/postgres/data var/lib/postgresql MOUNT /srv/postgres/data var/lib/postgresql
USER 5432 5432 USER 5432 5432
CMD s6-setuidgid 5432:5432 /usr/bin/postgres -D /var/lib/postgresql CMD /usr/bin/postgres -D /var/lib/postgresql

View File

@ -3,11 +3,11 @@
description="Postgres container" description="Postgres container"
depend() { depend() {
need lxc need cgroups
} }
start() { start() {
lxc-start -n postgres lxc-start postgres
} }
start_post() { start_post() {
@ -15,5 +15,5 @@ start_post() {
} }
stop() { stop() {
lxc-stop -n postgres lxc-stop postgres
} }

View File

@ -15,4 +15,4 @@ MOUNT /srv/redis/conf/redis.conf etc/redis.conf
MOUNT /srv/redis/data var/lib/redis MOUNT /srv/redis/data var/lib/redis
USER 6379 6379 USER 6379 6379
CMD s6-setuidgid 6379:6379 /usr/bin/redis-server /etc/redis.conf CMD /usr/bin/redis-server /etc/redis.conf

View File

@ -3,13 +3,13 @@
description="Redis container" description="Redis container"
depend() { depend() {
need lxc need cgroups
} }
start() { start() {
lxc-start -n redis lxc-start redis
} }
stop() { stop() {
lxc-stop -n redis lxc-stop redis
} }

View File

@ -19,12 +19,9 @@ SCRIPT
# Copy basic configuration file to data location # Copy basic configuration file to data location
cp -p /opt/solr/server/solr/solr.xml /var/lib/solr/solr.xml 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 RUN
MOUNT /srv/solr/data var/lib/solr MOUNT /srv/solr/data var/lib/solr
USER 8983 8983 USER 8983 8983
CMD s6-setuidgid 5432:5432 /usr/bin/solr start -f CMD /opt/solr/bin/solr start -f

View File

@ -3,13 +3,13 @@
description="Solr container" description="Solr container"
depend() { depend() {
need lxc need cgroups
} }
start() { start() {
lxc-start -n solr lxc-start solr
} }
stop() { stop() {
lxc-stop -n solr lxc-stop solr
} }