├── LICENSE ├── README.md ├── alpine-apache-php ├── Dockerfile ├── README.md └── scripts │ └── run.sh ├── alpine-elasticsearch ├── Dockerfile ├── config │ └── elasticsearch.yml └── scripts │ └── run.sh ├── alpine-elk ├── Dockerfile ├── config │ ├── elasticsearch.yml │ └── logstash.json └── scripts │ ├── run-es.sh │ └── run.sh ├── alpine-kibana ├── Dockerfile └── docker-compose.yml ├── alpine-logstash ├── Dockerfile ├── etc │ ├── logstash.json.basic │ └── logstash.json.es └── scripts │ └── run.sh ├── alpine-mariadb ├── Dockerfile ├── README.md └── scripts │ └── run.sh ├── alpine-mosquitto └── Dockerfile ├── alpine-postgres ├── Dockerfile ├── README.md └── scripts │ └── run.sh ├── alpine-redis └── Dockerfile └── alpine-rt ├── Dockerfile ├── README.md ├── config ├── lighttpd.conf └── mod_fastcgi.conf ├── docker-compose-mysql.yml ├── docker-compose.yml └── scripts └── run.sh /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 kost 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-alpine 2 | Alpine based images for Docker - Fundamental ones 3 | 4 | -------------------------------------------------------------------------------- /alpine-apache-php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost - https://github.com/kost 3 | 4 | RUN apk --update add php-apache2 curl php-cli php-json php-phar php-openssl && rm -f /var/cache/apk/* && \ 5 | curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ 6 | mkdir /app && chown -R apache:apache /app && \ 7 | sed -i 's#^DocumentRoot ".*#DocumentRoot "/app"#g' /etc/apache2/httpd.conf && \ 8 | sed -i 's#AllowOverride none#AllowOverride All#' /etc/apache2/httpd.conf && \ 9 | echo "Success" 10 | 11 | ADD scripts/run.sh /scripts/run.sh 12 | RUN mkdir /scripts/pre-exec.d && \ 13 | mkdir /scripts/pre-init.d && \ 14 | chmod -R 755 /scripts 15 | 16 | EXPOSE 80 17 | 18 | # VOLUME /app 19 | WORKDIR /app 20 | 21 | ENTRYPOINT ["/scripts/run.sh"] 22 | 23 | -------------------------------------------------------------------------------- /alpine-apache-php/README.md: -------------------------------------------------------------------------------- 1 | # k0st/alpine-apache-app 2 | 3 | Multiple purpose Apache and PHP image based on Alpine 4 | 5 | Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image 6 | 7 | ## Docker image size 8 | 9 | [![Latest](https://badge.imagelayers.io/k0st/alpine-apache-php.svg)](https://imagelayers.io/?images=k0st/alpine-apache-php:latest 'latest') 10 | 11 | ## Docker image usage 12 | 13 | ``` 14 | docker run [docker-options] k0st/alpine-apache-php 15 | ``` 16 | 17 | ## Examples 18 | 19 | Typical basic usage: 20 | 21 | ``` 22 | docker run -it k0st/alpine-apache-php 23 | ``` 24 | 25 | Typical usage in Dockerfile: 26 | 27 | ``` 28 | FROM k0st/alpine-apache-php 29 | RUN echo "" > /app/index.php 30 | ``` 31 | 32 | Typical usage: 33 | 34 | ``` 35 | docker run -it --link=somedb:db k0st/alpine-apache-php 36 | ``` 37 | 38 | ### Todo 39 | - [ ] Check volume and data 40 | 41 | -------------------------------------------------------------------------------- /alpine-apache-php/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # execute any pre-init scripts, useful for images 4 | # based on this image 5 | for i in /scripts/pre-init.d/*sh 6 | do 7 | if [ -e "${i}" ]; then 8 | echo "[i] pre-init.d - processing $i" 9 | . "${i}" 10 | fi 11 | done 12 | 13 | # set apache as owner/group 14 | if [ "$FIX_OWNERSHIP" != "" ]; then 15 | chown -R apache:apache /app 16 | fi 17 | 18 | # display logs 19 | tail -F /var/log/apache2/*log & 20 | 21 | # execute any pre-exec scripts, useful for images 22 | # based on this image 23 | for i in /scripts/pre-exec.d/*sh 24 | do 25 | if [ -e "${i}" ]; then 26 | echo "[i] pre-exec.d - processing $i" 27 | . "${i}" 28 | fi 29 | done 30 | 31 | echo "[i] Starting daemon..." 32 | # run apache httpd daemon 33 | httpd -D FOREGROUND 34 | -------------------------------------------------------------------------------- /alpine-elasticsearch/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jolokia/alpine-jre-8 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | # Set environment variables 5 | ENV PKG_NAME elasticsearch 6 | ENV ELASTICSEARCH_VERSION 1.7.1 7 | ENV ELASTICSEARCH_URL https://download.elastic.co/$PKG_NAME/$PKG_NAME/$PKG_NAME-$ELASTICSEARCH_VERSION.tar.gz 8 | 9 | # Download Elasticsearch 10 | RUN apk update \ 11 | && apk add openssl \ 12 | && mkdir -p /opt \ 13 | && echo -O /tmp/$PKG_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \ 14 | && wget -O /tmp/$PKG_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \ 15 | && tar -xvzf /tmp/$PKG_NAME-$ELASTICSEARCH_VERSION.tar.gz -C /opt/ \ 16 | && ln -s /opt/$PKG_NAME-$ELASTICSEARCH_VERSION /opt/$PKG_NAME \ 17 | && rm -rf /tmp/*.tar.gz /var/cache/apk/* \ 18 | && mkdir /var/lib/elasticsearch \ 19 | && chown nobody /var/lib/elasticsearch 20 | 21 | # Add files 22 | COPY config/elasticsearch.yml /opt/elasticsearch/config/elasticsearch.yml 23 | COPY scripts/run.sh /scripts/run.sh 24 | 25 | # Specify Volume 26 | VOLUME ["/var/lib/elasticsearch"] 27 | 28 | # Exposes 29 | EXPOSE 9200 30 | EXPOSE 9300 31 | 32 | USER nobody 33 | 34 | # CMD 35 | ENTRYPOINT ["/scripts/run.sh"] 36 | -------------------------------------------------------------------------------- /alpine-elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # listen on all interfaces 2 | network: 3 | bind_host: 0.0.0.0 4 | 5 | # default ports (http 9200, tcp 9300) 6 | http: 7 | port: 9200 8 | 9 | transport: 10 | tcp: 11 | port: 9300 12 | 13 | # data and logs locations 14 | # FIXME: figure out best placement for logs 15 | path: 16 | data: /var/lib 17 | logs: /var/lib/elasticsearch 18 | -------------------------------------------------------------------------------- /alpine-elasticsearch/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # uses es home to load all configs. 4 | # adding a "commandopts" to the volume allows you to pass more options to elasticsearch 5 | # for example heap size. "-Xmx10g -Xms10g" 6 | 7 | # production recommendations http://www.elastic.co/guide/en/elasticsearch/guide/current/deploy.html 8 | 9 | echo "===============================" 10 | echo "starting elastic search." 11 | echo "===============================" 12 | echo "-------------------------------" 13 | echo "checking ulimits" 14 | echo "-------------------------------" 15 | 16 | mapmax=`cat /proc/sys/vm/max_map_count` 17 | filemax=`cat /proc/sys/fs/file-max` 18 | 19 | ulimit -a; 20 | 21 | echo "fs.file_max: $filemax" 22 | echo "vm.max_map_count: $mapmax" 23 | 24 | fds=`ulimit -n` 25 | if [ "$fds" -lt "64000" ] ; then 26 | echo "ES recommends 64k open files per process. you have "`ulimit -n` 27 | echo "the docker deamon should be run with increased file descriptors to increase those available in the container" 28 | echo " try \`ulimit -n 64000\`" 29 | else 30 | echo "you have more than 64k allowed file descriptors. awesome." 31 | fi 32 | 33 | echo "-------------------------------" 34 | echo "files in volume" 35 | echo "-------------------------------" 36 | 37 | vol=/var/lib/elasticsearch 38 | 39 | ls $vol 40 | 41 | esopts="" 42 | if [ -f "$vol/elasticsearch.yml" ]; then 43 | esopts="-Des.path.home=$vol"; 44 | echo "setting es.path.home to $vol" 45 | else 46 | echo "[WARNING] missing elasticsearch config. not setting es.path.home to $vol" 47 | fi 48 | 49 | commandopts="" 50 | if [ -f "/var/lib/elasticsearch/javaopts.sh" ]; then 51 | commandopts=`cat /var/lib/elasticsearch/commandopts` 52 | fi 53 | 54 | echo "-------------------------------" 55 | echo "command opts" 56 | echo "-------------------------------" 57 | echo $commandopts 58 | 59 | echo "-------------------------------" 60 | echo "elastic search command" 61 | echo "-------------------------------" 62 | 63 | echo "/opt/elasticsearch/bin/elasticsearch $commandopts $esopts" 64 | 65 | start() { 66 | exec /opt/elasticsearch/bin/elasticsearch $commandopts $esopts 67 | } 68 | 69 | start 70 | -------------------------------------------------------------------------------- /alpine-elk/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jolokia/alpine-jre-8 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | # Set environment variables 5 | ENV ES_NAME elasticsearch 6 | ENV ELASTICSEARCH_VERSION 1.7.1 7 | ENV ELASTICSEARCH_URL https://download.elastic.co/$ES_NAME/$ES_NAME/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz 8 | 9 | ENV LOGSTASH_NAME logstash 10 | ENV LOGSTASH_VERSION 1.5.3 11 | ENV LOGSTASH_URL https://download.elastic.co/$LOGSTASH_NAME/$LOGSTASH_NAME/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz 12 | 13 | ENV KIBANA_VERSION 4.1.1 14 | ENV KIBANA_NAME kibana 15 | ENV KIBANA_PKG $KIBANA_NAME-$KIBANA_VERSION-linux-x64 16 | ENV KIBANA_CONFIG /opt/$KIBANA_NAME-$KIBANA_VERSION-linux-x64/config/kibana.yml 17 | ENV KIBANA_URL https://download.elastic.co/$KIBANA_NAME/$KIBANA_NAME/$KIBANA_PKG.tar.gz 18 | 19 | 20 | # Download Elasticsearch 21 | RUN apk add --update openssl nodejs bash \ 22 | && mkdir -p /opt \ 23 | && echo "[i] Building elasticsearch" \ 24 | && echo -O /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \ 25 | && wget -O /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz $ELASTICSEARCH_URL \ 26 | && tar -xzf /tmp/$ES_NAME-$ELASTICSEARCH_VERSION.tar.gz -C /opt/ \ 27 | && ln -s /opt/$ES_NAME-$ELASTICSEARCH_VERSION /opt/$ES_NAME \ 28 | && mkdir /var/lib/elasticsearch \ 29 | && echo "[i] Building logstash" \ 30 | && wget -O /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz $LOGSTASH_URL \ 31 | && tar xzf /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz -C /opt/ \ 32 | && ln -s /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION /opt/$LOGSTASH_NAME \ 33 | && mkdir /etc/$LOGSTASH_NAME \ 34 | && echo "[i] Building kibana" \ 35 | && wget -O /tmp/$KIBANA_PKG.tar.gz $KIBANA_URL \ 36 | && tar -xzf /tmp/$KIBANA_PKG.tar.gz -C /opt/ \ 37 | && ln -s /opt/$KIBANA_PKG /opt/$KIBANA_NAME \ 38 | && rm -rf /opt/$KIBANA_PKG/node/ \ 39 | && mkdir -p /opt/$KIBANA_PKG/node/bin/ \ 40 | && ln -s $(which node) /opt/$KIBANA_NAME/node/bin/node \ 41 | && echo "[i] Finishing" \ 42 | && rm -rf /tmp/*.tar.gz /var/cache/apk/* \ 43 | && echo "[i] Done" 44 | 45 | # Add files 46 | COPY config/elasticsearch.yml /opt/elasticsearch/config/elasticsearch.yml 47 | ADD config/logstash.json /etc/$LOGSTASH_NAME/$LOGSTASH_NAME.json 48 | ADD scripts /scripts 49 | 50 | # Specify Volume 51 | VOLUME ["/var/lib/elasticsearch"] 52 | 53 | # Exposes 54 | EXPOSE 9200 9300 5601 514 514/udp 8080 55 | 56 | # CMD 57 | ENTRYPOINT ["/scripts/run.sh"] 58 | -------------------------------------------------------------------------------- /alpine-elk/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # listen on all interfaces 2 | network: 3 | bind_host: 0.0.0.0 4 | 5 | # default ports (http 9200, tcp 9300) 6 | http: 7 | port: 9200 8 | 9 | transport: 10 | tcp: 11 | port: 9300 12 | 13 | # data and logs locations 14 | # FIXME: figure out best placement for logs 15 | path: 16 | data: /var/lib 17 | logs: /var/lib/elasticsearch 18 | -------------------------------------------------------------------------------- /alpine-elk/config/logstash.json: -------------------------------------------------------------------------------- 1 | input { 2 | stdin { } 3 | http { 4 | port => 8080 5 | } 6 | tcp { 7 | port => 514 8 | type => syslog 9 | } 10 | udp { 11 | port => 514 12 | type => syslog 13 | } 14 | } 15 | 16 | output { 17 | elasticsearch { host => localhost } 18 | stdout { codec => rubydebug } 19 | } 20 | -------------------------------------------------------------------------------- /alpine-elk/scripts/run-es.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # uses es home to load all configs. 4 | # adding a "commandopts" to the volume allows you to pass more options to elasticsearch 5 | # for example heap size. "-Xmx10g -Xms10g" 6 | 7 | # production recommendations http://www.elastic.co/guide/en/elasticsearch/guide/current/deploy.html 8 | 9 | echo "===============================" 10 | echo "starting elastic search." 11 | echo "===============================" 12 | echo "-------------------------------" 13 | echo "checking ulimits" 14 | echo "-------------------------------" 15 | 16 | mapmax=`cat /proc/sys/vm/max_map_count` 17 | filemax=`cat /proc/sys/fs/file-max` 18 | 19 | ulimit -a; 20 | 21 | echo "fs.file_max: $filemax" 22 | echo "vm.max_map_count: $mapmax" 23 | 24 | fds=`ulimit -n` 25 | if [ "$fds" -lt "64000" ] ; then 26 | echo "ES recommends 64k open files per process. you have "`ulimit -n` 27 | echo "the docker deamon should be run with increased file descriptors to increase those available in the container" 28 | echo " try \`ulimit -n 64000\`" 29 | else 30 | echo "you have more than 64k allowed file descriptors. awesome." 31 | fi 32 | 33 | echo "-------------------------------" 34 | echo "files in volume" 35 | echo "-------------------------------" 36 | 37 | vol=/var/lib/elasticsearch 38 | 39 | ls $vol 40 | 41 | esopts="" 42 | if [ -f "$vol/elasticsearch.yml" ]; then 43 | esopts="-Des.path.home=$vol"; 44 | echo "setting es.path.home to $vol" 45 | else 46 | echo "[WARNING] missing elasticsearch config. not setting es.path.home to $vol" 47 | fi 48 | 49 | commandopts="" 50 | if [ -f "/var/lib/elasticsearch/javaopts.sh" ]; then 51 | commandopts=`cat /var/lib/elasticsearch/commandopts` 52 | fi 53 | 54 | echo "-------------------------------" 55 | echo "command opts" 56 | echo "-------------------------------" 57 | echo $commandopts 58 | 59 | echo "-------------------------------" 60 | echo "elastic search command" 61 | echo "-------------------------------" 62 | 63 | echo "/opt/elasticsearch/bin/elasticsearch $commandopts $esopts" 64 | 65 | start() { 66 | exec /opt/elasticsearch/bin/elasticsearch $commandopts $esopts 67 | } 68 | 69 | start 70 | 71 | -------------------------------------------------------------------------------- /alpine-elk/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "[i] Starting logstash" 4 | /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION/bin/logstash -f /etc/$LOGSTASH_NAME/$LOGSTASH_NAME.json & 5 | echo "[i] Starting kibana" 6 | /opt/kibana/bin/kibana & 7 | echo "[i] Starting elasticsearch" 8 | /scripts/run-es.sh 9 | -------------------------------------------------------------------------------- /alpine-kibana/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.2 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | # Set environment variables 5 | ENV KIBANA_VERSION 4.1.1 6 | ENV PKG_NAME kibana 7 | ENV PKG_PLATFORM linux-x64 8 | ENV KIBANA_PKG $PKG_NAME-$KIBANA_VERSION-$PKG_PLATFORM 9 | ENV KIBANA_CONFIG /opt/$PKG_NAME-$KIBANA_VERSION-$PKG_PLATFORM/config/kibana.yml 10 | ENV KIBANA_URL https://download.elastic.co/$PKG_NAME/$PKG_NAME/$KIBANA_PKG.tar.gz 11 | ENV ELASTICSEARCH_HOST elasticsearch 12 | 13 | # Download Kibana 14 | RUN apk add --update ca-certificates wget nodejs \ 15 | && mkdir -p /opt \ 16 | && wget -O /tmp/$KIBANA_PKG.tar.gz $KIBANA_URL \ 17 | && tar -xvzf /tmp/$KIBANA_PKG.tar.gz -C /opt/ \ 18 | && ln -s /opt/$KIBANA_PKG /opt/$PKG_NAME \ 19 | && sed -i "s/localhost/$ELASTICSEARCH_HOST/" $KIBANA_CONFIG \ 20 | && rm -rf /tmp/*.tar.gz /var/cache/apk/* /opt/$KIBANA_PKG/node/ \ 21 | && mkdir -p /opt/$KIBANA_PKG/node/bin/ \ 22 | && ln -s $(which node) /opt/$PKG_NAME/node/bin/node 23 | 24 | # Expose 25 | EXPOSE 5601 26 | 27 | USER nobody 28 | 29 | # Working directory 30 | WORKDIR ["/opt/kibana"] 31 | CMD ["/opt/kibana/bin/kibana"] 32 | -------------------------------------------------------------------------------- /alpine-kibana/docker-compose.yml: -------------------------------------------------------------------------------- 1 | elasticsearch: 2 | image: k0st/alpine-elasticsearch 3 | volumes: 4 | - /home/vkosturj/docker/su/alpine-kibana/blah:/var/lib/elasticsearch 5 | 6 | kibana: 7 | image: k0st/alpine-kibana 8 | ports: 9 | - "10080:5601" 10 | links: 11 | - elasticsearch 12 | 13 | logstash: 14 | image: k0st/alpine-logstash 15 | links: 16 | - elasticsearch 17 | 18 | -------------------------------------------------------------------------------- /alpine-logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jolokia/alpine-jre-8 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | # Set environment variables 5 | ENV LOGSTASH_NAME logstash 6 | ENV LOGSTASH_VERSION 1.5.3 7 | ENV LOGSTASH_URL https://download.elastic.co/$LOGSTASH_NAME/$LOGSTASH_NAME/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz 8 | ENV LOGSTASH_CONFIG /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION/etc/logstash.json 9 | 10 | RUN apk update \ 11 | && apk add bash openssl \ 12 | && mkdir -p /opt \ 13 | && wget -O /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz $LOGSTASH_URL \ 14 | && tar xzf /tmp/$LOGSTASH_NAME-$LOGSTASH_VERSION.tar.gz -C /opt/ \ 15 | && ln -s /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION /opt/$LOGSTASH_NAME \ 16 | && rm -rf /tmp/*.tar.gz /var/cache/apk/* \ 17 | && mkdir -p /scripts/pre-exec.d && \ 18 | mkdir /scripts/pre-init.d && \ 19 | chmod -R 755 /scripts 20 | 21 | # Add logstash config file 22 | ADD etc /opt/$LOGSTASH_NAME-$LOGSTASH_VERSION/etc 23 | ADD scripts /scripts 24 | 25 | # Expose Syslog TCP and UDP ports 26 | EXPOSE 514 514/udp 8080 27 | WORKDIR /opt/$LOGSTASH_NAME 28 | 29 | ENTRYPOINT ["/scripts/run.sh"] 30 | -------------------------------------------------------------------------------- /alpine-logstash/etc/logstash.json.basic: -------------------------------------------------------------------------------- 1 | input { 2 | stdin { } 3 | http { 4 | port => 8080 5 | } 6 | tcp { 7 | port => 514 8 | type => syslog 9 | } 10 | udp { 11 | port => 514 12 | type => syslog 13 | } 14 | } 15 | 16 | output { 17 | stdout { codec => rubydebug } 18 | } 19 | -------------------------------------------------------------------------------- /alpine-logstash/etc/logstash.json.es: -------------------------------------------------------------------------------- 1 | input { 2 | stdin { } 3 | http { 4 | port => 8080 5 | } 6 | tcp { 7 | port => 514 8 | type => syslog 9 | } 10 | udp { 11 | port => 514 12 | type => syslog 13 | } 14 | } 15 | 16 | output { 17 | stdout { codec => rubydebug } 18 | elasticsearch { host => elasticsearch } 19 | } 20 | -------------------------------------------------------------------------------- /alpine-logstash/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # execute any pre-init scripts, useful for images 4 | # based on this image 5 | for i in /scripts/pre-init.d/*sh 6 | do 7 | if [ -e "${i}" ]; then 8 | echo "[i] pre-init.d - processing $i" 9 | . "${i}" 10 | fi 11 | done 12 | 13 | if [ -f $LOGSTASH_CONFIG ]; then 14 | echo "[i] Config file exists." 15 | else 16 | if [ "$ELASTICSEARCH_NAME" == "" ]; then 17 | echo "[i] New container without linked elasticsearch. Output is to stdout" 18 | ln -sf $LOGSTASH_CONFIG.basic $LOGSTASH_CONFIG 19 | else 20 | echo "[i] New container with elasticsearch. Output is to stdout and elasticsearch." 21 | ln -sf $LOGSTASH_CONFIG.es $LOGSTASH_CONFIG 22 | fi 23 | fi 24 | 25 | # execute any pre-exec scripts, useful for images 26 | # based on this image 27 | for i in /scripts/pre-exec.d/*sh 28 | do 29 | if [ -e "${i}" ]; then 30 | echo "[i] pre-exec.d - processing $i" 31 | . ${i} 32 | fi 33 | done 34 | 35 | echo "[i] Starting logstash" 36 | /opt/$LOGSTASH_NAME/bin/logstash -f $LOGSTASH_CONFIG 37 | echo "[i] Logstash finished" 38 | -------------------------------------------------------------------------------- /alpine-mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost - https://github.com/kost 3 | 4 | RUN apk --update add mysql mysql-client pwgen && rm -f /var/cache/apk/* && \ 5 | echo "Success" 6 | 7 | ADD scripts/run.sh /scripts/run.sh 8 | RUN mkdir /scripts/pre-exec.d && \ 9 | mkdir /scripts/pre-init.d && \ 10 | chmod -R 755 /scripts 11 | 12 | EXPOSE 3306 13 | # WORKDIR /app 14 | 15 | VOLUME ["/var/lib/mysql"] 16 | 17 | ENTRYPOINT ["/scripts/run.sh"] 18 | 19 | -------------------------------------------------------------------------------- /alpine-mariadb/README.md: -------------------------------------------------------------------------------- 1 | # k0st/alpine-mariadb 2 | 3 | Multiple purpose MariaDB/MySQL based on Alpine 4 | 5 | Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image 6 | 7 | ## Docker image size 8 | 9 | [![Latest](https://badge.imagelayers.io/k0st/alpine-mariadb.svg)](https://imagelayers.io/?images=k0st/alpine-mariadb:latest 'latest') 10 | 11 | ## Docker image usage 12 | 13 | ``` 14 | docker run [docker-options] k0st/alpine-mariadb 15 | ``` 16 | 17 | Note that MySQL root will be randomly generated (using pwgen). 18 | Root password will be displayed, during first run using output similar to this: 19 | ``` 20 | [i] MySQL root Password: XXXXXXXXXXXXXXX 21 | ``` 22 | 23 | But you don't need root password really. If you connect locally, it should not 24 | ask you for password, so you can use following procedure: 25 | ``` 26 | docker exec -it mariadb_containerid /bin/sh 27 | # mysql -u root mysql 28 | ``` 29 | 30 | ## Examples 31 | 32 | Typical usage: 33 | 34 | ``` 35 | docker run -it -v /host/dir/for/db:/var/lib/mysql -e MYSQL_DATABASE=db -e MYSQL_USER=user -e MYSQL_PASSWORD=blah k0st/alpine-mariadb 36 | ``` 37 | 38 | ### Todo 39 | - [ ] Check volume and data 40 | - [ ] Provide more examples 41 | 42 | -------------------------------------------------------------------------------- /alpine-mariadb/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # execute any pre-init scripts, useful for images 4 | # based on this image 5 | for i in /scripts/pre-init.d/*sh 6 | do 7 | if [ -e "${i}" ]; then 8 | echo "[i] pre-init.d - processing $i" 9 | . "${i}" 10 | fi 11 | done 12 | 13 | if [ ! -d "/run/mysqld" ]; then 14 | mkdir -p /run/mysqld 15 | chown -R mysql:mysql /run/mysqld 16 | fi 17 | 18 | if [ -d /var/lib/mysql/mysql ]; then 19 | echo "[i] MySQL directory already present, skipping creation" 20 | else 21 | echo "[i] MySQL data directory not found, creating initial DBs" 22 | 23 | chown -R mysql:mysql /var/lib/mysql 24 | 25 | mysql_install_db --user=mysql > /dev/null 26 | 27 | if [ "$MYSQL_ROOT_PASSWORD" = "" ]; then 28 | MYSQL_ROOT_PASSWORD=`pwgen 16 1` 29 | echo "[i] MySQL root Password: $MYSQL_ROOT_PASSWORD" 30 | fi 31 | 32 | MYSQL_DATABASE=${MYSQL_DATABASE:-""} 33 | MYSQL_USER=${MYSQL_USER:-""} 34 | MYSQL_PASSWORD=${MYSQL_PASSWORD:-""} 35 | 36 | tfile=`mktemp` 37 | if [ ! -f "$tfile" ]; then 38 | return 1 39 | fi 40 | 41 | cat << EOF > $tfile 42 | USE mysql; 43 | FLUSH PRIVILEGES; 44 | GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; 45 | UPDATE user SET password=PASSWORD("$MYSQL_ROOT_PASSWORD") WHERE user='root'; 46 | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION; 47 | UPDATE user SET password=PASSWORD("") WHERE user='root' AND host='localhost'; 48 | EOF 49 | 50 | if [ "$MYSQL_DATABASE" != "" ]; then 51 | echo "[i] Creating database: $MYSQL_DATABASE" 52 | echo "CREATE DATABASE IF NOT EXISTS \`$MYSQL_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile 53 | 54 | if [ "$MYSQL_USER" != "" ]; then 55 | echo "[i] Creating user: $MYSQL_USER with password $MYSQL_PASSWORD" 56 | echo "GRANT ALL ON \`$MYSQL_DATABASE\`.* to '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';" >> $tfile 57 | fi 58 | fi 59 | 60 | /usr/bin/mysqld --user=mysql --bootstrap --verbose=0 < $tfile 61 | rm -f $tfile 62 | fi 63 | 64 | # execute any pre-exec scripts, useful for images 65 | # based on this image 66 | for i in /scripts/pre-exec.d/*sh 67 | do 68 | if [ -e "${i}" ]; then 69 | echo "[i] pre-exec.d - processing $i" 70 | . ${i} 71 | fi 72 | done 73 | 74 | exec /usr/bin/mysqld --user=mysql --console 75 | -------------------------------------------------------------------------------- /alpine-mosquitto/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | RUN apk add --update mosquitto mosquitto-clients && \ 5 | mkdir /work && chown nobody /work 6 | 7 | VOLUME ["/work"] 8 | WORKDIR /work 9 | 10 | USER nobody 11 | 12 | EXPOSE 1883 13 | 14 | ENTRYPOINT ["mosquitto"] 15 | 16 | -------------------------------------------------------------------------------- /alpine-postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost - https://github.com/kost 3 | 4 | RUN apk --update add postgresql openssl && rm -f /var/cache/apk/* && \ 5 | wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.4/gosu-amd64" && \ 6 | chmod +x /usr/local/bin/gosu && \ 7 | echo "Success" 8 | 9 | ADD scripts/run.sh /scripts/run.sh 10 | RUN mkdir /scripts/pre-exec.d && \ 11 | mkdir /scripts/pre-init.d && \ 12 | chmod -R 755 /scripts 13 | 14 | ENV LANG en_US.utf8 15 | ENV PGDATA /var/lib/postgresql/data 16 | VOLUME ["/var/lib/postgresql/data"] 17 | 18 | EXPOSE 5432 19 | 20 | ENTRYPOINT ["/scripts/run.sh"] 21 | 22 | -------------------------------------------------------------------------------- /alpine-postgres/README.md: -------------------------------------------------------------------------------- 1 | # k0st/alpine-postgres 2 | 3 | Multiple purpose PostgreSQL database based on Alpine 4 | 5 | Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image 6 | 7 | ## Docker image size 8 | 9 | [![Latest](https://badge.imagelayers.io/k0st/alpine-postgres.svg)](https://imagelayers.io/?images=k0st/alpine-postgres:latest 'latest') 10 | 11 | ## Docker image usage 12 | 13 | ``` 14 | docker run [docker-options] k0st/alpine-postgres 15 | 16 | 17 | ``` 18 | 19 | ## Variables 20 | 21 | Following environment variables will be used when running: 22 | 23 | ### Standard 24 | 25 | `PGDATA` - location of PostgreSQL database files (default: /var/lib/postgresql/data) 26 | `POSTGRES_USER` - PostgreSQL username (if not specified: postgres) 27 | `POSTGRES_PASSWORD` - PostgreSQL password (if not specified: empty) 28 | 29 | ### Specific to this image 30 | 31 | `POSTGRES_DB` - PostgreSQL database name (if not specified: same as `POSTGRES_USER`) 32 | `POSTGRES_FIX_OWNERSHIP` - PostgreSQL fix ownership of PGDATA 33 | 34 | 35 | ## Remarks 36 | 37 | Note that if you don't specify any POSTGRES environment parameters, 38 | postgres will listen on all interfaces with ALL privileges as postgres 39 | user. 40 | 41 | You just need to minimaly specify `POSTGRES_USER` as env variable in 42 | order to create PostgreSQL database with same name. Password will be 43 | empty. 44 | 45 | By default, only permissions to access `POSTGRES_DB` is given to 46 | `POSTGRES_USER`. No SUPERUSER permissions will be given. 47 | 48 | But you don't need SUPERUSER permissions really. If you connect locally, 49 | it should not ask you for password, so you can use following procedure: 50 | 51 | ``` 52 | docker exec -it postgres_containerid /bin/sh 53 | # gosu postgres psql 54 | ``` 55 | 56 | Only if nothing is specified, user postgres will 57 | have SUPERUSER privileges with access allowed from all hosts. 58 | 59 | ## Examples 60 | 61 | Quick testing (you can connect to this host from any hosts with username postgres): 62 | 63 | ``` 64 | docker run -it --rm k0st/alpine-postgres 65 | ``` 66 | 67 | Typical usage, create user test and database test: 68 | 69 | ``` 70 | docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test k0st/alpine-postgres 71 | ``` 72 | 73 | Typical usage, create user test with password Passw0rd and database testdb 74 | ``` 75 | docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test -e POSTGRES_PASSWORD=Passw0rd -e POSTGRES_DB=testdb k0st/alpine-postgres 76 | ``` 77 | 78 | ### Todo 79 | - [ ] Provide more examples 80 | 81 | -------------------------------------------------------------------------------- /alpine-postgres/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | : ${PGDATA:=/var/lib/postgresql/data} 4 | : ${POSTGRES_USER:="postgres"} 5 | : ${POSTGRES_DB:=$POSTGRES_USER} 6 | 7 | setupdb() { 8 | if [ -z "$(ls -A "$PGDATA")" ]; then 9 | echo "[i] Creating a new PostgreSQL database cluster" 10 | if [ -d "$PGDATA" ]; then 11 | chown -Rf postgres:postgres "${PGDATA}" 12 | fi 13 | gosu postgres initdb $PGDATA 14 | sed -ri "s/^#(listen_addresses\s*=\s*)\S+/\1'*'/" "$PGDATA"/postgresql.conf 15 | createdb 16 | adduser 17 | else 18 | echo "[i] Directory already exists, not creating initial database" 19 | if [ "$POSTGRES_FIX_OWNERSHIP" = "" ]; then 20 | echo "[i] Not touching ownerships, if you want it - set POSTGRES_FIX_OWNERSHIP=1" 21 | else 22 | echo "[i] Touching ownerships" 23 | chown -Rf postgres:postgres "${PGDATA}" 24 | chmod 0700 "${PGDATA}" 25 | fi 26 | fi 27 | } 28 | 29 | adduser() { 30 | echo "[i] Adding users" 31 | if [ "$POSTGRES_PASSWORD" ]; then 32 | pass="PASSWORD '$POSTGRES_PASSWORD'" 33 | authMethod=md5 34 | else 35 | echo "[!] use POSTGRES_PASSWORD to set postgres password" 36 | pass= 37 | authMethod=trust 38 | fi 39 | 40 | # echo not needed, enabled by default 41 | # { echo; echo "local all all 127.0.0.1/8 trust"; } >> "$PGDATA"/pg_hba.conf 42 | 43 | { echo; echo "host all all 0.0.0.0/0 $authMethod"; } >> "$PGDATA"/pg_hba.conf 44 | 45 | if [ "$POSTGRES_USER" != 'postgres' ]; then 46 | op=CREATE 47 | userSql="$op USER $POSTGRES_USER WITH $pass;" 48 | echo $userSql | gosu postgres postgres --single -jE 49 | grantSql="GRANT ALL PRIVILEGES ON DATABASE $POSTGRES_DB TO $POSTGRES_USER;" 50 | echo $grantSql | gosu postgres postgres --single -jE 51 | else 52 | op=ALTER 53 | userSql="$op USER $POSTGRES_USER WITH $pass;" 54 | echo $userSql | gosu postgres postgres --single -jE 55 | fi 56 | } 57 | 58 | createdb() { 59 | if [ "$POSTGRES_DB" != "postgres" ]; then 60 | echo "[i] Creating initial database: $POSTGRES_DB" 61 | createSql="CREATE DATABASE $POSTGRES_DB;" 62 | echo $createSql | gosu postgres postgres --single -jE 63 | fi 64 | } 65 | 66 | # execute any pre-init scripts, useful for images 67 | # based on this image 68 | for i in /scripts/pre-init.d/*sh 69 | do 70 | if [ -e "${i}" ]; then 71 | echo "[i] pre-init.d - processing $i" 72 | . "${i}" 73 | fi 74 | done 75 | 76 | setupdb 77 | 78 | # execute any pre-exec scripts, useful for images 79 | # based on this image 80 | for i in /scripts/pre-exec.d/*sh 81 | do 82 | if [ -e "${i}" ]; then 83 | echo "[i] pre-exec.d - processing $i" 84 | . ${i} 85 | fi 86 | done 87 | 88 | echo 89 | echo "[i] Starting PostgreSQL..." 90 | 91 | exec gosu postgres postgres "$@" 92 | -------------------------------------------------------------------------------- /alpine-redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost, https://github.com/kost/docker-alpine 3 | 4 | # Install redis 5 | RUN apk add --update redis && \ 6 | rm -rf /var/cache/apk/* && \ 7 | mkdir /data && \ 8 | chown -R redis:redis /data && \ 9 | sed -i 's#logfile /var/log/redis/redis.log#logfile ""#i' /etc/redis.conf && \ 10 | sed -i 's#daemonize yes#daemonize no#i' /etc/redis.conf && \ 11 | sed -i 's#dir /var/lib/redis/#dir /data#i' /etc/redis.conf && \ 12 | echo -e "# placeholder for local options\n" > /etc/redis-local.conf && \ 13 | echo -e "include /etc/redis-local.conf\n" >> /etc/redis.conf 14 | 15 | VOLUME ["/data"] 16 | 17 | USER redis 18 | # Expose the ports for redis 19 | EXPOSE 6379 20 | 21 | ENTRYPOINT ["redis-server"] 22 | 23 | -------------------------------------------------------------------------------- /alpine-rt/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gliderlabs/alpine 2 | MAINTAINER kost - https://github.com/kost 3 | 4 | ENV RT_VERSION 4.2.12 5 | # https://download.bestpractical.com/pub/rt/release/rt-4.2.12.tar.gz 6 | 7 | RUN apk --update add openssl mysql-client postgresql-client fcgi lighttpd perl perl-lwp-protocol-https perl-dbd-pg perl-dbd-mysql perl-dbd-sqlite perl-cgi-psgi perl-cgi perl-fcgi perl-term-readkey perl-xml-rss perl-crypt-ssleay perl-crypt-eksblowfish perl-crypt-x509 perl-html-mason-psgihandler perl-fcgi-procmanager perl-mime-types perl-list-moreutils perl-json perl-html-quoted perl-html-scrubber perl-email-address perl-text-password-pronounceable perl-email-address-list perl-html-formattext-withlinks-andtables perl-html-rewriteattributes perl-text-wikiformat perl-text-quoted perl-datetime-format-natural perl-date-extract perl-data-guid perl-data-ical perl-string-shellquote perl-convert-color perl-dbix-searchbuilder perl-file-which perl-css-squish perl-tree-simple perl-plack perl-log-dispatch perl-module-versions-report perl-symbol-global-name perl-devel-globaldestruction perl-parallel-prefork perl-cgi-emulate-psgi perl-text-template perl-net-cidr perl-apache-session perl-locale-maketext-lexicon perl-locale-maketext-fuzzy perl-regexp-common-net-cidr perl-module-refresh perl-date-manip perl-regexp-ipv6 perl-text-wrapper perl-universal-require perl-role-basic perl-convert-binhex perl-test-sharedfork perl-test-tcp perl-server-starter perl-starlet make gnupg gcc perl-dev libc-dev && \ 8 | rm -f /var/cache/apk/* && \ 9 | wget -O /tmp/rt-$RT_VERSION.tar.gz https://download.bestpractical.com/pub/rt/release/rt-$RT_VERSION.tar.gz && \ 10 | tar -xvz -C /tmp -f /tmp/rt-$RT_VERSION.tar.gz && \ 11 | cd /tmp/rt-$RT_VERSION && \ 12 | (echo y;echo o conf prerequisites_policy follow;echo o conf commit)|cpan && \ 13 | cpan -f GnuPG::Interface && \ 14 | ./configure --with-web-user=lighttpd --with-web-group=lighttpd && \ 15 | make fixdeps && \ 16 | make install && \ 17 | cd / && rm -rf /tmp/rt-$RT_VERSION rt-$RT_VERSION.tar.gz && \ 18 | echo "Success" 19 | 20 | ADD scripts/run.sh /scripts/run.sh 21 | ADD config/mod_fastcgi.conf /etc/lighttpd/ 22 | ADD config/lighttpd.conf /etc/lighttpd/ 23 | RUN mkdir /scripts/pre-exec.d && \ 24 | mkdir /scripts/pre-init.d && \ 25 | mkdir /scripts/pre-initdb.d && \ 26 | mkdir /scripts/post-initdb.d && \ 27 | chmod -R 755 /scripts 28 | 29 | EXPOSE 80 30 | 31 | ENTRYPOINT ["/scripts/run.sh"] 32 | # ENTRYPOINT ["/bin/sh"] 33 | 34 | -------------------------------------------------------------------------------- /alpine-rt/README.md: -------------------------------------------------------------------------------- 1 | # k0st/alpine-rt 2 | 3 | Multiple purpose Request Tracker (RT) from Best Practical based on Alpine 4 | 5 | Image is based on the [gliderlabs/alpine](https://registry.hub.docker.com/u/gliderlabs/alpine/) base image 6 | 7 | ## Docker image size 8 | 9 | [![Latest](https://badge.imagelayers.io/k0st/alpine-rt.svg)](https://imagelayers.io/?images=k0st/alpine-rt:latest 'latest') 10 | 11 | ## Docker image usage 12 | 13 | ``` 14 | docker run [docker-options] k0st/alpine-rt 15 | ``` 16 | 17 | ## Examples 18 | 19 | Typical basic usage (using SQLite if databate is not linked): 20 | 21 | ``` 22 | docker run -it k0st/alpine-rt 23 | ``` 24 | 25 | Typical usage in Dockerfile: 26 | 27 | ``` 28 | FROM k0st/alpine-rt 29 | RUN echo "echo "Set($WebPath, '/rt');"" /scripts/pre-initdb.d/50-rt-config.sh 30 | ``` 31 | 32 | And shell script (50-rt-config.sh) to configure: 33 | 34 | ``` 35 | #!/bin/sh 36 | echo "Set(\$WebPath, '/rt');" >> $RTCONF 37 | ``` 38 | 39 | Typical usage with PostgreSQL: 40 | 41 | ``` 42 | docker run -it -e POSTGRES_USER=rt -e POSTGRES_PASSWORD=rtpass -e POSTGRES_DB=rt --name=rtdb k0st/alpine-postgres 43 | docker run -it --name rt --link rtdb:db k0st/alpine-rt 44 | ``` 45 | 46 | Typical usage with MySQL/MariaDB: 47 | 48 | ``` 49 | docker run -it -e MYSQL_USER=rt -e MYSQL_PASSWORD=rtpass -e MYSQL_DATABASE=rt --name=rtdb k0st/alpine-mariadb 50 | docker run -it --name rt --link rtdb:db k0st/alpine-rt 51 | ``` 52 | 53 | ### Todo 54 | - [ ] Perform more testing 55 | 56 | -------------------------------------------------------------------------------- /alpine-rt/config/lighttpd.conf: -------------------------------------------------------------------------------- 1 | var.basedir = "/var/www/localhost" 2 | var.logdir = "/var/log/lighttpd" 3 | var.statedir = "/var/lib/lighttpd" 4 | 5 | server.modules = ( 6 | "mod_access", 7 | "mod_accesslog" 8 | ) 9 | 10 | include "mime-types.conf" 11 | include "mod_fastcgi.conf" 12 | 13 | server.username = "lighttpd" 14 | server.groupname = "lighttpd" 15 | 16 | server.document-root = "/opt/rt4/share/html" 17 | server.pid-file = "/var/run/lighttpd.pid" 18 | 19 | server.errorlog = var.logdir + "/error.log" 20 | 21 | server.indexfiles = ("index.php", "index.html", 22 | "index.htm", "default.htm") 23 | server.follow-symlink = "enable" 24 | 25 | static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi") 26 | 27 | accesslog.filename = var.logdir + "/access.log" 28 | 29 | url.access-deny = ("~", ".inc") 30 | 31 | -------------------------------------------------------------------------------- /alpine-rt/config/mod_fastcgi.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # mod_fastcgi.conf 3 | # include'd by lighttpd.conf. 4 | # $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/mod_fastcgi.conf-1.4.13-r2,v 1.1 2007/04/01 23:22:00 robbat2 Exp $ 5 | ############################################################################### 6 | 7 | server.modules += ("mod_fastcgi") 8 | 9 | index-file.names += ( "rt-server.fcgi" ) 10 | 11 | fastcgi.server = ( 12 | "/" => ( 13 | "rt" => ( 14 | "socket" => "/var/run/lighttpd/lighttpd-fcgi.sock", 15 | "bin-path" => "/opt/rt4/sbin/rt-server.fcgi" 16 | ) 17 | ) 18 | ) 19 | 20 | # vim: set ft=conf foldmethod=marker et : 21 | -------------------------------------------------------------------------------- /alpine-rt/docker-compose-mysql.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: k0st/alpine-mariadb 3 | # volumes: 4 | # - /data/mydb:/var/lib/mysql 5 | environment: 6 | - MYSQL_DATABASE=rt 7 | - MYSQL_USER=rt 8 | - MYSQL_PASSWORD=rtpass 9 | 10 | web: 11 | image: k0st/alpine-rt 12 | ports: 13 | - "10080:80" 14 | links: 15 | - db 16 | -------------------------------------------------------------------------------- /alpine-rt/docker-compose.yml: -------------------------------------------------------------------------------- 1 | db: 2 | image: k0st/alpine-postgres 3 | # volumes: 4 | # - /data/mydb:/var/lib/postgresql/data 5 | environment: 6 | - POSTGRES_DB=rt 7 | - POSTGRES_USER=rt 8 | - POSTGRES_PASSWORD=rtpass 9 | 10 | web: 11 | image: k0st/alpine-rt 12 | ports: 13 | - "10080:80" 14 | links: 15 | - db 16 | -------------------------------------------------------------------------------- /alpine-rt/scripts/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | RTCONF="/opt/rt4/etc/RT_SiteConfig.pm" 4 | MAXTRIES=20 5 | 6 | 7 | # execute any pre-init scripts, useful for images 8 | # based on this image 9 | for i in /scripts/pre-init.d/*sh 10 | do 11 | if [ -e "${i}" ]; then 12 | echo "[i] pre-init.d - processing $i" 13 | . "${i}" 14 | fi 15 | done 16 | 17 | wait4mysql () { 18 | echo "[i] Waiting for database to setup..." 19 | 20 | for i in $(seq 1 1 $MAXTRIES) 21 | do 22 | echo "[i] Trying to connect to database: try $i..." 23 | if [ "$DB_ENV_MYSQL_PASSWORD" = "" ]; then 24 | mysql -B --connect-timeout=1 -h db -u $DB_ENV_MYSQL_USER -e "SELECT VERSION();" $DB_ENV_MYSQL_DATABASE 25 | else 26 | mysql -B --connect-timeout=1 -h db -u $DB_ENV_MYSQL_USER -p$DB_ENV_MYSQL_PASSWORD -e "SELECT VERSION();" $DB_ENV_MYSQL_DATABASE 27 | fi 28 | 29 | if [ "$?" = "0" ]; then 30 | echo "[i] Successfully connected to database!" 31 | break 32 | else 33 | if [ "$i" = "$MAXTRIES" ]; then 34 | echo "[!] You need to have container for database. Take a look at docker-compose.yml file!" 35 | exit 0 36 | else 37 | sleep 5 38 | fi 39 | fi 40 | done 41 | } 42 | 43 | wait4psql () { 44 | echo "[i] Waiting for database to setup..." 45 | 46 | export PGPASSWORD=$DB_ENV_POSTGRES_PASSWORD 47 | for i in $(seq 1 1 $MAXTRIES) 48 | do 49 | echo "[i] Trying to connect to database: try $i..." 50 | psql -h db -U $DB_ENV_POSTGRES_USER -d $DB_ENV_POSTGRES_DB -w -c 'SELECT version();' 51 | if [ "$?" = "0" ]; then 52 | echo "[i] Successfully connected to database!" 53 | break 54 | else 55 | if [ "$i" = "$MAXTRIES" ]; then 56 | echo "[!] You need to have container for database. Take a look at docker-compose.yml file!" 57 | exit 0 58 | else 59 | sleep 5 60 | fi 61 | fi 62 | done 63 | } 64 | 65 | # set apache as owner/group 66 | # chown -R apache:apache /app 67 | 68 | 69 | if [ -f /opt/rt4/db.initialized ]; then 70 | echo "[i] Database already initialized. Not touching database!" 71 | if [ "$DB_ENV_MYSQL_USER" != "" ]; then 72 | wait4mysql 73 | fi 74 | if [ "$DB_ENV_POSTGRES_USER" != "" ]; then 75 | wait4psql 76 | fi 77 | else 78 | echo "[i] Database not initialized. Initializing..." 79 | echo "Set(\$rtname, 'example.com');" > $RTCONF 80 | echo "Set(\$DatabaseHost, 'db');" >> $RTCONF 81 | echo "Set(\$DatabaseRTHost, 'localhost');" >> $RTCONF 82 | 83 | FOUND_DB=0 84 | if [ "$DB_ENV_MYSQL_USER" != "" ]; then 85 | echo "[i] Found MySQL setup" 86 | echo "Set(\$DatabaseType, 'mysql');" >> $RTCONF 87 | echo "Set(\$DatabaseUser, '$DB_ENV_MYSQL_USER');" >> $RTCONF 88 | echo "Set(\$DatabasePassword, '$DB_ENV_MYSQL_PASSWORDr');" >> $RTCONF 89 | echo "Set(\$DatabaseName, '$DB_ENV_MYSQL_DATABASE');" >> $RTCONF 90 | FOUND_DB=1 91 | wait4mysql 92 | fi 93 | 94 | if [ "$DB_ENV_POSTGRES_USER" != "" ]; then 95 | echo "[i] Found PostgreSQL setup" 96 | echo "Set(\$DatabaseType, 'Pg');" >> $RTCONF 97 | echo "Set(\$DatabaseUser, '$DB_ENV_POSTGRES_USER');" >> $RTCONF 98 | echo "Set(\$DatabasePassword, '$DB_ENV_POSTGRESS_PASSWORD');" >> $RTCONF 99 | echo "Set(\$DatabaseName, '$DB_ENV_POSTGRES_DB');" >> $RTCONF 100 | FOUND_DB=1 101 | wait4psql 102 | fi 103 | 104 | if [ "$FOUND_DB" = "0" ]; then 105 | echo "[i] Container not linked with DB. Using SQLite." 106 | echo "Set(\$DatabaseType, 'SQLite');" >> $RTCONF 107 | fi 108 | 109 | for i in /scripts/pre-initdb.d/*sh 110 | do 111 | if [ -e "${i}" ]; then 112 | echo "[i] pre-initdb.d - processing $i" 113 | . "${i}" 114 | fi 115 | done 116 | 117 | echo "1;" >> $RTCONF 118 | 119 | echo "[i] Initializing database" 120 | /opt/rt4/sbin/rt-setup-database --action init --skip-create 121 | touch /opt/rt4/db.initialized 122 | 123 | for i in /scripts/post-initdb.d/*sh 124 | do 125 | if [ -e "${i}" ]; then 126 | echo "[i] post-initdb.d - processing $i" 127 | . "${i}" 128 | fi 129 | done 130 | fi 131 | 132 | 133 | # display logs 134 | tail -F /var/log/lighttpd/*log & 135 | 136 | # execute any pre-exec scripts, useful for images 137 | # based on this image 138 | for i in /scripts/pre-exec.d/*sh 139 | do 140 | if [ -e "${i}" ]; then 141 | echo "[i] pre-exec.d - processing $i" 142 | . "${i}" 143 | fi 144 | done 145 | 146 | echo "[i] Starting daemon..." 147 | # run daemon 148 | lighttpd -f /etc/lighttpd/lighttpd.conf -D 149 | 150 | killall tail 151 | --------------------------------------------------------------------------------