ソースを参照

Convert to multi-arch

multi_domain
ßingen 7年前
コミット
ba2172e829
94個のファイルの変更448行の追加73行の削除
  1. +3
    -3
      README.md
  2. +3
    -0
      add_dns_entries.sh
  3. +4
    -2
      add_users.sh
  4. +17
    -9
      deploy.sh
  5. +21
    -21
      docker-compose.yml
  6. +2
    -0
      env.template
  7. +0
    -0
      images/email/.gitignore
  8. +1
    -1
      images/email/Dockerfile
  9. +26
    -0
      images/email/Dockerfile.template
  10. +0
    -0
      images/email/LICENSE
  11. +0
    -0
      images/email/README.md
  12. +0
    -0
      images/email/config/dovecot/conf.d/10-auth.conf
  13. +0
    -0
      images/email/config/dovecot/conf.d/10-logging.conf
  14. +0
    -0
      images/email/config/dovecot/conf.d/10-master.conf
  15. +0
    -0
      images/email/config/dovecot/conf.d/10-ssl.conf
  16. +0
    -0
      images/email/config/dovecot/conf.d/15-lda.conf
  17. +0
    -0
      images/email/config/dovecot/dovecot-ldap.conf.ext
  18. +0
    -0
      images/email/config/postfix/drop.cidr
  19. +0
    -0
      images/email/config/postfix/identitycheck.pcre
  20. +0
    -0
      images/email/config/postfix/ldap_virtual_aliases.cf
  21. +0
    -0
      images/email/config/postfix/ldap_virtual_recipients.cf
  22. +0
    -0
      images/email/config/postfix/main.cf
  23. +0
    -0
      images/email/config/postfix/master.cf
  24. +0
    -0
      images/email/config/postfix/sasl/smtpd.conf
  25. +0
    -0
      images/email/config/postfix/virtual_domains
  26. +0
    -0
      images/email/config/saslauth/saslauthd
  27. +0
    -0
      images/email/config/saslauth/saslauthd.conf
  28. +0
    -0
      images/email/getmail/template.getmailrc-example
  29. +0
    -0
      images/email/startup.sh
  30. +3
    -3
      images/gogs/Dockerfile
  31. +81
    -0
      images/gogs/Dockerfile.template
  32. +0
    -0
      images/gogs/LICENSE
  33. +0
    -0
      images/gogs/README.md
  34. +0
    -0
      images/gogs/app.ini
  35. +9
    -6
      images/gogs/docker-entrypoint.sh
  36. +0
    -0
      images/gogs/ldap.conf
  37. +2
    -2
      images/haproxy/Dockerfile
  38. +19
    -0
      images/haproxy/Dockerfile.template
  39. +0
    -0
      images/haproxy/LICENSE
  40. +0
    -0
      images/haproxy/README.md
  41. +0
    -0
      images/haproxy/haproxy.cfg
  42. +0
    -0
      images/haproxy/haproxy_letsencrypt.cfg
  43. +0
    -0
      images/haproxy/letsencrypt.cron
  44. +0
    -0
      images/haproxy/startup.sh
  45. +42
    -0
      images/mariadb/Dockerfile
  46. +8
    -14
      images/mariadb/Dockerfile.template
  47. +0
    -0
      images/mariadb/README.md
  48. +0
    -0
      images/mariadb/mysqltuner.pl
  49. +3
    -3
      images/mariadb/startup.sh
  50. +0
    -0
      images/mariadb/tuning-primer.sh
  51. +0
    -0
      images/mariadb/tuning.cnf
  52. +2
    -2
      images/nextcloud/Dockerfile
  53. +58
    -0
      images/nextcloud/Dockerfile.template
  54. +0
    -0
      images/nextcloud/LICENSE
  55. +0
    -0
      images/nextcloud/README.md
  56. +0
    -0
      images/nextcloud/backup.sh
  57. +0
    -0
      images/nextcloud/default
  58. +2
    -1
      images/nextcloud/docker-entrypoint.sh
  59. +0
    -0
      images/nextcloud/php_nc.ini
  60. +1
    -1
      images/nginx-php/Dockerfile
  61. +18
    -0
      images/nginx-php/Dockerfile.template
  62. +0
    -0
      images/nginx-php/README.md
  63. +0
    -0
      images/nginx-php/default
  64. +1
    -1
      images/nginx/Dockerfile
  65. +25
    -0
      images/nginx/Dockerfile.template
  66. +0
    -0
      images/nginx/README.md
  67. +0
    -0
      images/openldap/.gitignore
  68. +3
    -2
      images/openldap/Dockerfile
  69. +41
    -0
      images/openldap/Dockerfile.template
  70. +0
    -0
      images/openldap/LICENSE
  71. +0
    -0
      images/openldap/README.md
  72. +0
    -0
      images/openldap/data/000-addou_people.ldif
  73. +0
    -0
      images/openldap/data/000-addou_services.ldif
  74. +0
    -0
      images/openldap/data/000_admin_ext.ldif
  75. +0
    -0
      images/openldap/data/001_admin_mail.ldif
  76. +0
    -0
      images/openldap/data/_acl_add_0.ldif
  77. +0
    -0
      images/openldap/data/_acl_add_1.ldif
  78. +0
    -0
      images/openldap/data/_acl_del.ldif
  79. +0
    -0
      images/openldap/data/_postfix-book.ldif
  80. +0
    -0
      images/openldap/data/postfix-book.schema
  81. +0
    -0
      images/openldap/data/serviceimport_gogs.ldif
  82. +0
    -0
      images/openldap/data/serviceimport_mail.ldif
  83. +0
    -0
      images/openldap/data/serviceimport_nextcloud.ldif
  84. +0
    -0
      images/openldap/startup.sh
  85. +0
    -0
      images/openldap/users/userimport_example.ldif.template
  86. +1
    -1
      images/sftp/Dockerfile
  87. +13
    -0
      images/sftp/Dockerfile.template
  88. +0
    -0
      images/sftp/LICENSE
  89. +0
    -0
      images/sftp/README.md
  90. +0
    -0
      images/sftp/docker-entrypoint.sh
  91. +2
    -0
      letsencrypt.sh
  92. +1
    -0
      mariadb.env.template
  93. +35
    -0
      set_arch.sh
  94. +1
    -1
      setup.sh

+ 3
- 3
README.md ファイルの表示

@@ -147,8 +147,7 @@ Data and volumes

If you have existing data, create folders (otherwise setup script will do it) and copy it data:

sudo mkdir -p /media/volumes/mail/data
sudo mkdir -p /media/volumes/mail/state
sudo mkdir -p /media/volumes/mail/
sudo mkdir -p /media/volumes/nextcloud

sudo chown -R pirate:pirate /media/volumes/*
@@ -162,7 +161,8 @@ From your current installation:

rsync -auv --delete -e "ssh -i ~/.ssh/your-key_rsa" /var/www/nextcloud/data your-main-host:/media/volumes/nextcloud/
mysqldump --lock-tables -u nextcloud -p -h localhost nextcloud > /var/www/nextcloud/nextcloud_db_backup.sql
rsync -auv --delete -e "ssh -i ~/.ssh/your-key_rsa" /srv/vmail/ your-main-host:/media/volumes/mail/data
scp -i ~/.ssh/your-key_rsa /var/www/nextcloud/nextcloud_db_backup.sql your-main-host:/media/volumes/nextcloud/data/
rsync -auv --delete -e "ssh -i ~/.ssh/your-key_rsa" /srv/vmail/ your-main-host:/media/volumes/mail


Configuration and deployment

+ 3
- 0
add_dns_entries.sh ファイルの表示

@@ -7,6 +7,9 @@ if [ $# -eq 0 ]; then
exit 1
fi

echo ""
echo "Adding DNS entries to PI-HOLE"

CONF_FILE=custom_dnsmasq.conf

IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" # May not work for VPN / tun0

+ 4
- 2
add_users.sh ファイルの表示

@@ -8,6 +8,8 @@ if [ $# -eq 0 ]; then
fi

# ##### Add users to LDAP ###### #
echo ""
echo "Adding users to LDAP"

host=$(docker stack ps ${STACK_NAME} | grep -v Shutdown | grep Running | grep openldap | awk '{ print $4 }')
#echo Host=$host
@@ -31,12 +33,12 @@ fi
# read variables, for mail data path
. .env
# Replace Mail data path for users
find images/rpi-openldap/users -type f -exec \
find images/openldap/users -type f -exec \
sed -i "s/\${MAIL_DATA_PATH}/${MAIL_DATA_PATH//\//\\/}/g" {} \;

echo Copying user files to Host $host
ssh $host "mkdir -p /tmp/users"
scp -r images/rpi-openldap/users/userimport*.ldif $host:/tmp/users/
scp -r images/openldap/users/userimport*.ldif $host:/tmp/users/

echo Copying user files to Container $container in Host $host
ssh $host "docker cp /tmp/users $container:/tmp/"

+ 17
- 9
deploy.sh ファイルの表示

@@ -1,13 +1,19 @@
#!/bin/bash

STACK_NAME=$1
if [ $# -eq 0 ]; then
echo "You must pass stack name as a parameter"
exit 1
fi

BUILD=$2
if [ -z $BUILD ]; then
BUILD=1;
fi
if [ $# -eq 0 ]; then
echo "You must pass stack name as a parameter"
exit 1

PUSH=$3
if [ -z $PUSH ]; then
PUSH=0;
fi

# Delete previous running stack
@@ -16,12 +22,13 @@ docker stack rm ${STACK_NAME}
# Build images
if [ $BUILD -eq 1 ]; then
docker-compose build
docker push bingen/rpi-openldap
docker push bingen/rpi-mariadb
docker push bingen/rpi-haproxy
docker push bingen/rpi-mailserver
docker push bingen/rpi-nextcloud
docker push bingen/rpi-zoneminder
fi
# Push images
if [ $PUSH -eq 1 ]; then
source .env # for $ARCH
for i in `ls images`; do
docker push bingen/${ARCH}-${i}
done;
fi

# Deploy Stack
@@ -40,6 +47,7 @@ sleep 60
./add_dns_entries.sh ${STACK_NAME}

# Wait for Nextcloud
echo "Waiting for Nextcloud"
NC_UP=0
while [ $NC_UP -eq 0 ]; do
# TODO: Use docker inspect Go templates

+ 21
- 21
docker-compose.yml ファイルの表示

@@ -2,8 +2,8 @@ version: '3.1'
services:
openldap:
build:
context: ./images/rpi-openldap/
image: bingen/rpi-openldap:latest
context: ./images/openldap/
image: bingen/${ARCH}-openldap:latest
deploy:
placement:
constraints:
@@ -44,15 +44,15 @@ services:

db:
build:
context: ./images/rpi-mariadb/
image: bingen/rpi-mariadb:latest
context: ./images/mariadb/
image: bingen/${ARCH}-mariadb:latest
secrets:
- source: db_pwd
target: admin_pwd
mode: 0440
environment:
- MYSQL_ROOT_PWD_FILE=/run/secrets/admin_pwd
#container_name: mariadb
env_file:
- mariadb.env
networks:
- default
#ports:
@@ -63,8 +63,8 @@ services:

haproxy:
build:
context: ./images/rpi-haproxy/
image: bingen/rpi-haproxy:latest
context: ./images/haproxy/
image: bingen/${ARCH}-haproxy:latest
depends_on:
# For DNS resolution
- nextcloud
@@ -81,8 +81,8 @@ services:
- ${LETSENCRYPT_VOLUME_PATH}:/etc/letsencrypt
mail:
build:
context: ./images/rpi-email/
image: bingen/rpi-mailserver:latest
context: ./images/email/
image: bingen/${ARCH}-mailserver:latest
depends_on:
- openldap
secrets:
@@ -109,16 +109,16 @@ services:

nextcloud:
build:
context: ./images/rpi-nextcloud/
context: ./images/nextcloud/
args:
- NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION}
- NEXTCLOUD_DATA_PATH=${NEXTCLOUD_DATA_PATH}
- NEXTCLOUD_BACKUP_PATH=${NEXTCLOUD_BACKUP_PATH}
image: bingen/rpi-nextcloud:latest
deploy:
placement:
constraints:
- node.role == worker
image: bingen/${ARCH}-nextcloud:latest
# deploy:
# placement:
# constraints:
# - node.role == worker
depends_on:
- db
- openldap
@@ -156,8 +156,8 @@ services:

sftp:
build:
context: ./images/rpi-sftp/
image: bingen/rpi-sftp
context: ./images/sftp/
image: bingen/${ARCH}-sftp
ports:
- "1022:22"
volumes:
@@ -172,8 +172,8 @@ services:

gogs:
build:
context: ./images/rpi-gogs/
image: bingen/rpi-gogs
context: ./images/gogs/
image: bingen/${ARCH}-gogs
depends_on:
- db
- openldap
@@ -199,7 +199,7 @@ services:
mode: 0440

pihole:
image: pihole/pihole:v4.0_armhf
image: pihole/pihole:latest
deploy:
placement:
constraints:

+ 2
- 0
env.template ファイルの表示

@@ -1,5 +1,7 @@
# modify and copy to .env

ARCH=ARCH_PLACEHOLDER

# DB
DB_DATA_VOLUME_PATH=${VOLUMES_PATH}/mariadb/data
#DB_CONFIG_VOLUME_PATH=${VOLUMES_PATH}/mariadb/config

images/rpi-email/.gitignore → images/email/.gitignore ファイルの表示


images/rpi-email/Dockerfile → images/email/Dockerfile ファイルの表示

@@ -1,4 +1,4 @@
FROM resin/raspberrypi3-debian:latest
FROM debian:stretch

ENV DEBIAN_FRONTEND=noninteractive


+ 26
- 0
images/email/Dockerfile.template ファイルの表示

@@ -0,0 +1,26 @@
FROM BASE_IMAGE_PLACEHOLDER

ENV DEBIAN_FRONTEND=noninteractive

# Packages
RUN DEBIAN_FRONTEND=noninteractive apt-get update -q --fix-missing && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends \
rsyslog \
postfix postfix-pcre postfix-ldap \
cron getmail4 \
mutt swaks \
dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-ldap \
libsasl2-2 sasl2-bin libsasl2-modules-ldap

RUN addgroup --system --gid 5000 vmail && \
adduser --system --home /srv/vmail --uid 5000 --gid 5000 --disabled-password --disabled-login vmail

RUN adduser postfix sasl

COPY config /tmp/config

COPY startup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/startup.sh

CMD ["/usr/local/bin/startup.sh"]

images/rpi-email/LICENSE → images/email/LICENSE ファイルの表示


images/rpi-email/README.md → images/email/README.md ファイルの表示


images/rpi-email/config/dovecot/conf.d/10-auth.conf → images/email/config/dovecot/conf.d/10-auth.conf ファイルの表示


images/rpi-email/config/dovecot/conf.d/10-logging.conf → images/email/config/dovecot/conf.d/10-logging.conf ファイルの表示


images/rpi-email/config/dovecot/conf.d/10-master.conf → images/email/config/dovecot/conf.d/10-master.conf ファイルの表示


images/rpi-email/config/dovecot/conf.d/10-ssl.conf → images/email/config/dovecot/conf.d/10-ssl.conf ファイルの表示


images/rpi-email/config/dovecot/conf.d/15-lda.conf → images/email/config/dovecot/conf.d/15-lda.conf ファイルの表示


images/rpi-email/config/dovecot/dovecot-ldap.conf.ext → images/email/config/dovecot/dovecot-ldap.conf.ext ファイルの表示


images/rpi-email/config/postfix/drop.cidr → images/email/config/postfix/drop.cidr ファイルの表示


images/rpi-email/config/postfix/identitycheck.pcre → images/email/config/postfix/identitycheck.pcre ファイルの表示


images/rpi-email/config/postfix/ldap_virtual_aliases.cf → images/email/config/postfix/ldap_virtual_aliases.cf ファイルの表示


images/rpi-email/config/postfix/ldap_virtual_recipients.cf → images/email/config/postfix/ldap_virtual_recipients.cf ファイルの表示


images/rpi-email/config/postfix/main.cf → images/email/config/postfix/main.cf ファイルの表示


images/rpi-email/config/postfix/master.cf → images/email/config/postfix/master.cf ファイルの表示


images/rpi-email/config/postfix/sasl/smtpd.conf → images/email/config/postfix/sasl/smtpd.conf ファイルの表示


images/rpi-email/config/postfix/virtual_domains → images/email/config/postfix/virtual_domains ファイルの表示


images/rpi-email/config/saslauth/saslauthd → images/email/config/saslauth/saslauthd ファイルの表示


images/rpi-email/config/saslauth/saslauthd.conf → images/email/config/saslauth/saslauthd.conf ファイルの表示


images/rpi-email/getmail/template.getmailrc-example → images/email/getmail/template.getmailrc-example ファイルの表示


images/rpi-email/startup.sh → images/email/startup.sh ファイルの表示


images/rpi-gogs/Dockerfile → images/gogs/Dockerfile ファイルの表示

@@ -1,15 +1,15 @@
FROM resin/raspberrypi3-debian:latest
FROM debian:stretch

ENV GO_VERSION 1.9
ENV GO_OS linux
ENV GO_ARCH armv6l
ENV GO_ARCH amd64
ENV GOGS_CUSTOM /data/gogs
ENV GIT_HOME /home/git

# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git wget openssh-server mariadb-client \
git wget ca-certificates openssh-server mariadb-client \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /data/gogs/data \

+ 81
- 0
images/gogs/Dockerfile.template ファイルの表示

@@ -0,0 +1,81 @@
FROM BASE_IMAGE_PLACEHOLDER

ENV GO_VERSION 1.9
ENV GO_OS linux
ENV GO_ARCH GO_ARCH_PLACEHOLDER
ENV GOGS_CUSTOM /data/gogs
ENV GIT_HOME /home/git

# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git wget ca-certificates openssh-server mariadb-client \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /data/gogs/data \
&& mkdir -p /data/gogs/conf \
&& mkdir -p /data/gogs/log \
&& mkdir -p /data/gogs/gogs-repositories \
&& mkdir -p /data/ssh

# Create git user for Gogs
RUN export PUID=${PUID:-1000} \
&& export PGID=${PGID:-1000} \
&& addgroup --gid ${PGID} git \
&& adduser --uid ${PUID} --ingroup git --disabled-login --gecos 'Gogs Git User' --home ${GIT_HOME} --shell /bin/bash git \
&& ln -s /data/ssh ${GIT_HOME}/.ssh

RUN chown -R git:git /data
RUN chown -R git:git ${GIT_HOME}


RUN echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" > /etc/profile.d/gogs.sh
RUN echo "export GOROOT=${GIT_HOME}/local/go" | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null \
&& echo "export GOPATH=${GIT_HOME}/go" | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null \
&& echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' | tee -a /etc/profile.d/gogs.sh /etc/bash.bashrc > /dev/null

# ############## USER git ########################

USER git

# Install Golang
RUN cd $HOME \
&& mkdir local \
&& cd local \
&& wget https://storage.googleapis.com/golang/go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz \
&& tar zxvf go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz \
&& rm go${GO_VERSION}.${GO_OS}-${GO_ARCH}.tar.gz

# Install Gogs
RUN . /etc/profile.d/gogs.sh \
&& ${GOROOT}/bin/go get -u -tags "cert" github.com/gogs/gogs \
&& cd $GOPATH/src/github.com/gogs/gogs \
&& go build -tags "cert"

# TODO:
# clean stuff
# https://github.com/gogs/gogs/blob/master/docker/finalize.sh

# Clean stuff
RUN rm -r $HOME/go/src/github.com/gogs/gogs/.git
#RUN rm -r $HOME/local

# Configuration
# $HOME doesn't work with COPY
RUN mkdir -p ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf
COPY app.ini ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/
# LDAP
RUN mkdir -p ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/auth.d
COPY ldap.conf ${GIT_HOME}/go/src/github.com/gogs/gogs/custom/conf/auth.d/

# ############## USER root ########################

USER root

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh

#ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
#CMD gosu git ${GOPATH}/src/github.com/gogs/gogs/gogs web
ENTRYPOINT []
CMD ["/usr/local/bin/docker-entrypoint.sh"]

images/rpi-gogs/LICENSE → images/gogs/LICENSE ファイルの表示


images/rpi-gogs/README.md → images/gogs/README.md ファイルの表示


images/rpi-gogs/app.ini → images/gogs/app.ini ファイルの表示


images/rpi-gogs/docker-entrypoint.sh → images/gogs/docker-entrypoint.sh ファイルの表示

@@ -36,6 +36,8 @@ GOGS_DB_USER, GOGS_DB_PWD, GOGS_ADMIN_PWD, ADMIN_EMAIL and LDAP stuff";
exit 1;
fi

GOGS_PATH=${GOPATH}/src/github.com/gogs/gogs

function check_result {
if [ $1 != 0 ]; then
echo "Error: $2";
@@ -46,6 +48,7 @@ function check_result {
# ### DB setup ###

# wait for DB to be ready
sleep 60 # to avoid hitting it while the first start for setting root pwd
R=111
while [ $R -eq 111 ]; do
mysql -u root -p${MYSQL_ROOT_PWD} -h ${DB_HOST} -e "SHOW DATABASES" 2> /dev/null;
@@ -87,7 +90,7 @@ service ssh start
# SSH certs
if [[ ! -e ${GOGS_CUSTOM}/https/cert.pem || ! -e ${GOGS_CUSTOM}/https/key.pem ]]; then
su git -c "mkdir -p ${GOGS_CUSTOM}/https"
su git -c "cd ${GOGS_CUSTOM}/https && ${GOPATH}/src/github.com/gogits/gogs/gogs cert --ca=true --duration=8760h0m0s --host=${GOGS_DOMAIN} && cd -"
su git -c "cd ${GOGS_CUSTOM}/https && ${GOGS_PATH}/gogs cert --ca=true --duration=8760h0m0s --host=${GOGS_DOMAIN} && cd -"
fi

# ### Conf file ###
@@ -97,7 +100,7 @@ CONF_FILE=${GOGS_CUSTOM}/conf/app.ini
# We need to re-generate conf file because we are changing DB pwd
#if [[ ! -e ${CONF_FILE} ]]; then
su git -c "mkdir -p ${GOGS_CUSTOM}/conf"
mv ${GOPATH}/src/github.com/gogits/gogs/custom/conf/app.ini ${CONF_FILE}
mv ${GOGS_PATH}/custom/conf/app.ini ${CONF_FILE}

echo Setting domain
sed -i "s/GOGS_DOMAIN/${GOGS_DOMAIN}/g" ${CONF_FILE}
@@ -114,7 +117,7 @@ sed -i "s/GOGS_DB_PWD/${GOGS_DB_PWD//\//\\/}/g" ${CONF_FILE}
LDAP_FILE=${GOGS_CUSTOM}/conf/auth.d/ldap.conf
#if [[ ! -e ${CONF_FILE} ]]; then
su git -c "mkdir -p ${GOGS_CUSTOM}/conf/auth.d"
mv ${GOPATH}/src/github.com/gogits/gogs/custom/conf/auth.d/ldap.conf ${LDAP_FILE}
mv ${GOGS_PATH}/custom/conf/auth.d/ldap.conf ${LDAP_FILE}

echo Setting LDAP conf
sed -i "s/LDAP_SERVER_HOST/${LDAP_SERVER_HOST}/g" ${LDAP_FILE}
@@ -125,9 +128,9 @@ sed -i "s/LDAP_SEARCH_BASE/${LDAP_SEARCH_BASE}/g" ${LDAP_FILE}

# Create admin user if DB was new
if [ -z "${DB_EXISTS}" ]; then
su -c git "${GOPATH}/src/github.com/gogits/gogs/gogs admin create-user --name admin --password ${GOGS_ADMIN_PWD} --admin --email ${ADMIN_EMAIL}"
su -c git "${GOGS_PATH}/gogs admin create-user --name admin --password ${GOGS_ADMIN_PWD} --admin --email ${ADMIN_EMAIL}"
fi

#exec "$@"
#exec gosu git ${GOPATH}/src/github.com/gogits/gogs/gogs web
exec su git -c "${GOPATH}/src/github.com/gogits/gogs/gogs web"
#exec gosu git ${GOGS_PATH}/gogs web
exec su git -c "${GOGS_PATH}/gogs web"

images/rpi-gogs/ldap.conf → images/gogs/ldap.conf ファイルの表示


images/rpi-haproxy/Dockerfile → images/haproxy/Dockerfile ファイルの表示

@@ -1,8 +1,8 @@
FROM resin/raspberrypi3-debian:latest
FROM debian:stretch

RUN echo deb http://deb.debian.org/debian jessie-backports main >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y haproxy cron \
&& apt-get install certbot -t jessie-backports
&& apt-get install -y certbot -t jessie-backports

RUN mkdir -p /run/haproxy


+ 19
- 0
images/haproxy/Dockerfile.template ファイルの表示

@@ -0,0 +1,19 @@
FROM BASE_IMAGE_PLACEHOLDER

RUN echo deb http://deb.debian.org/debian jessie-backports main >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y haproxy cron \
&& apt-get install -y certbot -t jessie-backports

RUN mkdir -p /run/haproxy

COPY haproxy.cfg /etc/haproxy/haproxy.cfg
COPY haproxy_letsencrypt.cfg /etc/haproxy/haproxy_letsencrypt.cfg

COPY startup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/startup.sh

COPY letsencrypt.cron /usr/local/bin/
RUN chmod +x /usr/local/bin/letsencrypt.cron

#CMD haproxy -f /etc/haproxy/haproxy.cfg
CMD /usr/local/bin/startup.sh

images/rpi-haproxy/LICENSE → images/haproxy/LICENSE ファイルの表示


images/rpi-haproxy/README.md → images/haproxy/README.md ファイルの表示


images/rpi-haproxy/haproxy.cfg → images/haproxy/haproxy.cfg ファイルの表示


images/rpi-haproxy/haproxy_letsencrypt.cfg → images/haproxy/haproxy_letsencrypt.cfg ファイルの表示


images/rpi-haproxy/letsencrypt.cron → images/haproxy/letsencrypt.cron ファイルの表示


images/rpi-haproxy/startup.sh → images/haproxy/startup.sh ファイルの表示


+ 42
- 0
images/mariadb/Dockerfile ファイルの表示

@@ -0,0 +1,42 @@
#
# MariaDB Dockerfile

# Pull base image.
FROM debian:stretch

ENV DEBIAN_FRONTEND=noninteractive

# Install MariaDB.
RUN \
apt-get update && \
apt-get upgrade -y && \
apt-get -y install mariadb-server procps

RUN find /etc/mysql/ -name *.cnf -exec sed -i 's/^\(bind-address\s.*\)/# \1/' {} \;
#RUN \
# find /etc/mysql/ -name *.cnf -exec sed -i 's/^\(bind-address\s.*\)/# \1/' {} \; && \
# echo "mysqld_safe &" > /tmp/config && \
# echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config && \
# echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config && \
# bash /tmp/config && \
# mysql -e "SELECT Host, User, Password FROM mysql.user;" > /tmp/a.out
#rm -f /tmp/config

COPY tuning.cnf /etc/mysql/conf.d/tuning.cnf

COPY tuning-primer.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/tuning-primer.sh
COPY mysqltuner.pl /usr/local/bin/
RUN chmod +x /usr/local/bin/mysqltuner.pl

COPY startup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/startup.sh

# Define mountable directories.
#VOLUME ["/var/lib/mysql"]

# Define default command.
CMD ["/usr/local/bin/startup.sh"]

# Expose ports.
EXPOSE 3306

images/rpi-mariadb/Dockerfile → images/mariadb/Dockerfile.template ファイルの表示

@@ -1,27 +1,21 @@
#
# MariaDB Dockerfile
#
# https://github.com/bingen/rpi-mariadb
#

# Pull base image.
FROM resin/raspberrypi3-debian:latest
FROM BASE_IMAGE_PLACEHOLDER

ENV DEBIAN_FRONTEND=noninteractive

# Install MariaDB.
RUN \
apt-get update && \
apt-get upgrade && \
apt-get -y install mariadb-server
RUN \
sed -i 's/^\(bind-address\s.*\)/# \1/' /etc/mysql/my.cnf && \
echo "mysqld_safe &" > /tmp/config && \
echo "mysqladmin --silent --wait=30 ping || exit 1" >> /tmp/config && \
echo "mysql -e 'GRANT ALL PRIVILEGES ON *.* TO \"root\"@\"%\" WITH GRANT OPTION;'" >> /tmp/config && \
bash /tmp/config && \
mysql -e "SELECT Host, User, Password FROM mysql.user;" > /tmp/a.out
#rm -f /tmp/config
apt-get upgrade -y && \
apt-get -y install mariadb-server procps

RUN find /etc/mysql/ -name *.cnf -exec sed -i 's/^\(bind-address\s.*\)/# \1/' {} \;

# Install Mysql DB
RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql

COPY tuning.cnf /etc/mysql/conf.d/tuning.cnf


images/rpi-mariadb/README.md → images/mariadb/README.md ファイルの表示


images/rpi-mariadb/mysqltuner.pl → images/mariadb/mysqltuner.pl ファイルの表示


images/rpi-mariadb/startup.sh → images/mariadb/startup.sh ファイルの表示

@@ -1,7 +1,7 @@
#!bin/bash
#!/bin/bash

echo "Installing Mysql DB"
mysql_install_db --user=mysql --ldata=/var/lib/mysql
echo "Permissions"
chown -R mysql:mysql /var/lib/mysql

# set root password from secret
if [ ! -z $MYSQL_ROOT_PWD_FILE -a -f $MYSQL_ROOT_PWD_FILE ]; then

images/rpi-mariadb/tuning-primer.sh → images/mariadb/tuning-primer.sh ファイルの表示


images/rpi-mariadb/tuning.cnf → images/mariadb/tuning.cnf ファイルの表示


images/rpi-nextcloud/Dockerfile → images/nextcloud/Dockerfile ファイルの表示

@@ -1,4 +1,4 @@
FROM bingen/rpi-nginx-php
FROM bingen/amd64-nginx-php

ENV DEBIAN_FRONTEND=noninteractive

@@ -7,7 +7,7 @@ ARG NEXTCLOUD_DATA_PATH
ARG NEXTCLOUD_BACKUP_PATH

RUN apt-get update && \
apt-get install -y wget bzip2 vim rsync mariadb-client cron && \
apt-get install -y wget bzip2 vim rsync mariadb-client cron sudo && \
apt-get clean

# Change upload-limits and -sizes

+ 58
- 0
images/nextcloud/Dockerfile.template ファイルの表示

@@ -0,0 +1,58 @@
FROM bingen/ARCH_PLACEHOLDER-nginx-php

ENV DEBIAN_FRONTEND=noninteractive

ARG NEXTCLOUD_VERSION
ARG NEXTCLOUD_DATA_PATH
ARG NEXTCLOUD_BACKUP_PATH

RUN apt-get update && \
apt-get install -y wget bzip2 vim rsync mariadb-client cron sudo && \
apt-get clean

# Change upload-limits and -sizes
RUN sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 2048M/g" /etc/php/7.2/fpm/php.ini && \
sed -i "s/post_max_size = 8M/post_max_size =root123 2048M/g" /etc/php/7.2/fpm/php.ini && \
echo 'default_charset = "UTF-8"' >> /etc/php/7.2/fpm/php.ini && \
echo "upload_tmp_dir = ${NEXTCLOUD_DATA_PATH}" >> /etc/php/7.2/fpm/php.ini && \
echo "extension = apc.so" >> /etc/php/7.2/fpm/php.ini && \
echo "apc.enabled = 1" >> /etc/php/7.2/fpm/php.ini && \
echo "apc.include_once_override = 0" >> /etc/php/7.2/fpm/php.ini && \
echo "apc.shm_size = 256" >> /etc/php/7.2/fpm/php.ini

# now add our hand-written nginx-default-configuration which makes use of all the stuff so far prepared
COPY default /etc/nginx/sites-available/default

# PHP config
COPY php_nc.ini /tmp/php_nc.ini
RUN cat /tmp/php_nc.ini >> /etc/php/7.2/fpm/php.ini && \
cat /tmp/php_nc.ini >> /etc/php/7.2/cli/php.ini
# https://docs.nextcloud.com/server/13/admin_manual/installation/source_installation.html#php-fpm-tips-label
RUN sed -i 's/^;env/env/g' /etc/php/7.2/fpm/pool.d/www.conf

# Create the data-directory where NEXTCLOUD can store its stuff
RUN mkdir -p "${NEXTCLOUD_DATA_PATH}" && \
chown -R www-data:www-data "${NEXTCLOUD_DATA_PATH}" && \
mkdir -p "${NEXTCLOUD_BACKUP_PATH}"

# finally, download NEXTCLOUD and extract it
RUN mkdir -p /var/www
WORKDIR /var/www

RUN wget https://download.nextcloud.com/server/releases/${NEXTCLOUD_VERSION}.tar.bz2 && \
tar xvf ${NEXTCLOUD_VERSION}.tar.bz2 && \
chown -R www-data:www-data nextcloud && \
rm ${NEXTCLOUD_VERSION}.tar.bz2

WORKDIR /
COPY docker-entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
COPY backup.sh /etc/cron.daily/backup
RUN chmod +x /etc/cron.daily/backup

#VOLUME ${NEXTCLOUD_DATA_PATH}
#VOLUME ${NEXTCLOUD_BACKUP_PATH}

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD service php7.2-fpm start && nginx
#CMD ["service", "php7.2-fpm", "start", "&&", "nginx"]

images/rpi-nextcloud/LICENSE → images/nextcloud/LICENSE ファイルの表示


images/rpi-nextcloud/README.md → images/nextcloud/README.md ファイルの表示


images/rpi-nextcloud/backup.sh → images/nextcloud/backup.sh ファイルの表示


images/rpi-nextcloud/default → images/nextcloud/default ファイルの表示


images/rpi-nextcloud/docker-entrypoint.sh → images/nextcloud/docker-entrypoint.sh ファイルの表示

@@ -10,7 +10,7 @@ if [ -z "${NEXTCLOUD_SERVER_NAME}" ]; then
exit 1
fi

sudo sed -i "s/server_name localhost/server_name ${NEXTCLOUD_SERVER_NAME}.${NEXTCLOUD_DOMAIN} ${NEXTCLOUD_SERVER_NAME}/g" /etc/nginx/sites-available/default
sed -i "s/server_name localhost/server_name ${NEXTCLOUD_SERVER_NAME}.${NEXTCLOUD_DOMAIN} ${NEXTCLOUD_SERVER_NAME}/g" /etc/nginx/sites-available/default

# set Admin password from secret
if [ ! -z $NEXTCLOUD_ADMIN_PWD_FILE -a -f $NEXTCLOUD_ADMIN_PWD_FILE ]; then
@@ -67,6 +67,7 @@ function check_result {
# ### DB ###

# wait for DB to be ready
sleep 60 # to avoid hitting it while the first start for setting root pwd
R=111
while [ $R -eq 111 ]; do
mysql -u root -p${MYSQL_ROOT_PWD} -h ${DB_HOST} -e "SHOW DATABASES" 2> /dev/null;

images/rpi-nextcloud/php_nc.ini → images/nextcloud/php_nc.ini ファイルの表示


images/rpi-nginx-php/Dockerfile → images/nginx-php/Dockerfile ファイルの表示

@@ -1,4 +1,4 @@
FROM bingen/rpi-nginx
FROM bingen/amd64-nginx

# Add PHP 7.2 repo
RUN apt-get update && \

+ 18
- 0
images/nginx-php/Dockerfile.template ファイルの表示

@@ -0,0 +1,18 @@
FROM bingen/ARCH_PLACEHOLDER-nginx

# Add PHP 7.2 repo
RUN apt-get update && \
apt-get install -y apt-transport-https lsb-release ca-certificates wget && \
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
# update and install php
RUN apt-get update && \
apt-get install -y php7.2 php7.2-fpm php-pear php7.2-common \
php7.2-mysql php7.2-cli php7.2-gd php7.2-curl php-apcu php7.2-opcache \
php7.2-mbstring php7.2-ldap php7.2-zip && \
apt-get clean

# overwrite the default-configuration with our own settings - enabling PHP
COPY default /etc/nginx/sites-available/default

CMD service php7.2-fpm start && nginx

images/rpi-nginx-php/README.md → images/nginx-php/README.md ファイルの表示


images/rpi-nginx-php/default → images/nginx-php/default ファイルの表示


images/rpi-nginx/Dockerfile → images/nginx/Dockerfile ファイルの表示

@@ -1,4 +1,4 @@
FROM resin/raspberrypi3-debian:stretch
FROM debian:stretch

#ENV NGINX_VERSION 1.2.1-2.2+wheezy3


+ 25
- 0
images/nginx/Dockerfile.template ファイルの表示

@@ -0,0 +1,25 @@
FROM BASE_IMAGE_PLACEHOLDER

#ENV NGINX_VERSION 1.2.1-2.2+wheezy3

# update and install nginx
RUN apt-get update && \
apt-get install -y nginx && \
#=${NGINX_VERSION}
apt-get clean

# trim the original configuration for our little raspberry
RUN sed -i "s/worker_processes 4;/worker_processes 2;/g" /etc/nginx/nginx.conf
RUN sed -i "s/worker_connections 768;/worker_connections 256;/g" /etc/nginx/nginx.conf
RUN echo "daemon off;" >> /etc/nginx/nginx.conf

# like in the official nginx-image - forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log

VOLUME ["/var/cache/nginx"]

# Ports to be exposed
EXPOSE 80 443

CMD ["nginx"]

images/rpi-nginx/README.md → images/nginx/README.md ファイルの表示


images/rpi-openldap/.gitignore → images/openldap/.gitignore ファイルの表示


images/rpi-openldap/Dockerfile → images/openldap/Dockerfile ファイルの表示

@@ -1,14 +1,15 @@
FROM resin/raspberrypi3-debian:latest
FROM debian:stretch

# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r openldap && useradd -r -g openldap -u 999 openldap

# Install OpenLDAP, ldap-utils and ssl-tools from baseimage and clean apt-get files
RUN apt-get -y update \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ldap-utils \
openssl \
slapd \
procps \
# ca-certificates \
# curl \
# patch \

+ 41
- 0
images/openldap/Dockerfile.template ファイルの表示

@@ -0,0 +1,41 @@
FROM BASE_IMAGE_PLACEHOLDER

# Add openldap user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r openldap && useradd -r -g openldap -u 999 openldap

# Install OpenLDAP, ldap-utils and ssl-tools from baseimage and clean apt-get files
RUN apt-get -y update \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ldap-utils \
openssl \
slapd \
procps \
# ca-certificates \
# curl \
# patch \
# php5-ldap \
# php5-readline \
# && curl -o phpldapadmin.tgz -SL https://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${PHPLDAPADMIN_VERSION}/phpldapadmin-${PHPLDAPADMIN_VERSION}.tgz \
# && echo "$PHPLDAPADMIN_SHA1 *phpldapadmin.tgz" | sha1sum -c - \
# && mkdir -p /var/www/phpldapadmin_bootstrap /var/www/phpldapadmin \
# && tar -xzf phpldapadmin.tgz --strip 1 -C /var/www/phpldapadmin_bootstrap \
# && apt-get remove -y --purge --auto-remove curl ca-certificates \
# && rm phpldapadmin.tgz \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY data /tmp/data/
COPY startup.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/startup.sh

# Set phpLDAPadmin data directory in a data volume
# VOLUME ["/var/www/phpldapadmin"]
VOLUME ["/etc/ldap"]

#CMD ["/usr/sbin/slapd", "-g", "openldap", "-u", "openldap", "-F", "/etc/ldap/slapd.d", "-d0"]
#CMD ["/usr/sbin/slapd", "-h", "ldap:/// ldapi:///", "-g", "openldap", "-u", "openldap", "-F", "/etc/ldap/slapd.d", "-d7"]
#CMD ["/bin/bash"]
CMD ["/usr/local/bin/startup.sh"]

EXPOSE 389 636
#80 443

images/rpi-openldap/LICENSE → images/openldap/LICENSE ファイルの表示


images/rpi-openldap/README.md → images/openldap/README.md ファイルの表示


images/rpi-openldap/data/000-addou_people.ldif → images/openldap/data/000-addou_people.ldif ファイルの表示


images/rpi-openldap/data/000-addou_services.ldif → images/openldap/data/000-addou_services.ldif ファイルの表示


images/rpi-openldap/data/000_admin_ext.ldif → images/openldap/data/000_admin_ext.ldif ファイルの表示


images/rpi-openldap/data/001_admin_mail.ldif → images/openldap/data/001_admin_mail.ldif ファイルの表示


images/rpi-openldap/data/_acl_add_0.ldif → images/openldap/data/_acl_add_0.ldif ファイルの表示


images/rpi-openldap/data/_acl_add_1.ldif → images/openldap/data/_acl_add_1.ldif ファイルの表示


images/rpi-openldap/data/_acl_del.ldif → images/openldap/data/_acl_del.ldif ファイルの表示


images/rpi-openldap/data/_postfix-book.ldif → images/openldap/data/_postfix-book.ldif ファイルの表示


images/rpi-openldap/data/postfix-book.schema → images/openldap/data/postfix-book.schema ファイルの表示


images/rpi-openldap/data/serviceimport_gogs.ldif → images/openldap/data/serviceimport_gogs.ldif ファイルの表示


images/rpi-openldap/data/serviceimport_mail.ldif → images/openldap/data/serviceimport_mail.ldif ファイルの表示


images/rpi-openldap/data/serviceimport_nextcloud.ldif → images/openldap/data/serviceimport_nextcloud.ldif ファイルの表示


images/rpi-openldap/startup.sh → images/openldap/startup.sh ファイルの表示


images/rpi-openldap/users/userimport_example.ldif.template → images/openldap/users/userimport_example.ldif.template ファイルの表示


images/rpi-sftp/Dockerfile → images/sftp/Dockerfile ファイルの表示

@@ -1,4 +1,4 @@
FROM resin/raspberrypi3-debian:latest
FROM debian:stretch

# Install dependencies
RUN apt-get update \

+ 13
- 0
images/sftp/Dockerfile.template ファイルの表示

@@ -0,0 +1,13 @@
FROM BASE_IMAGE_PLACEHOLDER

# Install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
openssh-server \
&& rm -rf /var/lib/apt/lists/*

COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/usr/sbin/sshd", "-D"]

images/rpi-sftp/LICENSE → images/sftp/LICENSE ファイルの表示


images/rpi-sftp/README.md → images/sftp/README.md ファイルの表示


images/rpi-sftp/docker-entrypoint.sh → images/sftp/docker-entrypoint.sh ファイルの表示


+ 2
- 0
letsencrypt.sh ファイルの表示

@@ -8,6 +8,8 @@ if [ $# -eq 0 ]; then
fi

# ##### Add Let's Encrypt certificates ###### #
echo ""
echo "Adding Let's Encrypt certificates"

# Find Nextcloud container
SERVICE=nextcloud

+ 1
- 0
mariadb.env.template ファイルの表示

@@ -0,0 +1 @@
MYSQL_ROOT_PWD_FILE=/run/secrets/admin_pwd

+ 35
- 0
set_arch.sh ファイルの表示

@@ -0,0 +1,35 @@
#!/bin/bash

ARCH=$1
if [ $# -eq 0 ]; then
echo "You must pass arch as a parameter"
exit 1
fi

case ${ARCH} in
#'rpi') IMAGE='resin/raspberrypi3-debian:latest' ;;
'rpi')
IMAGE='arm32v7/debian:stretch'
ARCH_PREFIX='rpi'
GO_ARCH='armv6l'
;;
'arm64')
IMAGE='arm64v7/debian:stretch'
ARCH_PREFIX='arm64'
GO_ARCH='arm64'
;;
'amd64')
IMAGE='debian:stretch'
ARCH_PREFIX='amd64'
GO_ARCH='amd64'
;;
esac

for i in `find ./ -name Dockerfile.template`; do
dockerfile=${i/\.template/}
cp ${i} ${dockerfile}
sed -i "s/FROM BASE_IMAGE_PLACEHOLDER/FROM ${IMAGE}/g" ${dockerfile}
sed -i "s/GO_ARCH GO_ARCH_PLACEHOLDER/GO_ARCH ${GO_ARCH}/g" ${dockerfile}
sed -i "s/bingen\/ARCH_PLACEHOLDER/bingen\/${ARCH_PREFIX}/g" ${dockerfile}
done;
sed -i "s/ARCH_PLACEHOLDER/${ARCH_PREFIX}/g" .env

+ 1
- 1
setup.sh ファイルの表示

@@ -232,4 +232,4 @@ sudo mkdir -p ${PIHOLE_DNSMASQ_VOLUME_PATH}
sudo mkdir -p ${LETSENCRYPT_VOLUME_PATH}

echo "Copying getmail confs"
cp images/rpi-email/getmail/getmailrc-* ${MAIL_DATA_VOLUME_PATH}/getmail/
cp images/email/getmail/getmailrc-* ${MAIL_DATA_VOLUME_PATH}/getmail/

読み込み中…
キャンセル
保存