├── .dockerignore ├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── main.yml │ └── manual.yml ├── install ├── assets │ ├── cron │ │ └── osticket.txt │ ├── msmtp │ │ └── msmtp.conf │ └── setup │ │ └── install.php └── etc │ ├── nginx │ └── sites.available │ │ └── osticket.conf │ └── cont-init.d │ └── 30-osticket ├── LICENSE ├── examples └── docker-compose.yml ├── Dockerfile ├── CHANGELOG.md └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [tiredofit] 2 | -------------------------------------------------------------------------------- /install/assets/cron/osticket.txt: -------------------------------------------------------------------------------- 1 | */ * * * * TZ=${TIMEZONE} php -q ${NGINX_WEBROOT}/api/cron.php >/dev/null 2>&1 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: "build_image" 2 | 3 | on: 4 | push: 5 | paths: 6 | - "**" 7 | - "!README.md" 8 | 9 | jobs: 10 | build: 11 | uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main 12 | #uses: tiredofit/github_actions/.github/workflows/default_amd64.yml@main 13 | #uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main 14 | #uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main 15 | secrets: inherit 16 | -------------------------------------------------------------------------------- /.github/workflows/manual.yml: -------------------------------------------------------------------------------- 1 | name: "manual_build_image" 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | Manual Build: 7 | description: 'Manual Build' 8 | required: false 9 | 10 | jobs: 11 | build: 12 | uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main 13 | #uses: tiredofit/github_actions/.github/workflows/default_amd64.yml@main 14 | #uses: tiredofit/github_actions/.github/workflows/default_amd64_armv7_arm64.yml@main 15 | #uses: tiredofit/github_actions/.github/workflows/default_amd64_arm64.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /install/assets/msmtp/msmtp.conf: -------------------------------------------------------------------------------- 1 | # msmtp configuration template 2 | # 3 | # This is populated and saved as /etc/msmtp when image starts 4 | # 5 | 6 | # Default settings 7 | defaults 8 | logfile /var/log/msmtp.log 9 | 10 | # OSTicket account 11 | account osticket 12 | protocol smtp 13 | host %SMTP_HOSTNAME% 14 | tls %SMTP_TLS% 15 | tls_trust_file %SMTP_TLS_CERTS% 16 | port %SMTP_PORT% 17 | auth %SMTP_AUTH% 18 | user %SMTP_USER% 19 | password %SMTP_PASS% 20 | from %SMTP_FROM% 21 | 22 | # If you don't use the '-a' parameter in your command line, the default account will be used. 23 | account default: osticket 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Dave Conroy 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 | -------------------------------------------------------------------------------- /install/etc/nginx/sites.available/osticket.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen {{NGINX_LISTEN_PORT}}; 3 | root {{NGINX_WEBROOT}}; 4 | index index.php; 5 | 6 | charset utf-8; 7 | 8 | set $path_info ""; 9 | 10 | location ~ /include { 11 | deny all; 12 | return 403; 13 | } 14 | 15 | if ($request_uri ~ "^/api(/[^\?]+)") { 16 | set $path_info $1; 17 | } 18 | 19 | location /api { 20 | try_files $uri $uri/ /api/http.php?$query_string; 21 | } 22 | 23 | if ($request_uri ~ "^/scp/.*\.php(/[^\?]+)") { 24 | set $path_info $1; 25 | } 26 | 27 | location ~ ^/scp/ajax.php/.*$ { 28 | try_files $uri $uri/ /scp/ajax.php?$query_string; 29 | } 30 | 31 | if ($request_uri ~ "^/ajax.php(/[^\?]+)") { 32 | set $path_info $1; 33 | } 34 | 35 | location ~ ^/ajax.php/.*$ { 36 | try_files $uri $uri/ /ajax.php?$query_string; 37 | } 38 | 39 | location / { 40 | try_files $uri $uri/ index.php; 41 | } 42 | 43 | location ~ \.php$ { 44 | include /etc/nginx/snippets/php-fpm.conf; 45 | try_files $uri = 404; 46 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 47 | include fastcgi_params; 48 | fastcgi_index index.php; 49 | fastcgi_param LARA_ENV local; # Environment variable for Laravel 50 | fastcgi_param PATH_INFO $path_info; 51 | } 52 | 53 | ### Don't edit past here 54 | include /etc/nginx/snippets/site_optimization.conf; 55 | include /etc/nginx/snippets/exploit_protection.conf; 56 | } 57 | -------------------------------------------------------------------------------- /examples/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | 3 | osticket-app: 4 | image: tiredofit/osticket 5 | container_name: osticket-app 6 | labels: 7 | - traefik.enable=true 8 | - traefik.http.routers.osticket-app.rule=Host(`osticket.example.com`) 9 | - traefik.http.services.osticket-app.loadbalancer.server.port=80 10 | volumes: 11 | - ./data/:/www/osticket 12 | - ./logs/:/www/logs 13 | environment: 14 | - TIMEZONE=America/Vancouver 15 | - CONTAINER_NAME=osticket-app 16 | 17 | - CRON_INTERVAL=10 18 | 19 | - DB_HOST=osticket-db 20 | - DB_NAME=osticket 21 | - DB_USER=osticket 22 | - DB_PASS=password 23 | 24 | - SMTP_HOST=localhost 25 | - SMTP_PORT=25 26 | - SMTP_FROM=osticket@example.com 27 | - SMTP_TLS=0 28 | - SMTP_USER=osticket@example.com 29 | - SMTP_PASS=password 30 | 31 | - INSTALL_SECRET=somerandomlargecharacterstring 32 | - INSTALL_EMAIL=osticket@example.com 33 | - INSTALL_NAME=OSTicket Helpdesk 34 | 35 | - ADMIN_FIRSTNAME=Admin 36 | - ADMIN_LASTNAME=User 37 | - ADMIN_EMAIL=admin@example.com 38 | - ADMIN_USER=ostadmin 39 | - ADMIN_PASS=Password123 40 | networks: 41 | - proxy 42 | - services 43 | restart: always 44 | 45 | osticket-db: 46 | image: tiredofit/mariadb:10.11 47 | container_name: osticket-db 48 | volumes: 49 | - ./db:/var/lib/mysql 50 | environment: 51 | - TIMEZONE=America/Vancouver 52 | - CONTAINER_NAME=osticket-db 53 | 54 | - ROOT_PASS=securepassword 55 | - DB_NAME=osticket 56 | - DB_USER=osticket 57 | - DB_PASS=password 58 | networks: 59 | - services 60 | restart: always 61 | 62 | osticket-db-backup: 63 | container_name: osticket-db-backup 64 | image: tiredofit/db-backup:latest 65 | volumes: 66 | - ./dbbackup:/backup 67 | environment: 68 | - TIMEZONE=America/Vancouver 69 | - CONTAINER_NAME=osticket-db-backup 70 | - DB_HOST=osticket-db 71 | - DB_TYPE=mariadb 72 | - DB_NAME=osticket 73 | - DB_USER=osticket 74 | - DB_PASS=userpassword 75 | - DB_DUMP_FREQ=1440 76 | - DB_DUMP_BEGIN=0000 77 | - DB_CLEANUP_TIME=8640 78 | networks: 79 | - services 80 | restart: always 81 | 82 | networks: 83 | proxy: 84 | external: true 85 | services: 86 | external: true 87 | 88 | -------------------------------------------------------------------------------- /install/etc/cont-init.d/30-osticket: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | 3 | source /assets/functions/00-container 4 | prepare_service 5 | PROCESS_NAME="osticket" 6 | 7 | check_service_initialized init 20-php-fpm 8 | 9 | ### Sanity Test 10 | sanity_db 11 | sanity_var ADMIN_PASS "Admin Password" 12 | sanity_var ADMIN_EMAIL "Admin Email" 13 | sanity_var ADMIN_USER "Admin Username" 14 | 15 | if [ "$(echo "${ADMIN_USER}" | wc -c)" -le 5 ] ; then 16 | print_error "Admin user need to be 5 characters or greater. Exiting.." 17 | exit 5 18 | fi 19 | 20 | sanity_var INSTALL_SECRET "Install Secret" 21 | 22 | db_ready mariadb 23 | 24 | # Bugfix ~ 3.5.3 25 | if [ -n "${CRON_PERIOD}" ] ; then 26 | CRON_INTERVAL=${CRON_PERIOD} 27 | fi 28 | 29 | ### Adjust Runtime Variables 30 | sed -i "s##${CRON_INTERVAL}#g" /assets/cron/osticket.txt 31 | sed -i "s##${NGINX_WEBROOT}#g" /assets/setup/install.php 32 | 33 | ### Check to see if this is a new install, if yes copy information from assets create directories... 34 | if [ ! -f "${NGINX_WEBROOT}"/index.php ] ; then 35 | print_warn "New OSTicket Installation Detected." 36 | mkdir -p "${NGINX_WEBROOT}" 37 | cp -R /assets/install/* "${NGINX_WEBROOT}"/ 38 | chown -R "${NGINX_USER}":"${NGINX_GROUP}" "${NGINX_WEBROOT}"/ 39 | chmod -R a+rX "${NGINX_WEBROOT}" 40 | chmod -R u+rw "${NGINX_WEBROOT}" 41 | chown -R root:root "${NGINX_WEBROOT}"/setup_hidden 42 | chmod 700 "${NGINX_WEBROOT}"/setup_hidden 43 | fi 44 | 45 | # Automate installation 46 | php /assets/setup/install.php 47 | 48 | ## Check Memcache Settings 49 | if [ -n "${MEMCACHE_HOST}" ]; then 50 | print_notice "Setting Memcache" 51 | sed -i \ 52 | -e "s/# define('SESSION_BACKEND', 'memcache');/define('SESSION_BACKEND', 'memcache');/g" \ 53 | -e "s/# define('MEMCACHE_SERVERS', 'server1:11211,server2:11211');/define('MEMCACHE_SERVERS', '$MEMCACHE_HOST:$MEMCACHE_PORT');/g" \ 54 | "${NGINX_WEBROOT}"/include/ost-config.php 55 | fi 56 | 57 | ## Proxy Fix 58 | if [ -n "${VIRTUAL_HOST}" ]; then 59 | print_notice "Configuring Reverse Proxy settings" 60 | sed -i -e "s/define('TRUSTED_PROXIES', '');/define('TRUSTED_PROXIES', '*');/g" "${NGINX_WEBROOT}"/include/ost-config.php 61 | fi 62 | 63 | print_notice "Applying configuration file security" 64 | chmod 644 "${NGINX_WEBROOT}"/include/ost-config.php 65 | 66 | #if [ ${ADMIN_PASS:+1} ]; then 67 | # print_notice "Setting Administrative User Password" 68 | # mysqlcmd='mysql -u'$DB_USER' -h'$DB_HOST' -p'$DB_PASS' -P'$DB_PORT 69 | # $mysqlcmd -e "use "$DB_NAME"; UPDATE "$DB_PREFIX"staff SET passwd = MD5( '"$ADMIN_PASS"' ) WHERE username = '"$ADMIN_USER"';" 70 | #fi 71 | 72 | ### Force Reset Permissions for Security 73 | chown -R "${NGINX_USER}":"${NGINX_GROUP}" "${NGINX_WEBROOT}" 74 | chmod -R a+rX "${NGINX_WEBROOT}"/ 75 | chmod -R u+rw "${NGINX_WEBROOT}"/ 76 | chown -R root:root "${NGINX_WEBROOT}"/setup_hidden 77 | chmod 700 "${NGINX_WEBROOT}"/setup_hidden 78 | 79 | liftoff 80 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG DISTRO=debian 2 | ARG DISTRO_VARIANT=bullseye 3 | ARG PHP_VERSION=8.2 4 | 5 | FROM docker.io/tiredofit/nginx-php-fpm:${PHP_VERSION}-${DISTRO}-${DISTRO_VARIANT} 6 | LABEL maintainer="Dave Conroy (github.com/tiredofit)" 7 | 8 | ARG OSTICKET_VERSION 9 | ARG OSTICKET_PLUGINS_VERSION 10 | 11 | ENV OSTICKET_VERSION=${OSTICKET_VERSION:-"v1.18"} \ 12 | OSTICKET_PLUGINS_VERSION=${OSTICKET_PLUGINS_VERSION:-"develop"} \ 13 | OSTICKET_REPO_URL=${OSTICKET_REPO_URL:-"https://github.com/osticket/osticket"} \ 14 | OSTICKET_PLUGINS_REPO_URL=${OSTICKET_REPO_URL:-"https://github.com/osTicket/osTicket-plugins"} \ 15 | DB_PREFIX=ost_ \ 16 | DB_PORT=3306 \ 17 | CRON_INTERVAL=10 \ 18 | MEMCACHE_PORT=11211 \ 19 | PHP_ENABLE_CURL=TRUE \ 20 | PHP_ENABLE_FILEINFO=TRUE \ 21 | PHP_ENABLE_IMAP=TRUE \ 22 | PHP_ENABLE_LDAP=TRUE \ 23 | PHP_ENABLE_MYSQLI=TRUE \ 24 | PHP_ENABLE_OPENSSL=FALSE \ 25 | PHP_ENABLE_CREATE_SAMPLE_PHP=FALSE \ 26 | PHP_ENABLE_ZIP=TRUE \ 27 | NGINX_SITE_ENABLED=osticket \ 28 | NGINX_WEBROOT=/www/osticket \ 29 | ZABBIX_AGENT_TYPE=classic \ 30 | IMAGE_NAME="tiredofit/osticket" \ 31 | IMAGE_REPO_URL="https://github.com/tiredofit/docker-osticket/" 32 | 33 | ### Dependency Installation 34 | RUN source /assets/functions/00-container && \ 35 | set -x && \ 36 | package update && \ 37 | package upgrade && \ 38 | package install \ 39 | git \ 40 | libldap-common \ 41 | openssl \ 42 | php${PHP_VERSION}-memcached \ 43 | tar \ 44 | wget \ 45 | zlib1g \ 46 | && \ 47 | \ 48 | ### Download & Prepare OSTicket for Install 49 | clone_git_repo "${OSTICKET_REPO_URL}" "${OSTICKET_VERSION}" /assets/install && \ 50 | chown -R "${NGINX_USER}":"${NGINX_GROUP}" /assets/install && \ 51 | chmod -R a+rX /assets/install/ && \ 52 | chmod -R u+rw /assets/install/ && \ 53 | mv /assets/install/setup /assets/install/setup_hidden && \ 54 | chown -R root:root /assets/install/setup_hidden && \ 55 | chmod 700 /assets/install/setup_hidden && \ 56 | \ 57 | # Setup Official Plugins 58 | clone_git_repo "${OSTICKET_PLUGINS_REPO_URL}" "${OSTICKET_PLUGINS_VERSION}" /usr/src/plugins && \ 59 | php make.php hydrate && \ 60 | for plugin in $(find * -maxdepth 0 -type d ! -path doc ! -path lib); do cp -r ${plugin} /assets/install/include/plugins; done; \ 61 | cp -R /usr/src/plugins/*.phar /assets/install/include/plugins/ && \ 62 | cd / && \ 63 | \ 64 | # Add Community Plugins 65 | ## Archiver 66 | clone_git_repo https://github.com/clonemeagain/osticket-plugin-archiver master /assets/install/include/plugins/archiver && \ 67 | ## Attachment Preview 68 | clone_git_repo https://github.com/clonemeagain/attachment_preview master /assets/install/include/plugins/attachment-preview && \ 69 | ## Auto Closer 70 | clone_git_repo https://github.com/clonemeagain/plugin-autocloser master /assets/install/include/plugins/auto-closer && \ 71 | ## Fetch Note 72 | clone_git_repo https://github.com/bkonetzny/osticket-fetch-note master /assets/install/include/plugins/fetch-note && \ 73 | ## Field Radio Buttons 74 | clone_git_repo https://github.com/Micke1101/OSTicket-plugin-field-radiobuttons master /assets/install/include/plugins/field-radiobuttons && \ 75 | ## Mentioner 76 | clone_git_repo https://github.com/clonemeagain/osticket-plugin-mentioner master /assets/install/include/plugins/mentioner && \ 77 | ## Multi LDAP Auth 78 | clone_git_repo https://github.com/philbertphotos/osticket-multildap-auth master /assets/install/include/plugins/multi-ldap && \ 79 | mv /assets/install/include/plugins/multi-ldap/multi-ldap/* /assets/install/include/plugins/multi-ldap/ && \ 80 | rm -rf /assets/install/include/plugins/multi-ldap/multi-ldap && \ 81 | ## Prevent Autoscroll 82 | clone_git_repo https://github.com/clonemeagain/osticket-plugin-preventautoscroll master /assets/install/include/plugins/prevent-autoscroll && \ 83 | ## Rewriter 84 | clone_git_repo https://github.com/clonemeagain/plugin-fwd-rewriter master /assets/install/include/plugins/rewriter && \ 85 | ## Slack 86 | clone_git_repo https://github.com/clonemeagain/osticket-slack master /assets/install/include/plugins/slack && \ 87 | ## Teams (Microsoft) 88 | clone_git_repo https://github.com/ipavlovi/osTicket-Microsoft-Teams-plugin master /assets/install/include/plugins/teams && \ 89 | \ 90 | ### Log Miscellany Installation 91 | touch /var/log/msmtp.log && \ 92 | chown "${NGINX_USER}":"${NGINX_GROUP}" /var/log/msmtp.log && \ 93 | \ 94 | ## Cleanup 95 | package cleanup && \ 96 | rm -rf \ 97 | /root/.composer \ 98 | /tmp/* \ 99 | /usr/src/* 100 | 101 | COPY install / 102 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 3.6.2 2023-07-30 2 | 3 | ### Changed 4 | - Resolve issues with nginx configuration 5 | 6 | 7 | ## 3.6.1 2023-07-29 8 | 9 | ### Changed 10 | - Fix spelling mistake in Dockerfile when enabling Zip extension 11 | 12 | 13 | ## 3.6.0 2023-07-28 14 | 15 | ### Added 16 | - PHP 8.2 base 17 | 18 | ### Changed 19 | - Fix upstream issue with mysql command not being found due to changes in MariaDB client library 20 | - Rework writing cron scheduler 21 | 22 | 23 | ## 3.5.7 2023-07-27 24 | 25 | ### Added 26 | - OS Ticket 1.18 27 | 28 | 29 | ## 3.5.6 2023-07-27 30 | 31 | ### Added 32 | - Os Ticket 1.17.4 33 | 34 | 35 | ## 3.5.5 2023-06-05 36 | 37 | ### Changed 38 | - Fix for Admin name size check 39 | - Show errors on installation 40 | 41 | 42 | ## 3.5.4 2023-05-27 43 | 44 | ### Changed 45 | - Fix for unterminated sed command 46 | 47 | 48 | ## 3.5.3 2023-04-14 49 | 50 | ### Changed 51 | - Revert 3.5.2 and start doing 5 character checks on ADMIN_USER 52 | - Fix a problem with CRON_INTERVAL not being used 53 | 54 | 55 | ## 3.5.2 2023-04-14 56 | 57 | ### Added 58 | - Add check for ADMIN_PASS size. Fail if <5 characters 59 | 60 | 61 | ## 3.5.1 2023-04-06 62 | 63 | ### Added 64 | - Switch to PHP 8.1 65 | 66 | 67 | ## 3.5.0 2023-03-17 68 | 69 | ### Added 70 | - Modernize Image 71 | - OsTicket 1.17.3 72 | 73 | 74 | ## 3.4.1 2022-06-23 75 | 76 | ### Added 77 | - Support tiredofit/nginx:6.0.0 and tiredofit/nginx-php-fpm:7.0.0 changes 78 | 79 | 80 | ## 3.4.0 2021-11-23 81 | 82 | ### Added 83 | - OSTIcket 1.15.4 84 | - Debian Bullseye base 85 | 86 | 87 | ## 3.3.3 2021-09-06 88 | 89 | ### Fixed 90 | - Fix spelling mistake in Dockerfile for archiver plugin 91 | 92 | ## 3.3.2 2021-08-11 93 | 94 | ### Fixed 95 | - Clean NGINX_WEBROOT extra /www/ prefix from crontab 96 | 97 | ## 3.3.1 2021-08-11 98 | 99 | ### Changed 100 | - Cleanup composer cache 101 | - Cleanup Debian package cache to reduce image size 102 | 103 | 104 | ## 3.3.0 2021-08-11 105 | 106 | ### Added 107 | - Switch from Alpine to Debian base due to musl not supporting some functions OSTicket requires 108 | - Upgrade OSTicket to 1.15.3 109 | - PHP 7.4 110 | 111 | 112 | ## 3.2.1 2021-02-16 113 | 114 | ### Fixed 115 | - Removed erroneous argument in cron job 116 | 117 | 118 | ## 3.2.0 2020-06-15 119 | 120 | ### Added 121 | - Update to support tiredofit/alpine 5.x.x base images 122 | 123 | 124 | ## 3.1.2 2020-01-02 125 | 126 | ### Changed 127 | - Switch to php7-pecl-memcached 128 | 129 | 130 | ## 3.1.1 2020-01-02 131 | 132 | ### Changed 133 | - Additional Changes to support new tiredofit/alpine base image 134 | 135 | 136 | ## 3.1.0 2019-12-29 137 | 138 | ### Added 139 | - Support new tiredofit/nginx and tireofit/alpine base images 140 | 141 | 142 | ## 3.0.2 2019-12-17 143 | 144 | ### Added 145 | - OSTicket 1.14.1 146 | - Refactored to support new tiredofit/nginx-php-fpm base image 147 | 148 | 149 | ## 3.0.1 2019-11-12 150 | 151 | * OSTicket 1.14-rc2 152 | 153 | ## 3.0 2019-09-12 154 | 155 | * Modernize Image 156 | * Added many plugins 157 | * OSTicket 1.14rc1 158 | * PHP 7.3 159 | * Alpine 3.10 160 | 161 | ## 2.8 2018-02-01 162 | 163 | * Pull sources from Github instead of mainwebsite 164 | * Compile auth-ldap plugin 165 | 166 | ## 2.7 2018-02-01 167 | 168 | * Rebase 169 | 170 | ## 2.6 2017-10-05 171 | 172 | * Fix Broken Detection of new install 173 | 174 | ## 2.5 2017-08-29 175 | 176 | * Image Cleanup 177 | 178 | ## 2.4 2017-07-06 179 | 180 | * Added PHP_TIMEOUT 181 | 182 | ## 2.3 2017-07-03 183 | 184 | * Added PHP7-IMAP 185 | 186 | ## 2.2 2017-07-02 187 | 188 | * Build PHP7 Memcached Extension 189 | 190 | ## 2.1 2017-07-02 191 | 192 | * Sanity Checks in init scripts 193 | 194 | ## 2017-06-17 2.0 195 | 196 | * Rebase with nginx-php-fpm:7.0 with s6 197 | 198 | ## 2017-05-27 1.0 199 | 200 | * Production Stable 201 | * Memcached Capable for Sessions 202 | * Reset Admin Password if ENV Set upon Bootup 203 | 204 | 205 | ## 2017-05-27 0.9 206 | 207 | * Initial Release 208 | * OSTicket 1.10 209 | * Alpine:3.5 210 | * PHP7 211 | * Zabbix 212 | 213 | -------------------------------------------------------------------------------- /install/assets/setup/install.php: -------------------------------------------------------------------------------- 1 | getenv("INSTALL_NAME") ?: 'My Helpdesk', 8 | 'email' => getenv("INSTALL_EMAIL") ?: 'helpdesk@example.com', 9 | 'url' => getenv("INSTALL_URL") ?: 'http://localhost', 10 | 'fname' => getenv("ADMIN_FIRSTNAME"), 11 | 'lname' => getenv("ADMIN_LASTNAME"), 12 | 'admin_email' => getenv("ADMIN_EMAIL"), 13 | 'username' => getenv("ADMIN_USER"), 14 | 'passwd' => getenv("ADMIN_PASS"), 15 | 'passwd2' => getenv("ADMIN_PASS"), 16 | 'prefix' => getenv("DB_PREFIX") ?: 'ost_', 17 | 'dbhost' => getenv("DB_HOST"), 18 | 'dbname' => getenv("DB_NAME"), 19 | 'dbuser' => getenv("DB_USER"), 20 | 'dbport' => getenv("DB_PORT") ?: '3306', 21 | 'dbpass' => getenv("DB_PASS") ?: getenv("DB_PASS"), 22 | 'smtp_host' => getenv("SMTP_HOST") ?: 'postfix-relay', 23 | 'smtp_port' => getenv("SMTP_PORT") ?: 25, 24 | 'smtp_from' => getenv("SMTP_FROM"), 25 | 'smtp_tls' => getenv("SMTP_TLS"), 26 | 'smtp_tls_certs' => getenv("SMTP_TLS_CERTS") ?: '/etc/ssl/certs/ca-certificates.crt', 27 | 'smtp_user' => getenv("SMTP_USER"), 28 | 'smtp_pass' => getenv("SMTP_PASSWORD"), 29 | 'cron_interval' => getenv("CRON_INTERVAL") ?: 5, 30 | 'siri' => getenv("INSTALL_SECRET"), 31 | 'config' => getenv("INSTALL_CONFIG") ?: '/include/ost-sampleconfig.php' 32 | ); 33 | 34 | //Script settings 35 | define('CONNECTION_TIMEOUT_SEC', 180); 36 | function err( $msg) { 37 | fwrite(STDERR, "$msg\n"); 38 | exit(1); 39 | } 40 | function boolToOnOff($v) { 41 | return ((boolean) $v) ? 'on' : 'off'; 42 | } 43 | function convertStrToBool($varName, $default) { 44 | global $vars; 45 | if ($vars[$varName] != '') { 46 | return $vars[$varName] == '1'; 47 | } 48 | return $default; 49 | } 50 | 51 | // Override Helpdesk URL. Only applied during database installation. 52 | define("URL",$vars['url']); 53 | 54 | //Require files (must be done before any output to avoid session start warnings) 55 | chdir("/setup_hidden"); 56 | require "/setup_hidden/setup.inc.php"; 57 | require_once INC_DIR.'class.installer.php'; 58 | 59 | 60 | /************************* Mail Configuration *******************************************/ 61 | define('MAIL_CONFIG_FILE','/etc/msmtp'); 62 | 63 | echo "** [osticket] Configuring mail settings\n"; 64 | if (!$mailConfig = file_get_contents('/assets/msmtp/msmtp.conf')) { 65 | err("** [osticket] Failed to load mail configuration file"); 66 | }; 67 | $mailConfig = str_replace('%SMTP_HOSTNAME%', $vars['smtp_host'], $mailConfig); 68 | $mailConfig = str_replace('%SMTP_PORT%', $vars['smtp_port'], $mailConfig); 69 | $v = !empty($vars['smtp_from']) ? $vars['smtp_from'] : $vars['smtp_user']; 70 | $mailConfig = str_replace('%SMTP_FROM%', $v, $mailConfig); 71 | $mailConfig = str_replace('%SMTP_USER%', $vars['smtp_user'], $mailConfig); 72 | $mailConfig = str_replace('%SMTP_PASS%', $vars['smtp_pass'], $mailConfig); 73 | $mailConfig = str_replace('%SMTP_TLS_CERTS%', $vars['smtp_tls_certs'], $mailConfig); 74 | 75 | $mailConfig = str_replace('%SMTP_TLS%', boolToOnOff(convertStrToBool('smtp_tls',true)), 76 | $mailConfig); 77 | $mailConfig = str_replace('%SMTP_AUTH%', boolToOnOff($vars['smtp_user'] != ''), $mailConfig); 78 | 79 | if (!file_put_contents(MAIL_CONFIG_FILE, $mailConfig) || !chown(MAIL_CONFIG_FILE,'nginx') 80 | || !chgrp(MAIL_CONFIG_FILE,'www-data') || !chmod(MAIL_CONFIG_FILE,0600)) { 81 | err("Failed to write mail configuration file"); 82 | } 83 | 84 | 85 | /************************* OSTicket Installation *******************************************/ 86 | 87 | //Create installer class 88 | define('OSTICKET_CONFIGFILE','/include/ost-config.php'); 89 | $installer = new Installer(OSTICKET_CONFIGFILE); //Installer instance. 90 | 91 | 92 | // Always set mysqli.default_port for osTicket db_connect 93 | ini_set('mysqli.default_port', $vars['dbport']); 94 | 95 | //Check database installation status 96 | $db_installed = false; 97 | echo "** [osticket] DB - Connecting to database mysql://${vars['dbuser']}@${vars['dbhost']}/${vars['dbname']}\n"; 98 | if (!db_connect($vars['dbhost'],$vars['dbuser'],$vars['dbpass'])) 99 | err(sprintf(__('** [osticket] Unable to connect to MySQL server: %s'), db_connect_error())); 100 | elseif(explode('.', db_version()) < explode('.', $installer->getMySQLVersion())) 101 | err(sprintf(__('** [osticket] osTicket requires MySQL %s or later!'),$installer->getMySQLVersion())); 102 | elseif(!db_select_database($vars['dbname']) && !db_create_database($vars['dbname'])) { 103 | err("** [osticket] Database doesn't exist"); 104 | } elseif(!db_select_database($vars['dbname'])) { 105 | err('** [osticket] Unable to select the database'); 106 | } else { 107 | $sql = 'SELECT * FROM `'.$vars['prefix'].'config` LIMIT 1'; 108 | if(db_query($sql, false)) { 109 | $db_installed = true; 110 | echo "** [osticket] Database already installed\n"; 111 | } 112 | } 113 | 114 | //Create secret if not set by env var and not previously stored 115 | DEFINE('SECRET_FILE','/secret.txt'); 116 | if (!$vars['siri']) { 117 | if (file_exists(SECRET_FILE)) { 118 | echo "** [osticket] DB - Loading installation secret\n"; 119 | $vars['siri'] = file_get_contents(SECRET_FILE); 120 | } else { 121 | echo "** [osticket] DB - Generating new installation secret and saving\n"; 122 | //Note that this randomly generated value is not intended to secure production sites! 123 | $vars['siri'] = 124 | substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_="), 0, 64); 125 | file_put_contents(SECRET_FILE, $vars['siri']); 126 | } 127 | } else { 128 | echo "** [osticket] DB - Using installation secret from INSTALL_SECRET environmental variable\n"; 129 | } 130 | 131 | //Always rewrite config file in case MySQL details changed (e.g. ip address) 132 | echo "** [osticket] DB - Updating configuration file\n"; 133 | if (!$configFile = file_get_contents($vars['config'])) { 134 | err("** [osticket] DB - Failed to load configuration file: {$vars['config']}"); 135 | }; 136 | $configFile= 137 | str_replace("define('OSTINSTALLED',FALSE);","define('OSTINSTALLED',TRUE);",$configFile); 138 | $configFile= str_replace('%ADMIN-EMAIL',$vars['admin_email'],$configFile); 139 | $configFile= str_replace('%CONFIG-DBHOST',$vars['dbhost'],$configFile); 140 | $configFile= str_replace('%CONFIG-DBNAME',$vars['dbname'],$configFile); 141 | $configFile= str_replace('%CONFIG-DBUSER',$vars['dbuser'],$configFile); 142 | $configFile= str_replace('%CONFIG-DBPASS',$vars['dbpass'],$configFile); 143 | $configFile= str_replace('%CONFIG-PREFIX',$vars['prefix'],$configFile); 144 | $configFile= str_replace('%CONFIG-SIRI',$vars['siri'],$configFile); 145 | 146 | if (!file_put_contents($installer->getConfigFile(), $configFile)) { 147 | err("** [osticket] DB - Failed to write configuration file"); 148 | } 149 | 150 | //Perform database installation if required 151 | if (!$db_installed) { 152 | echo "** [osticket] DB - Installing database. Please wait...\n"; 153 | if (!$installer->install($vars)) { 154 | $errors=$installer->getErrors(); 155 | echo "** [osticket] DB - Database installation failed. Errors:\n"; 156 | foreach($errors as $e) { 157 | echo " $e\n"; 158 | } 159 | exit(1); 160 | } else { 161 | echo "** [osticket] DB - Database installation successful\n"; 162 | } 163 | } 164 | 165 | ?> 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github.com/tiredofit/docker-osticket 2 | 3 | [![GitHub release](https://img.shields.io/github/v/tag/tiredofit/docker-osticket?style=flat-square)](https://github.com/tiredofit/docker-osticket/releases/latest) 4 | [![Build Status](https://img.shields.io/github/actions/workflow/status/tiredofit/docker-osticketmain.yml?branch=main&style=flat-square)](https://github.com/tiredofit/docker-osticket.git/actions) 5 | [![Docker Stars](https://img.shields.io/docker/stars/tiredofit/osticket.svg?style=flat-square&logo=docker)](https://hub.docker.com/r/tiredofit/osticket/) 6 | [![Docker Pulls](https://img.shields.io/docker/pulls/tiredofit/osticket.svg?style=flat-square&logo=docker)](https://hub.docker.com/r/tiredofit/osticket/) 7 | [![Become a sponsor](https://img.shields.io/badge/sponsor-tiredofit-181717.svg?logo=github&style=flat-square)](https://github.com/sponsors/tiredofit) 8 | [![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/tiredofit) 9 | 10 | * * * 11 | ## About 12 | 13 | This will build a Docker Image for [OSTicket](https://www.osticket.com) - An open source helpdesk / ticketing system. 14 | 15 | * Automatically installs and sets up installation upon first start 16 | 17 | ## Maintainer 18 | 19 | - [Dave Conroy](https://github.com/tiredofit) 20 | 21 | ## Table of Contents 22 | 23 | 24 | - [About](#about) 25 | - [Maintainer](#maintainer) 26 | - [Table of Contents](#table-of-contents) 27 | - [Prerequisites and Assumptions](#prerequisites-and-assumptions) 28 | - [Installation](#installation) 29 | - [Build from Source](#build-from-source) 30 | - [Prebuilt Images](#prebuilt-images) 31 | - [Configuration](#configuration) 32 | - [Quick Start](#quick-start) 33 | - [Persistent Storage](#persistent-storage) 34 | - [Environment Variables](#environment-variables) 35 | - [Base Images used](#base-images-used) 36 | - [Networking](#networking) 37 | - [Maintenance](#maintenance) 38 | - [Shell Access](#shell-access) 39 | - [Support](#support) 40 | - [Usage](#usage) 41 | - [Bugfixes](#bugfixes) 42 | - [Feature Requests](#feature-requests) 43 | - [Updates](#updates) 44 | - [License](#license) 45 | - [References](#references) 46 | 47 | ## Prerequisites and Assumptions 48 | * Assumes you are using some sort of SSL terminating reverse proxy such as: 49 | * [Traefik](https://github.com/tiredofit/docker-traefik) 50 | * [Nginx](https://github.com/jc21/nginx-proxy-manager) 51 | * [Caddy](https://github.com/caddyserver/caddy) 52 | * Requires access to a MySQL/MariaDB Server 53 | 54 | ## Installation 55 | 56 | ### Build from Source 57 | Clone this repository and build the image with `docker build -t (imagename) .` 58 | 59 | ### Prebuilt Images 60 | Builds of the image are available on [Docker Hub](https://hub.docker.com/r/tiredofit/osticket) 61 | 62 | ```bash 63 | docker pull docker.io/tiredofit/osticket:(imagetag) 64 | ``` 65 | 66 | Builds of the image are also available on the [Github Container Registry](https://github.com/tiredofit/docker-osticket/pkgs/container/docker-osticket) 67 | 68 | ``` 69 | docker pull ghcr.io/tiredofit/docker-osticket:(imagetag) 70 | ``` 71 | 72 | The following image tags are available along with their tagged release based on what's written in the [Changelog](CHANGELOG.md): 73 | 74 | | Container OS | Tag | 75 | | ------------ | --------- | 76 | | Debian | `:latest` | 77 | 78 | ## Configuration 79 | 80 | ### Quick Start 81 | 82 | - The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [docker-compose.yml](examples/docker-compose.yml) that can be modified for development or production use. 83 | 84 | - Set various [environment variables](#environment-variables) to understand the capabilities of this image. 85 | - Map [persistent storage](#data-volumes) for access to configuration and data files for backup. 86 | - Make [networking ports](#networking) available for public access if necessary 87 | 88 | **The first boot can take from 2 minutes - 5 minutes depending on your CPU to setup the proper schemas.** 89 | 90 | - Login to the web server and enter in your admin email address, admin password and start configuring the system! 91 | 92 | ### Persistent Storage 93 | The following directories are used for configuration and can be mapped for persistent storage. 94 | 95 | | Directory | Description | 96 | | --------------- | ------------------------------------------------------------------------------------------- | 97 | | `/www/osticket` | (Not needed as we want to keep base clean, move to a custom/assets approach) Root Directory | 98 | | `/www/logs` | Nginx and php-fpm logfiles | 99 | 100 | ### Environment Variables 101 | 102 | #### Base Images used 103 | 104 | This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) or [Debian Linux](https://hub.docker.com/r/tiredofit/debian) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handlded via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.com). Additional tools include: `bash`,`curl`,`less`,`logrotate`,`nano`. 105 | 106 | Be sure to view the following repositories to understand all the customizable options: 107 | 108 | | Image | Description | 109 | | ------------------------------------------------------------- | -------------------------------------- | 110 | | [OS Base](https://github.com/tiredofit/docker-debian/) | Customized Image based on Debian Linux | 111 | | [Nginx](https://github.com/tiredofit/docker-nginx/) | Nginx webserver | 112 | | [PHP-FPM](https://github.com/tiredofit/docker-nginx-php-fpm/) | PHP Interpreter | 113 | 114 | 115 | | Parameter | Description | default | 116 | | ----------------- | --------------------------------------------------------------------------- | ----------------------- | 117 | | `INSTALL_SECRET` | A Large and Random Installation String (Auto Generates on Install if empty) | | 118 | | `INSTALL_EMAIL` | Installer Email (Use different email then ADMIN_EMAIL) | `helpdesk@example.com` | 119 | | `INSTALL_NAME` | Site Name | `My Helpdesk` | 120 | | `ADMIN_FIRSTNAME` | First name of Admin User | | 121 | | `ADMIN_LASTNAME` | Last name of Admin User | | 122 | | `ADMIN_EMAIL` | Admin Email address (Make sure it is different than INSTALL_EMAIL) | | 123 | | `ADMIN_USER` | Admin Username *Must be more than 5 characters* | | 124 | | `ADMIN_PASS` | Admin Password | | 125 | | `CRON_INTERVAL` | Amount of time in Minutes to Check Incoming Mail | `10` | 126 | | `DB_HOST` | Host or container name of MariaDB Server e.g. `osticket-db` | | 127 | | `DB_PORT` | MariaDB Port | `3306` | 128 | | `DB_NAME` | MariaDB Database name e.g. `osticket` | | 129 | | `DB_USER` | MariaDB Username for above Database e.g. `osticket` | | 130 | | `DB_PASS` | MariaDB Password for above Database e.g. `password` | | 131 | | `DB_PREFIX` | Prefix for Tables | `ost_` | 132 | | `SMTP_HOST` | SMTP Host | `postfix` | 133 | | `SMTP_PORT` | SMTP Host Port | `25` | 134 | | `SMTP_FROM` | SMTP From Address | `osticket@hostname.com` | 135 | | `SMTP_TLS` | Should TLS be used (`0`=no `1`=yes) | `1` | 136 | | `SMTP_USER` | SMTP Authentication user | | 137 | | `SMTP_PASS` | SMTP Authentication password | | 138 | 139 | ### Networking 140 | 141 | The following ports are exposed. 142 | 143 | | Port | Description | 144 | | ---- | ----------- | 145 | | `80` | HTTP | 146 | 147 | * * * 148 | ## Maintenance 149 | 150 | ### Shell Access 151 | 152 | For debugging and maintenance purposes you may want access the containers shell. 153 | 154 | ``bash 155 | docker exec -it (whatever your container name is) bash 156 | `` 157 | ## Support 158 | 159 | These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community. 160 | ### Usage 161 | - The [Discussions board](../../discussions) is a great place for working with the community on tips and tricks of using this image. 162 | - Consider [sponsoring me](https://github.com/sponsors/tiredofit) for personalized support 163 | ### Bugfixes 164 | - Please, submit a [Bug Report](issues/new) if something isn't working as expected. I'll do my best to issue a fix in short order. 165 | 166 | ### Feature Requests 167 | - Feel free to submit a feature request, however there is no guarantee that it will be added, or at what timeline. 168 | - Consider [sponsoring me](https://github.com/sponsors/tiredofit) regarding development of features. 169 | 170 | ### Updates 171 | - Best effort to track upstream changes, More priority if I am actively using the image in a production environment. 172 | - Consider [sponsoring me](https://github.com/sponsors/tiredofit) for up to date releases. 173 | 174 | ## License 175 | MIT. See [LICENSE](LICENSE) for more details. 176 | 177 | ## References 178 | 179 | * https://osticket.com 180 | 181 | --------------------------------------------------------------------------------