You've already forked postfixadmin-docker
							
							This commit is contained in:
		
							
								
								
									
										228
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										228
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,228 @@ | ||||
| --- | ||||
| kind: pipeline | ||||
| type: kubernetes | ||||
| name: linter | ||||
|  | ||||
| platform: | ||||
|   os: linux | ||||
|   arch: amd64 | ||||
|  | ||||
| steps: | ||||
| - name: markdown lint | ||||
|   commands: | ||||
|   - markdownlint *.md | ||||
|   image: docker.io/tmknom/markdownlint:0.23.1 | ||||
|   resources: | ||||
|     limits: | ||||
|       cpu: 50 | ||||
|       memory: 50M | ||||
|  | ||||
| - name: email-notification | ||||
|   environment: | ||||
|     PLUGIN_HOST: | ||||
|       from_secret: smtp_host | ||||
|     PLUGIN_USERNAME: | ||||
|       from_secret: smtp_username | ||||
|     PLUGIN_PASSWORD: | ||||
|       from_secret: smtp_password | ||||
|     PLUGIN_FROM: | ||||
|       from_secret: smtp_mail_address | ||||
|   image: docker.io/drillster/drone-email:latest | ||||
|   resources: | ||||
|     limits: | ||||
|       cpu: 50 | ||||
|       memory: 25M | ||||
|   when: | ||||
|     status: | ||||
|     - changed | ||||
|     - failure | ||||
|  | ||||
| trigger: | ||||
|   event: | ||||
|     exclude: | ||||
|     - tag | ||||
| --- | ||||
| kind: pipeline | ||||
| type: docker | ||||
| name: build-latest | ||||
|  | ||||
| platform: | ||||
|   os: linux | ||||
|   arch: amd64 | ||||
|  | ||||
| steps: | ||||
| - name: build | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/build | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|   when: | ||||
|     branch: | ||||
|     - master | ||||
|  | ||||
| - name: push | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/push | ||||
|   environment: | ||||
|     POSTFIXADMIN_IMAGE_REGISTRY_PASSWORD: | ||||
|       from_secret: container_image_registry_password | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|   when: | ||||
|     branch: | ||||
|     - master | ||||
|     repo: | ||||
|     - volker.raschek/postfixadmin-docker | ||||
|  | ||||
| - name: delete | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/delete | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|   when: | ||||
|     branch: | ||||
|     - master | ||||
|  | ||||
| - name: notify | ||||
|   image: drillster/drone-email | ||||
|   environment: | ||||
|     PLUGIN_HOST: | ||||
|       from_secret: smtp_host | ||||
|     PLUGIN_USERNAME: | ||||
|       from_secret: smtp_username | ||||
|     PLUGIN_PASSWORD: | ||||
|       from_secret: smtp_password | ||||
|     PLUGIN_FROM: | ||||
|       from_secret: smtp_mail_address | ||||
|   when: | ||||
|     status: | ||||
|     - changed | ||||
|     - failure | ||||
|  | ||||
| volumes: | ||||
| - name: docker_socket | ||||
|   host: | ||||
|     path: /var/run/docker.sock | ||||
|  | ||||
| trigger: | ||||
|   event: | ||||
|     exclude: | ||||
|     - tag | ||||
|  | ||||
| --- | ||||
| kind: pipeline | ||||
| type: docker | ||||
| name: build-tagged | ||||
|  | ||||
| platform: | ||||
|   os: linux | ||||
|   arch: amd64 | ||||
|  | ||||
| steps: | ||||
| - name: build | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/build POSTFIXADMIN_IMAGE_VERSION=${DRONE_TAG} | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|  | ||||
| - name: push | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/push POSTFIXADMIN_IMAGE_VERSION=${DRONE_TAG} | ||||
|   environment: | ||||
|     POSTFIXADMIN_IMAGE_REGISTRY_PASSWORD: | ||||
|       from_secret: container_image_registry_password | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|  | ||||
| - name: delete | ||||
|   image: docker.io/volkerraschek/build-image:latest | ||||
|   commands: | ||||
|   - make container-image/delete POSTFIXADMIN_IMAGE_VERSION=${DRONE_TAG} | ||||
|   volumes: | ||||
|   - name: docker_socket | ||||
|     path: /var/run/docker.sock | ||||
|  | ||||
| - name: notify | ||||
|   image: drillster/drone-email | ||||
|   environment: | ||||
|     PLUGIN_HOST: | ||||
|       from_secret: smtp_host | ||||
|     PLUGIN_USERNAME: | ||||
|       from_secret: smtp_username | ||||
|     PLUGIN_PASSWORD: | ||||
|       from_secret: smtp_password | ||||
|     PLUGIN_FROM: | ||||
|       from_secret: smtp_mail_address | ||||
|   when: | ||||
|     status: | ||||
|     - changed | ||||
|     - failure | ||||
|  | ||||
| volumes: | ||||
| - name: docker_socket | ||||
|   host: | ||||
|     path: /var/run/docker.sock | ||||
|  | ||||
| trigger: | ||||
|   event: | ||||
|   - tag | ||||
|   repo: | ||||
|   - volker.raschek/postfixadmin-docker | ||||
| --- | ||||
| kind: pipeline | ||||
| type: kubernetes | ||||
| name: sync | ||||
|  | ||||
| platform: | ||||
|   os: linux | ||||
|   arch: amd64 | ||||
|  | ||||
| steps: | ||||
| - name: github | ||||
|   image: docker.io/appleboy/drone-git-push:latest | ||||
|   resources: | ||||
|     limits: | ||||
|       cpu: 50 | ||||
|       memory: 25M | ||||
|   settings: | ||||
|     branch: master | ||||
|     remote: ssh://git@github.com/volker-raschek/postfixadmin-docker.git | ||||
|     force: true | ||||
|     ssh_key: | ||||
|       from_secret: ssh_key | ||||
|  | ||||
| - name: email-notification | ||||
|   environment: | ||||
|     PLUGIN_HOST: | ||||
|       from_secret: smtp_host | ||||
|     PLUGIN_USERNAME: | ||||
|       from_secret: smtp_username | ||||
|     PLUGIN_PASSWORD: | ||||
|       from_secret: smtp_password | ||||
|     PLUGIN_FROM: | ||||
|       from_secret: smtp_mail_address | ||||
|   image: docker.io/drillster/drone-email:latest | ||||
|   resources: | ||||
|     limits: | ||||
|       cpu: 50 | ||||
|       memory: 25M | ||||
|   when: | ||||
|     status: | ||||
|     - changed | ||||
|     - failure | ||||
|  | ||||
| trigger: | ||||
|   event: | ||||
|   - push | ||||
|   repo: | ||||
|   - volker.raschek/postfixadmin-docker | ||||
							
								
								
									
										15
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| # EditorConfig is awesome: https://EditorConfig.org | ||||
|  | ||||
| # top-most EditorConfig file | ||||
| root = true | ||||
|  | ||||
| [*] | ||||
| indent_style = space | ||||
| indent_size = 2 | ||||
| end_of_line = lf | ||||
| charset = utf-8 | ||||
| trim_trailing_whitespace = true | ||||
| insert_final_newline = false | ||||
|  | ||||
| [Makefile] | ||||
| indent_style = tab | ||||
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| Makefile eol=lf | ||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .env | ||||
							
								
								
									
										144
									
								
								.markdownlint.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								.markdownlint.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,144 @@ | ||||
| # markdownlint YAML configuration | ||||
| # https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml | ||||
|  | ||||
| # Default state for all rules | ||||
| default: true | ||||
|  | ||||
| # Path to configuration file to extend | ||||
| extends: null | ||||
|  | ||||
| # MD003/heading-style/header-style - Heading style | ||||
| MD003: | ||||
|   # Heading style | ||||
|   style: "atx" | ||||
|  | ||||
| # MD004/ul-style - Unordered list style | ||||
| MD004: | ||||
|   style: "dash" | ||||
|  | ||||
| # MD007/ul-indent - Unordered list indentation | ||||
| MD007: | ||||
|   # Spaces for indent | ||||
|   indent: 2 | ||||
|   # Whether to indent the first level of the list | ||||
|   start_indented: false | ||||
|  | ||||
| # MD009/no-trailing-spaces - Trailing spaces | ||||
| MD009: | ||||
|   # Spaces for line break | ||||
|   br_spaces: 2 | ||||
|   # Allow spaces for empty lines in list items | ||||
|   list_item_empty_lines: false | ||||
|   # Include unnecessary breaks | ||||
|   strict: false | ||||
|  | ||||
| # MD010/no-hard-tabs - Hard tabs | ||||
| MD010: | ||||
|   # Include code blocks | ||||
|   code_blocks: true | ||||
|  | ||||
| # MD012/no-multiple-blanks - Multiple consecutive blank lines | ||||
| MD012: | ||||
|   # Consecutive blank lines | ||||
|   maximum: 1 | ||||
|  | ||||
| # MD013/line-length - Line length | ||||
| MD013: | ||||
|   # Number of characters | ||||
|   line_length: 80 | ||||
|   # Number of characters for headings | ||||
|   heading_line_length: 80 | ||||
|   # Number of characters for code blocks | ||||
|   code_block_line_length: 80 | ||||
|   # Include code blocks | ||||
|   code_blocks: false | ||||
|   # Include tables | ||||
|   tables: false | ||||
|   # Include headings | ||||
|   headings: true | ||||
|   # Include headings | ||||
|   headers: true | ||||
|   # Strict length checking | ||||
|   strict: false | ||||
|   # Stern length checking | ||||
|   stern: false | ||||
|  | ||||
| # MD022/blanks-around-headings/blanks-around-headers - Headings should be surrounded by blank lines | ||||
| MD022: | ||||
|   # Blank lines above heading | ||||
|   lines_above: 1 | ||||
|   # Blank lines below heading | ||||
|   lines_below: 1 | ||||
|  | ||||
| # MD024/no-duplicate-heading/no-duplicate-header - Multiple headings with the same content | ||||
| MD024: | ||||
|   # Only check sibling headings | ||||
|   allow_different_nesting: true | ||||
|  | ||||
| # MD025/single-title/single-h1 - Multiple top-level headings in the same document | ||||
| MD025: | ||||
|   # Heading level | ||||
|   level: 1 | ||||
|   # RegExp for matching title in front matter | ||||
|   front_matter_title: "^\\s*title\\s*[:=]" | ||||
|  | ||||
| # MD026/no-trailing-punctuation - Trailing punctuation in heading | ||||
| MD026: | ||||
|   # Punctuation characters | ||||
|   punctuation: ".,;:!。,;:!" | ||||
|  | ||||
| # MD029/ol-prefix - Ordered list item prefix | ||||
| MD029: | ||||
|   # List style | ||||
|   style: "one_or_ordered" | ||||
|  | ||||
| # MD030/list-marker-space - Spaces after list markers | ||||
| MD030: | ||||
|   # Spaces for single-line unordered list items | ||||
|   ul_single: 1 | ||||
|   # Spaces for single-line ordered list items | ||||
|   ol_single: 1 | ||||
|   # Spaces for multi-line unordered list items | ||||
|   ul_multi: 1 | ||||
|   # Spaces for multi-line ordered list items | ||||
|   ol_multi: 1 | ||||
|  | ||||
| # MD033/no-inline-html - Inline HTML | ||||
| MD033: | ||||
|   # Allowed elements | ||||
|   allowed_elements: [] | ||||
|  | ||||
| # MD035/hr-style - Horizontal rule style | ||||
| MD035: | ||||
|   # Horizontal rule style | ||||
|   style: "---" | ||||
|  | ||||
| # MD036/no-emphasis-as-heading/no-emphasis-as-header - Emphasis used instead of a heading | ||||
| MD036: | ||||
|   # Punctuation characters | ||||
|   punctuation: ".,;:!?。,;:!?" | ||||
|  | ||||
| # MD041/first-line-heading/first-line-h1 - First line in a file should be a top-level heading | ||||
| MD041: | ||||
|   # Heading level | ||||
|   level: 1 | ||||
|   # RegExp for matching title in front matter | ||||
|   front_matter_title: "^\\s*title\\s*[:=]" | ||||
|  | ||||
| # MD044/proper-names - Proper names should have the correct capitalization | ||||
| MD044: | ||||
|   # List of proper names | ||||
|   names: | ||||
|   - PostfixAdmin | ||||
|   # Include code blocks | ||||
|   code_blocks: false | ||||
|  | ||||
| # MD046/code-block-style - Code block style | ||||
| MD046: | ||||
|   # Block style | ||||
|   style: "fenced" | ||||
|  | ||||
| # MD048/code-fence-style - Code fence style | ||||
| MD048: | ||||
|   # Code fence syle | ||||
|   style: "backtick" | ||||
							
								
								
									
										70
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| FROM docker.io/library/php:7.4-apache | ||||
|  | ||||
| # POSTFIXADMIN VERSION | ||||
| ARG POSTFIXADMIN_VERSION \ | ||||
|     POSTFIXADMIN_SHA512 | ||||
|  | ||||
| # APACHE | ||||
| ENV APACHE_DOCUMENT_ROOT /var/www/html/public | ||||
|  | ||||
| RUN set -eu; \ | ||||
|   sed --in-place --regexp-extended 's#/var/www/html#${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/sites-available/*.conf; \ | ||||
|   sed --in-place --regexp-extended 's#/var/www/#${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | ||||
|  | ||||
| # DEFAULT DATABASE SETTINGS | ||||
| ENV POSTFIXADMIN_DATABASE_TYPE=sqlite \ | ||||
|     POSTFIXADMIN_DATABASE_HOST="" \ | ||||
|     POSTFIXADMIN_DATABASE_PORT="" \ | ||||
|     POSTFIXADMIN_DATABASE_USER="" \ | ||||
|     POSTFIXADMIN_DATABASE_PASSWORD="" \ | ||||
|     POSTFIXADMIN_SMTP_SERVER="localhost" \ | ||||
|     POSTFIXADMIN_SMTP_PORT="25" \ | ||||
|     POSTFIXADMIN_ENCRYPT="md5crypt" | ||||
|  | ||||
| # docker-entrypoint.sh dependencies | ||||
| RUN set -eux; \ | ||||
|   apt-get update; \ | ||||
|   apt-get install --yes --no-install-recommends gosu; \ | ||||
|   rm --recursive --force /var/lib/apt/lists/* | ||||
|  | ||||
| # Install required PHP extensions | ||||
| RUN set -ex; \ | ||||
|   savedAptMark="$(apt-mark showmanual)"; \ | ||||
|   apt-get update; \ | ||||
|   apt-get install --yes --no-install-recommends \ | ||||
|     libc-client2007e-dev \ | ||||
|     libkrb5-dev \ | ||||
|     libpq-dev \ | ||||
|     libsqlite3-dev; \ | ||||
|   docker-php-ext-configure imap --with-imap-ssl --with-kerberos; \ | ||||
|   docker-php-ext-install -j "$(nproc)" \ | ||||
|     imap \ | ||||
|     pdo_mysql \ | ||||
|     pdo_pgsql \ | ||||
|     pdo_sqlite \ | ||||
|     pgsql; \ | ||||
|   apt-mark auto '.*' > /dev/null; \ | ||||
|   apt-mark manual $savedAptMark; \ | ||||
|     ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ | ||||
|     | awk '/=>/ { print $3 }' \ | ||||
|     | sort -u \ | ||||
|     | xargs -r dpkg-query -S \ | ||||
|     | cut -d: -f1 \ | ||||
|     | sort -u \ | ||||
|     | xargs -rt apt-mark manual; \ | ||||
|   apt-get purge --yes --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | ||||
|   rm --recursive --force /var/lib/apt/lists/* | ||||
|  | ||||
| RUN set -eu; \ | ||||
|   curl --fail --silent --show-error --location "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz" --output postfixadmin.tar.gz ; \ | ||||
|   echo "${POSTFIXADMIN_SHA512} *postfixadmin.tar.gz" | sha512sum -c -; \ | ||||
|   tar --extract --file postfixadmin.tar.gz --directory /var/www/html --strip-components=1; \ | ||||
|   rm postfixadmin.tar.gz; \ | ||||
|   # Does not exist in tarball but is required | ||||
|   mkdir --parents /var/www/html/templates_c; \ | ||||
|   chown --recursive www-data:www-data /var/www/html | ||||
|  | ||||
| COPY entrypoint.sh /usr/local/bin/ | ||||
|  | ||||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||||
| CMD ["apache2-foreground"] | ||||
							
								
								
									
										13
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| Copyright 2019 Markus Pesch | ||||
|  | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| You may obtain a copy of the License at | ||||
|  | ||||
|     http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
| Unless required by applicable law or agreed to in writing, software | ||||
| distributed under the License is distributed on an "AS IS" BASIS, | ||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| See the License for the specific language governing permissions and | ||||
| limitations under the License. | ||||
							
								
								
									
										52
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| POSTFIXADMIN_VERSION:=3.3.10 | ||||
| POSTFIXADMIN_SHA512:=e00fc9ea343a928976d191adfa01020ee0c6ddbe80a39e01ca2ee414a18247958f033970f378fe4a9974636172a5e094e57117ee9ac7b930c592f433097a7aca | ||||
|  | ||||
| # CONTAINER_RUNTIME | ||||
| # The CONTAINER_RUNTIME variable will be used to specified the path to a | ||||
| # container runtime. This is needed to start and run a container image. | ||||
| CONTAINER_RUNTIME?=$(shell which docker) | ||||
|  | ||||
| # POSTFIXADMIN_IMAGE_REGISTRY_NAME | ||||
| # Defines the name of the new container to be built using several variables. | ||||
| POSTFIXADMIN_IMAGE_REGISTRY_NAME:=docker.io | ||||
| POSTFIXADMIN_IMAGE_REGISTRY_USER:=volkerraschek | ||||
|  | ||||
| POSTFIXADMIN_IMAGE_NAMESPACE?=${POSTFIXADMIN_IMAGE_REGISTRY_USER} | ||||
| POSTFIXADMIN_IMAGE_NAME:=postfixadmin | ||||
| POSTFIXADMIN_IMAGE_VERSION?=latest | ||||
| POSTFIXADMIN_IMAGE_FULLY_QUALIFIED=${POSTFIXADMIN_IMAGE_REGISTRY_NAME}/${POSTFIXADMIN_IMAGE_NAMESPACE}/${POSTFIXADMIN_IMAGE_NAME}:${POSTFIXADMIN_IMAGE_VERSION} | ||||
| POSTFIXADMIN_IMAGE_UNQUALIFIED=${POSTFIXADMIN_IMAGE_NAMESPACE}/${POSTFIXADMIN_IMAGE_NAME}:${POSTFIXADMIN_IMAGE_VERSION} | ||||
|  | ||||
| # BUILD CONTAINER IMAGE | ||||
| # ============================================================================== | ||||
| PHONY:=container-image/build | ||||
| container-image/build: | ||||
| 	${CONTAINER_RUNTIME} build \ | ||||
| 		--build-arg POSTFIXADMIN_VERSION=${POSTFIXADMIN_VERSION} \ | ||||
| 		--build-arg POSTFIXADMIN_SHA512=${POSTFIXADMIN_SHA512} \ | ||||
| 		--file Dockerfile \ | ||||
| 		--no-cache \ | ||||
| 		--pull \ | ||||
| 		--tag ${POSTFIXADMIN_IMAGE_FULLY_QUALIFIED} \ | ||||
| 		--tag ${POSTFIXADMIN_IMAGE_UNQUALIFIED} \ | ||||
| 		. | ||||
|  | ||||
| # DELETE CONTAINER IMAGE | ||||
| # ============================================================================== | ||||
| PHONY:=container-image/delete | ||||
| container-image/delete: | ||||
| 	- ${CONTAINER_RUNTIME} image rm ${POSTFIXADMIN_IMAGE_FULLY_QUALIFIED} ${POSTFIXADMIN_IMAGE_UNQUALIFIED} | ||||
| 	- ${CONTAINER_RUNTIME} image rm ${PHP_IMAGE_FULL} | ||||
|  | ||||
| # PUSH CONTAINER IMAGE | ||||
| # ============================================================================== | ||||
| PHONY+=container-image/push | ||||
| container-image/push: | ||||
| 	echo ${POSTFIXADMIN_IMAGE_REGISTRY_PASSWORD} | ${CONTAINER_RUNTIME} login ${POSTFIXADMIN_IMAGE_REGISTRY_NAME} --username ${POSTFIXADMIN_IMAGE_REGISTRY_USER} --password-stdin | ||||
| 	${CONTAINER_RUNTIME} push ${POSTFIXADMIN_IMAGE_FULLY_QUALIFIED} | ||||
|  | ||||
| # PHONY | ||||
| # ============================================================================== | ||||
| # Declare the contents of the PHONY variable as phony.  We keep that information | ||||
| # in a variable so we can use it in if_changed. | ||||
| .PHONY: ${PHONY} | ||||
							
								
								
									
										177
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										177
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,177 @@ | ||||
| # PostfixAdmin | ||||
|  | ||||
| [](https://drone.cryptic.systems/volker.raschek/postfixadmin-docker) | ||||
| [](https://hub.docker.com/r/volkerraschek/postfixadmin) | ||||
| [](https://artifacthub.io/packages/search?repo=volker-raschek) | ||||
|  | ||||
| This is an alternative project to build a container image for | ||||
| [PostfixAdmin](https://github.com/postfixadmin/postfixadmin). | ||||
|  | ||||
| The main goal of this alternative image is to support a kubernetes deployment | ||||
| via helm. Furthermore, the container image support configuring via environment | ||||
| variables. | ||||
|  | ||||
| Checkout the helm repository of | ||||
| [volker-raschek](https://artifacthub.io/packages/helm/volker-raschek/postfixadmin) | ||||
| on [artifacthub.io](https://artifacthub.io) for more details. | ||||
|  | ||||
| ## Supported environment variables | ||||
|  | ||||
| This list is an overview over some important environment variables. The | ||||
| environment variables are composed on the key of the PHP configuration with the | ||||
| prefix `POSTFIXADMIN_`. You can take an example | ||||
| [configuration](https://github.com/postfixadmin/postfixadmin/blob/master/config.inc.php) | ||||
| from the upstream project. | ||||
|  | ||||
| | name                                | default                     | | ||||
| | ----------------------------------- | --------------------------- | | ||||
| | `POSTFIXADMIN_ADMIN_EMAIL`          |                             | | ||||
| | `POSTFIXADMIN_ADMIN_SMTP_PASSWORD`  |                             | | ||||
| | `POSTFIXADMIN_ADMIN_NAME`           |                             | | ||||
| | `POSTFIXADMIN_DATABASE_TYPE`        | `sqlite`                    | | ||||
| | `POSTFIXADMIN_DATABASE_USER`        |                             | | ||||
| | `POSTFIXADMIN_DATABASE_PASSWORD`    |                             | | ||||
| | `POSTFIXADMIN_DATABASE_HOST`        |                             | | ||||
| | `POSTFIXADMIN_DATABASE_PORT`        |                             | | ||||
| | `POSTFIXADMIN_DATABASE_NAME`        | `/var/tmp/postfixadmin.db`  | | ||||
| | `POSTFIXADMIN_DEFAULT_LANGUAGE`     | `en`                        | | ||||
| | `POSTFIXADMIN_DATABASE_USE_SSL`     |                             | | ||||
| | `POSTFIXADMIN_DATABASE_KEY`         |                             | | ||||
| | `POSTFIXADMIN_DATABASE_CERT`        |                             | | ||||
| | `POSTFIXADMIN_DATABASE_CA`          |                             | | ||||
| | `POSTFIXADMIN_DATABASE_PREFIX`      |                             | | ||||
| | `POSTFIXADMIN_ENCRYPT`              | `md5crypt`                  | | ||||
| | `POSTFIXADMIN_SMTP_SERVER`          | `localhost`                 | | ||||
| | `POSTFIXADMIN_SMTP_PORT`            | `25`                        | | ||||
|  | ||||
| ### POSTFIXADMIN_ADMIN_EMAIL | ||||
|  | ||||
| Define the email address of an admin via `POSTFIXADMIN_ADMIN_EMAIL` to send | ||||
| emails or broadcast messages in his name instead of the email address of the | ||||
| logged in admin, which wants to send an email or broadcast message about the | ||||
| PostfixAdmin interface. By default is the environment variable not defined. The | ||||
| value of the environment will be configured as the following config setting: | ||||
| `$CONF['admin_email']`. | ||||
|  | ||||
| ### POSTFIXADMIN_ADMIN_SMTP_PASSWORD | ||||
|  | ||||
| Define the smtp password via `POSTFIXADMIN_ADMIN_SMTP_PASSWORD` of the admin | ||||
| which should be used to send emails or broadcast messages about the PostfixAdmin | ||||
| interface. By default is the environment variable not defined. The value of the | ||||
| environment will be configured as the following config setting: | ||||
| `$CONF['admin_smtp_password']`. | ||||
|  | ||||
| ### POSTFIXADMIN_ADMIN_NAME | ||||
|  | ||||
| Define the name of the admin via `POSTFIXADMIN_ADMIN_NAME` which should be used | ||||
| to send emails or broadcast messages about the PostfixAdmin interface. By | ||||
| default is the environment variable not defined. The value of the environment | ||||
| will be configured as the following config setting: `$CONF['admin_name']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_TYPE | ||||
|  | ||||
| PostfixAdmin support currently sqlite, postgres and mysql/mariadb. About the | ||||
| envrionment variable `POSTFIXADMIN_DATABASE_TYPE` can the backend type defined. | ||||
| The default value is `sqlite`. | ||||
|  | ||||
| | database type | value     | | ||||
| | ------------- | --------- | | ||||
| | mysql/mariadb | `mysqli`  | | ||||
| | postgres      | `pgsql`   | | ||||
| | sqlite        | `sqlite`  | | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_USER | ||||
|  | ||||
| The environment variable `POSTFIXADMIN_DATABASE_USER` is undefined and only | ||||
| required if the database backend is not `sqlite`. The value of the environment | ||||
| will be configured as the following config setting: `$CONF['database_user']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_PASSWORD | ||||
|  | ||||
| The environment variable `POSTFIXADMIN_DATABASE_PASSWORD` is undefined and only | ||||
| required if the database backend is not `sqlite`. The value of the environment | ||||
| will be configured as the following config setting: `$CONF['database_password']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_HOST | ||||
|  | ||||
| The environment variable `POSTFIXADMIN_DATABASE_HOST` is undefined and only | ||||
| required if the database backend is not `sqlite`. The value of the environment | ||||
| will be configured as the following config setting: `$CONF['database_host']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_PORT | ||||
|  | ||||
| The environment variable `POSTFIXADMIN_DATABASE_PORT` will automatically defined | ||||
| with default values when instead of `sqlite` an other database backend has been | ||||
| selected. The value of the environment will be configured as the following | ||||
| config setting: `$CONF['database_port']`. | ||||
|  | ||||
| | database type   | default port  | | ||||
| | --------------- | ------------- | | ||||
| | mysqli/mariadb  | `3306`        | | ||||
| | postgres        | `5432`        | | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_NAME | ||||
|  | ||||
| The environment variable `POSTFIXADMIN_DATABASE_NAME` is defined by default with | ||||
| the value `/var/tmp/postfixadmin.db`. This is the path where the `sqlite` | ||||
| database is stored. If `pgsql` or `mysqli` is defined instead of `sqlite` as | ||||
| database backend type, can the environment variable used to define the database | ||||
| name. The value of the environment will be configured as the following config | ||||
| setting: `$CONF['database_name']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_USE_SSL | ||||
|  | ||||
| Encrypt a database connection to an external database like postgres, mariadb or | ||||
| mysqli via SSL when `POSTFIXADMIN_DATABASE_USE_SSL=true`. Additionally should be | ||||
| the other SSL environment variables defined to establish successfully a SSL | ||||
| encrypted connection. The value of the environment will be configured as the | ||||
| following config setting: `$CONF['database_use_ssl']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_SSL_KEY | ||||
|  | ||||
| Via `POSTFIXADMIN_DATABASE_SSL_KEY` can be the path to the private key defined | ||||
| which should be used to encrypt the database connection via SSL. By default is | ||||
| this environment variable undefined. The value of the environment will be | ||||
| configured as the following config setting: `$CONF['database_ssl_key']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_SSL_CERT | ||||
|  | ||||
| Via `POSTFIXADMIN_DATABASE_SSL_CERT` can be the path to the certificate defined | ||||
| which should be used to encrypt the database connection via SSL. By default is | ||||
| this environment variable undefined. The value of the environment will be | ||||
| configured as the following config setting: `$CONF['database_ssl_cert']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_SSL_CA | ||||
|  | ||||
| Via `POSTFIXADMIN_DATABASE_SSL_CA` can be the path to the root certificate of | ||||
| the certificate authority defined which should be trusted to encrypt the database | ||||
| connection via SSL. By default is this environment variable undefined. The value | ||||
| of the environment will be configured as the following config setting: | ||||
| `$CONF['database_ssl_ca']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DATABASE_PREFIX | ||||
|  | ||||
| It make much sense to use a prefix name for all PostfixAdmin related tables, | ||||
| when the tables, views and so on should be stored into a shared schema like | ||||
| `public`. About the environment variable `POSTFIXADMIN_DATABASE_PREFIX` can such | ||||
| a prefix defined. By default is this variable undefined, but when not it results | ||||
| in the config setting `$CONF['database_prefix']`. | ||||
|  | ||||
| ### POSTFIXADMIN_DEFAULT_LANGUAGE | ||||
|  | ||||
| Default language of PostfixAdmin. Checkout the [official | ||||
| repository](https://github.com/postfixadmin/postfixadmin/tree/master/languages) | ||||
| under `./languages` to get a list of all supported languages. | ||||
|  | ||||
| ### POSTFIXADMIN_ENCRYPT | ||||
|  | ||||
| Via `POSTFIXADMIN_ENCRYPT` can be the algorithm specified to encrypt passwords | ||||
| of users. The algorithm `md5crypt` is defined as default. Other possible values | ||||
| are documented | ||||
| [here](https://github.com/postfixadmin/postfixadmin/blob/master/DOCUMENTS/HASHING.md). | ||||
|  | ||||
| ### POSTFIXADMIN_SETUP_PASSWORD | ||||
|  | ||||
| To login into the `setup.php` page is the setup password required. This can be | ||||
| defined via the variable `POSTFIXADMIN_SETUP_PASSWORD`. The password will not be | ||||
| configured in the `config.local.php` as plain text. It will be encrypted. | ||||
							
								
								
									
										6
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| version: "3" | ||||
| services: | ||||
|   postfixadmin: | ||||
|     image: localhost/volkerraschek/postfixadmin:latest | ||||
|     ports: | ||||
|     - 0.0.0.0:8080:80/tcp | ||||
							
								
								
									
										72
									
								
								entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										72
									
								
								entrypoint.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,72 @@ | ||||
| #!/bin/bash | ||||
|  | ||||
| DOCUMENT_ROOT=$(dirname ${APACHE_DOCUMENT_ROOT}) | ||||
|  | ||||
| # set default database port if undefined | ||||
| case "${POSTFIXADMIN_DATABASE_TYPE}" in | ||||
|   sqlite) | ||||
|     ;; | ||||
|   mysqli) | ||||
|     : "${POSTFIXADMIN_DATABASE_PORT:=3306}" | ||||
|     ;; | ||||
|   pgsql) | ||||
|     : "${POSTFIXADMIN_DATABASE_PORT:=5432}" | ||||
|     : "${POSTFIXADMIN_DATABASE_NAME:=postgres}" | ||||
|   ;; | ||||
|   *) | ||||
|   echo >&2 "${POSTFIXADMIN_DATABASE_TYPE} is not a supported value." | ||||
|   exit 1 | ||||
|   ;; | ||||
| esac | ||||
|  | ||||
| # check if database user and password is defined and if database answer of an icmp ping | ||||
| if [ "${POSTFIXADMIN_DATABASE_TYPE}" != "sqlite" ]; then | ||||
|   if [ -z "${POSTFIXADMIN_DATABASE_USER}" -o -z "${POSTFIXADMIN_DATABASE_PASSWORD}" ]; then | ||||
|     echo >&2 'Error: POSTFIXADMIN_DATABASE_USER and POSTFIXADMIN_DATABASE_PASSWORD must be specified. ' | ||||
|     exit 1 | ||||
|   fi | ||||
|   timeout 15 bash -c "until echo > /dev/tcp/${POSTFIXADMIN_DATABASE_HOST}/${POSTFIXADMIN_DATABASE_PORT}; do sleep 0.5; done" | ||||
| fi | ||||
|  | ||||
| # create sqlite.db if sqlite is specified as backend | ||||
| if [ "${POSTFIXADMIN_DATABASE_TYPE}" = 'sqlite' ]; then | ||||
|   export POSTFIXADMIN_DATABASE_NAME=${POSTFIXADMIN_DATABASE_NAME:=/var/tmp/postfixadmin.db} | ||||
|  | ||||
|   if [ ! -f "${POSTFIXADMIN_DATABASE_NAME}" ]; then | ||||
|     echo "Create sqlite database: ${POSTFIXADMIN_DATABASE_NAME}" | ||||
|     touch ${POSTFIXADMIN_DATABASE_NAME} | ||||
|     chown www-data:www-data ${POSTFIXADMIN_DATABASE_NAME} | ||||
|     chmod 0700 ${POSTFIXADMIN_DATABASE_NAME} | ||||
|   fi | ||||
| fi | ||||
|  | ||||
|  | ||||
| # create config.local.pgp with vaules from env with POSTFIXADMIN_ prefix | ||||
| POSTFIXADMIN_ENV_VARS=($(env | sort | grep --perl-regexp '^POSTFIXADMIN_.*')) | ||||
|  | ||||
| cat > ${DOCUMENT_ROOT}/config.local.php <<EOF | ||||
| <?php | ||||
|   \$CONF['configured'] = true; | ||||
| EOF | ||||
|  | ||||
| for ENV_VAR in ${POSTFIXADMIN_ENV_VARS[@]}; do | ||||
|   KEY=$(echo ${ENV_VAR} | cut --delimiter="=" --fields="1" | sed 's/POSTFIXADMIN_//' | tr '[:upper:]' '[:lower:]') | ||||
|   VALUE=$(echo ${ENV_VAR} | cut --delimiter="=" --fields="2") | ||||
|  | ||||
|   echo "  \$CONF['${KEY}'] = '${VALUE}';" >> ${DOCUMENT_ROOT}/config.local.php | ||||
| done | ||||
|  | ||||
| cat >> ${DOCUMENT_ROOT}/config.local.php <<EOF | ||||
| ?> | ||||
| EOF | ||||
|  | ||||
| chown www-data: ${DOCUMENT_ROOT}/config.local.php | ||||
|  | ||||
| # start database migration | ||||
|  | ||||
| if [ -f public/upgrade.php ]; then | ||||
|   echo "Running database / environment upgrade.php " | ||||
|   gosu www-data php public/upgrade.php | ||||
| fi | ||||
|  | ||||
| exec "$@" | ||||
		Reference in New Issue
	
	Block a user