├── supervisord ├── mysqld.conf ├── php-fpm.conf └── nginx.conf ├── nginx └── akaunting ├── run ├── akaunting-dev.sh └── akaunting.sh ├── Dockerfile ├── README.md └── entrypoint.sh /supervisord/mysqld.conf: -------------------------------------------------------------------------------- 1 | [program:mysqld] 2 | command=/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/mysqld/mysqld.pid 3 | autostart=true 4 | autorestart=true 5 | user=mysql 6 | 7 | stdout_logfile=/var/log/supervisor/%(program_name)s.log 8 | redirect_stderr=true 9 | -------------------------------------------------------------------------------- /supervisord/php-fpm.conf: -------------------------------------------------------------------------------- 1 | [program:php-fpm] 2 | command=/usr/sbin/php-fpm7.0 -F 3 | autostart=true 4 | autorestart=true 5 | 6 | ; php-fpm master process already changes to user www-data 7 | ; user=www-data 8 | 9 | stdout_logfile=/var/log/supervisor/%(program_name)s.log 10 | redirect_stderr=true 11 | -------------------------------------------------------------------------------- /supervisord/nginx.conf: -------------------------------------------------------------------------------- 1 | [program:nginx] 2 | command=/usr/sbin/nginx -g "daemon off;" 3 | autostart=false 4 | autorestart=true 5 | 6 | ; nginx master process already changes workers to user www-data 7 | ; user=www-data 8 | 9 | stdout_logfile=/var/log/supervisor/%(program_name)s.log 10 | redirect_stderr=true 11 | -------------------------------------------------------------------------------- /nginx/akaunting: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080 default_server; 3 | listen [::]:8080 default_server; 4 | 5 | server_name _; 6 | root /var/www/akaunting/root; 7 | 8 | # Static files 9 | location ~ ^/(public|modules|vendor)/(.*\.(ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg))$ { 10 | alias /var/www/akaunting/$1/$2; 11 | } 12 | 13 | # Front controller 14 | location / { 15 | include fastcgi_params; 16 | fastcgi_param SCRIPT_FILENAME /var/www/akaunting/index.php; 17 | fastcgi_pass unix:/run/php/php7.0-fpm.sock; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /run/akaunting-dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | sudo mkdir -p /srv/akaunting/mysql 7 | sudo mkdir -p /srv/akaunting/logs 8 | sudo mkdir -p /srv/akaunting/config 9 | 10 | docker stop akaunting || true 11 | docker rm akaunting || true 12 | 13 | docker run --interactive --tty \ 14 | --hostname akaunting \ 15 | --name akaunting \ 16 | --volume /srv/akaunting/mysql:/var/lib/mysql \ 17 | --volume /srv/akaunting/logs:/var/log \ 18 | --volume /srv/akaunting/config:/var/www/akaunting/config \ 19 | --publish 8080:8080 \ 20 | --env MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \ 21 | --env TZ=America/Costa_Rica \ 22 | --volume /etc/timezone:/etc/timezone:ro \ 23 | --volume /etc/localtime:/etc/localtime:ro \ 24 | kuralabs/docker-akaunting:latest bash 25 | -------------------------------------------------------------------------------- /run/akaunting.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | # Create mount points 7 | sudo mkdir -p /srv/akaunting/mysql 8 | sudo mkdir -p /srv/akaunting/logs 9 | sudo mkdir -p /srv/akaunting/config 10 | 11 | # Stop the running container 12 | docker stop akaunting || true 13 | 14 | # Remove existing container 15 | docker rm akaunting || true 16 | 17 | # Pull the new image 18 | docker pull kuralabs/docker-akaunting:latest 19 | 20 | # Run the container 21 | docker run --detach --init \ 22 | --hostname akaunting \ 23 | --name akaunting \ 24 | --restart always \ 25 | --publish 8080:8080 \ 26 | --volume /srv/akaunting/mysql:/var/lib/mysql \ 27 | --volume /srv/akaunting/logs:/var/log \ 28 | --volume /srv/akaunting/config:/var/www/akaunting/config \ 29 | --env MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD}" \ 30 | --env TZ=America/Costa_Rica \ 31 | --volume /etc/timezone:/etc/timezone:ro \ 32 | --volume /etc/localtime:/etc/localtime:ro \ 33 | kuralabs/docker-akaunting:latest 34 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | LABEL mantainer="info@kuralabs.io" 3 | 4 | 5 | # Setup and install base system software 6 | USER root 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | RUN echo "locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8" | debconf-set-selections \ 10 | && echo "locales locales/default_environment_locale select en_US.UTF-8" | debconf-set-selections \ 11 | && apt-get update \ 12 | && apt-get --yes --no-install-recommends install \ 13 | locales tzdata sudo \ 14 | ca-certificates apt-transport-https software-properties-common \ 15 | bash-completion iproute2 curl unzip nano tree \ 16 | && rm -rf /var/lib/apt/lists/* 17 | ENV LANG en_US.UTF-8 18 | 19 | 20 | # Install supervisord 21 | RUN apt-get update \ 22 | && apt-get --yes --no-install-recommends install \ 23 | supervisor dirmngr \ 24 | && rm -rf /var/lib/apt/lists/* 25 | 26 | 27 | # Install MySQL 28 | ENV MYSQL_DEFAULT_PASSWORD uYqBu/41C4Iog4vq9eShKg== 29 | 30 | RUN echo "mysql-server-5.7 mysql-server/root_password_again password ${MYSQL_DEFAULT_PASSWORD}" | debconf-set-selections \ 31 | && echo "mysql-server-5.7 mysql-server/root_password password ${MYSQL_DEFAULT_PASSWORD}" | debconf-set-selections \ 32 | && apt-get update && apt-get install --yes \ 33 | mysql-server-5.7 \ 34 | && rm -rf /var/lib/apt/lists/* \ 35 | && mkdir -p /var/lib/mysql /var/run/mysqld /var/mysqld/ \ 36 | && chown mysql:mysql /var/lib/mysql /var/run/mysqld /var/mysqld/ 37 | 38 | 39 | # Install NGINX and PHP 40 | RUN apt-get update \ 41 | && apt-get install --yes --no-install-recommends \ 42 | nginx \ 43 | php7.0-fpm \ 44 | php7.0-mbstring php7.0-xml php7.0-curl php7.0-zip php7.0-gd php7.0-mysql \ 45 | composer \ 46 | && rm -rf /var/lib/apt/lists/* \ 47 | && rm /etc/nginx/sites-enabled/default \ 48 | && sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.0/fpm/php.ini \ 49 | && mkdir /run/php 50 | 51 | 52 | # Install Akaunting 53 | ENV AKAUNTING_VERSION 1.1.13 54 | 55 | WORKDIR /tmp/ 56 | RUN mkdir -p /var/www/akaunting/root \ 57 | && curl \ 58 | --location \ 59 | -o akaunting.zip \ 60 | https://github.com/akaunting/akaunting/archive/${AKAUNTING_VERSION}.zip \ 61 | && unzip akaunting.zip \ 62 | && rm akaunting.zip \ 63 | && find akaunting-*/ -mindepth 1 -maxdepth 1 -exec mv -t /var/www/akaunting/ -- {} + \ 64 | && rmdir akaunting-* \ 65 | && chown -R www-data:www-data /var/www/akaunting 66 | 67 | 68 | # Install dependencies and config files 69 | # NOTE: Change to www-data as composer should never run as root. 70 | # See https://getcomposer.org/root 71 | USER www-data 72 | WORKDIR /var/www/akaunting 73 | RUN composer install \ 74 | && php artisan vendor:publish --provider="Fideloper\Proxy\TrustedProxyServiceProvider" \ 75 | && cp -R /var/www/akaunting/config /var/www/akaunting/config.package 76 | 77 | 78 | # Install files 79 | USER root 80 | COPY supervisord/*.conf /etc/supervisor/conf.d/ 81 | 82 | COPY nginx/akaunting /etc/nginx/sites-available/akaunting 83 | RUN chown www-data:www-data /etc/nginx/sites-available/akaunting \ 84 | && ln -s /etc/nginx/sites-available/akaunting /etc/nginx/sites-enabled 85 | 86 | 87 | # Start supervisord 88 | EXPOSE 8080/TCP 89 | 90 | COPY entrypoint.sh /usr/local/bin/ 91 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Akaunting Docker Container 2 | 3 | ## About 4 | 5 | Akaunting is a free, open source and online accounting software designed for 6 | small businesses and freelancers. It is built with modern technologies such as 7 | Laravel, Bootstrap, jQuery, RESTful API etc. Thanks to its modular structure, 8 | Akaunting provides an awesome App Store for users and developers. 9 | 10 | - https://akaunting.com/ 11 | 12 | This repository holds the source of the all-in-one Akaunting Docker image 13 | available at: 14 | 15 | - https://hub.docker.com/r/kuralabs/docker-akaunting/ 16 | 17 | 18 | ## Usage 19 | 20 | Adapt the following script to your needs: 21 | 22 | ```bash 23 | #!/usr/bin/env bash 24 | 25 | set -o errexit 26 | set -o nounset 27 | 28 | # Create mount points 29 | sudo mkdir -p /srv/akaunting/mysql 30 | sudo mkdir -p /srv/akaunting/logs 31 | sudo mkdir -p /srv/akaunting/config 32 | 33 | # Stop the running container 34 | docker stop akaunting || true 35 | 36 | # Remove existing container 37 | docker rm akaunting || true 38 | 39 | # Pull the new image 40 | docker pull kuralabs/docker-akaunting:latest 41 | 42 | # Run the container 43 | docker run --detach --init \ 44 | --hostname akaunting \ 45 | --name akaunting \ 46 | --restart always \ 47 | --publish 8080:8080 \ 48 | --volume /srv/akaunting/mysql:/var/lib/mysql \ 49 | --volume /srv/akaunting/logs:/var/log \ 50 | --volume /srv/akaunting/config:/var/www/akaunting/config \ 51 | --env MYSQL_ROOT_PASSWORD="[YOUR_AWESOME_MYSQL_ROOT_PASSWORD]" \ 52 | kuralabs/docker-akaunting:latest 53 | ``` 54 | 55 | If you need to set the container to the same time zone as your host machine you 56 | may use the following options: 57 | 58 | ``` 59 | --env TZ=America/New_York \ 60 | --volume /etc/timezone:/etc/timezone:ro \ 61 | --volume /etc/localtime:/etc/localtime:ro \ 62 | ``` 63 | 64 | You may use the following website to find your time zone: 65 | 66 | - http://timezonedb.com/ 67 | 68 | Then, open `http://localhost:8080/` (or corresponding URL) in your browser 69 | and finish the installation using the web UI. 70 | 71 | You can find the parameters for the "Database Setup" step in your container 72 | logs: 73 | 74 | ``` 75 | docker logs akaunting 76 | ``` 77 | 78 | 79 | ### Using behind a SSL terminating reverse proxy 80 | 81 | A very common use case is to use a container behind a web server configured as 82 | a reverse proxy and handling the HTTPS connection. 83 | 84 | To enable Akaunting to work behind a reverse proxy first configure the trusted 85 | proxies. From your host (where you mounted the Akaunting configuration files): 86 | 87 | ``` 88 | sudo nano /srv/akaunting/config/trustedproxy.php 89 | ``` 90 | 91 | In many cases, and depending on your setup and firewall, the following might be 92 | sufficient: 93 | 94 | ``` 95 | /* 96 | * Or, to trust all proxies that connect 97 | * directly to your server, uncomment this: 98 | */ 99 | 'proxies' => '*', 100 | ``` 101 | 102 | #### Apache 103 | 104 | Use the following configuration to setup the reverse proxy in Apache for 105 | Akaunting: 106 | 107 | ``` 108 | # Reverse proxy 109 | ProxyPreserveHost On 110 | ProxyPass / http://0.0.0.0:8080/ 111 | ProxyPassReverse / http://0.0.0.0:8080/ 112 | 113 | RequestHeader set X-Forwarded-Proto "https" 114 | RequestHeader set X-Forwarded-Port "443" 115 | ``` 116 | 117 | 118 | #### NGINX 119 | 120 | The following is just a guess and hasn't been tested, so if you use Nginx 121 | please confirm if the following configuration works as expected. 122 | 123 | ``` 124 | location / { 125 | proxy_pass http://0.0.0.0:8080/; 126 | 127 | proxy_set_header Host $host; 128 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 129 | proxy_set_header X-Forwarded-Port 443; 130 | proxy_set_header X-Forwarded-Proto https; 131 | } 132 | ``` 133 | 134 | 135 | ### Configuring email to use GSuite - Gmail SMTP 136 | 137 | A common setup is to use a Gmail / GSuite account to send emails. To configure 138 | Akaunting edit mail configuration as follows: 139 | 140 | ``` 141 | sudo nano /srv/akaunting/config/mail.php 142 | ``` 143 | 144 | And change keys to: 145 | 146 | ``` 147 | 'driver' => 'smtp', 148 | 'host' => 'smtp.gmail.com', 149 | 'port' => 587, 150 | 'from' => [ 151 | 'address' => 'your.email@your-domain.com', 152 | 'name' => 'Your Company Name', 153 | ], 154 | 155 | 'encryption' => 'tls', 156 | 'username' => 'your.email@your-domain.com', 157 | 'password' => 'YOUR_SMTP_PASSWORD', 158 | ``` 159 | 160 | 161 | ## Development 162 | 163 | Build me with: 164 | 165 | ``` 166 | docker build --tag kuralabs/docker-akaunting:latest . 167 | ``` 168 | 169 | In development, run me with: 170 | 171 | ``` 172 | MYSQL_ROOT_PASSWORD=[MYSQL SECURE ROOT PASSWORD] ./run/akaunting-dev.sh 173 | ``` 174 | 175 | 176 | ## License 177 | 178 | ``` 179 | Copyright (C) 2017-2018 KuraLabs S.R.L 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, 188 | software distributed under the License is distributed on an 189 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 190 | KIND, either express or implied. See the License for the 191 | specific language governing permissions and limitations 192 | under the License. 193 | ``` 194 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | 6 | ################## 7 | # Setup # 8 | ################## 9 | 10 | MYSQL_ROOT_PASSWORD_SET=${MYSQL_ROOT_PASSWORD:-} 11 | 12 | if [ -z "${MYSQL_ROOT_PASSWORD_SET}" ]; then 13 | echo "Please set the MySQL root password:" 14 | echo " docker run -e MYSQL_ROOT_PASSWORD= ... kuralabs/akaunting:latest ..." 15 | echo "See README.rst for more information on usage." 16 | exit 1 17 | fi 18 | 19 | # Logging 20 | for i in mysql,mysql nginx,root supervisor,root; do 21 | 22 | IFS=',' read directory owner <<< "${i}" 23 | 24 | if [ ! -d "/var/log/${directory}" ]; then 25 | echo "Setting up /var/log/${directory} ..." 26 | mkdir -p "/var/log/${directory}" 27 | chown "${owner}:adm" "/var/log/${directory}" 28 | else 29 | echo "Directory /var/log/${directory} already setup ..." 30 | fi 31 | done 32 | 33 | # Copy configuration files if new mount 34 | if find /var/www/akaunting/config -mindepth 1 | read; then 35 | echo "Configuration is mounted. Skipping copy ..." 36 | else 37 | echo "First configuration. Copying config files ..." 38 | cp -R /var/www/akaunting/config.package/* /var/www/akaunting/config 39 | chown -R www-data:www-data /var/www/akaunting/config 40 | fi 41 | 42 | ################## 43 | # Waits # 44 | ################## 45 | 46 | function wait_for_mysql { 47 | 48 | echo -n "Waiting for MySQL " 49 | for i in {10..0}; do 50 | if mysqladmin ping > /dev/null 2>&1; then 51 | break 52 | fi 53 | echo -n "." 54 | sleep 1 55 | done 56 | echo "" 57 | 58 | if [ "$i" == 0 ]; then 59 | echo >&2 "FATAL: MySQL failed to start" 60 | echo "Showing content of /var/log/mysql/error.log ..." 61 | cat /var/log/mysql/error.log || true 62 | exit 1 63 | fi 64 | } 65 | 66 | function wait_for_php_fpm { 67 | 68 | echo -n "Waiting for php-fpm " 69 | for i in {10..0}; do 70 | if [ -S "/run/php/php7.0-fpm.sock" ]; then 71 | break 72 | fi 73 | echo -n "." 74 | sleep 1 75 | done 76 | echo "" 77 | 78 | if [ "$i" == 0 ]; then 79 | echo >&2 "FATAL: php-fpm failed to start" 80 | echo "Showing content of /var/log/supervisor/php-fpm.log ..." 81 | cat /var/log/supervisor/php-fpm.log || true 82 | exit 1 83 | fi 84 | } 85 | 86 | ################## 87 | # Initialization # 88 | ################## 89 | 90 | # MySQL boot 91 | 92 | # Workaround for issue #72 that makes MySQL to fail to 93 | # start when using docker's overlay2 storage driver: 94 | # https://github.com/docker/for-linux/issues/72 95 | find /var/lib/mysql -type f -exec touch {} \; 96 | 97 | # Initialize /var/lib/mysql if empty (first --volume mount) 98 | if [ ! -d "/var/lib/mysql/mysql" ]; then 99 | echo "Empty /var/lib/mysql/ directory. Initializing MySQL structure ..." 100 | 101 | echo "MySQL user has uid $(id -u mysql). Changing /var/lib/mysql ownership ..." 102 | chown -R mysql:mysql /var/lib/mysql 103 | 104 | echo "Initializing MySQL ..." 105 | echo "UPDATE mysql.user 106 | SET authentication_string = PASSWORD('${MYSQL_DEFAULT_PASSWORD}'), password_expired = 'N' 107 | WHERE User = 'root' AND Host = 'localhost'; 108 | FLUSH PRIVILEGES;" > /tmp/mysql-init.sql 109 | 110 | /usr/sbin/mysqld \ 111 | --initialize-insecure \ 112 | --init-file=/tmp/mysql-init.sql || cat /var/log/mysql/error.log 113 | 114 | rm /tmp/mysql-init.sql 115 | fi 116 | 117 | ################## 118 | # Supervisord # 119 | ################## 120 | 121 | echo "Starting supervisord ..." 122 | # Note: stdout and stderr are redirected to /dev/null as logs are already being 123 | # saved in /var/log/supervisor/supervisord.log 124 | supervisord --nodaemon -c /etc/supervisor/supervisord.conf > /dev/null 2>&1 & 125 | 126 | # Wait for MySQL to start 127 | wait_for_mysql 128 | 129 | # Wait for PHP FPM to start 130 | wait_for_php_fpm 131 | 132 | ################## 133 | # MySQL # 134 | ################## 135 | 136 | # Check if password was changed 137 | echo "\ 138 | [client] 139 | user=root 140 | password=${MYSQL_DEFAULT_PASSWORD} 141 | " > ~/.my.cnf 142 | 143 | if echo "SELECT 1;" | mysql &> /dev/null; then 144 | 145 | echo "Securing MySQL installation ..." 146 | mysql_secure_installation --use-default 147 | 148 | echo "Changing root password ..." 149 | echo "ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'; 150 | FLUSH PRIVILEGES;" | mysql 151 | else 152 | echo "Root password already set. Continue ..." 153 | fi 154 | 155 | # Start using secure credentials 156 | echo "\ 157 | [client] 158 | user=root 159 | password=${MYSQL_ROOT_PASSWORD} 160 | " > ~/.my.cnf 161 | 162 | # Create database 163 | if ! echo "USE akaunting;" | mysql &> /dev/null; then 164 | echo "Creating akaunting database ..." 165 | echo "CREATE DATABASE akaunting;" | mysql 166 | else 167 | echo "Database already exists. Continue ..." 168 | fi 169 | 170 | ################## 171 | # AKAUNTING # 172 | ################## 173 | 174 | if echo "SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = 'akaunting';" | mysql | grep 0 &> /dev/null; then 175 | 176 | echo "Database is empty, installing Akaunting for the first time ..." 177 | 178 | # Create standard user and grant permissions 179 | MYSQL_USER_PASSWORD=$(openssl rand -base64 32) 180 | 181 | if ! echo "SELECT COUNT(*) FROM mysql.user WHERE user = 'akaunting';" | mysql | grep 1 &> /dev/null; then 182 | 183 | echo "Creating akaunting database user ..." 184 | 185 | echo "CREATE USER 'akaunting'@'localhost' IDENTIFIED BY '${MYSQL_USER_PASSWORD}'; 186 | GRANT ALL PRIVILEGES ON akaunting.* TO 'akaunting'@'localhost'; 187 | FLUSH PRIVILEGES;" | mysql 188 | else 189 | echo "Akaunting not installed but user was created. Resetting password ..." 190 | 191 | echo "ALTER USER 'akaunting'@'localhost' IDENTIFIED BY '${MYSQL_USER_PASSWORD}'; 192 | FLUSH PRIVILEGES;" | mysql 193 | fi 194 | 195 | GREEN='\033[0;32m' 196 | NO_COLOR='\033[0m' 197 | 198 | echo -e "${GREEN}" 199 | echo "*****************************************************************" 200 | echo "IMPORTANT!! GO TO THE WEB INTERFACE TO FINISH INSTALLATION!" 201 | echo "" 202 | echo "Use the following parameters in 'Database Setup':" 203 | echo "" 204 | echo "Hostname: 127.0.0.1:3306" 205 | echo "Username: akaunting" 206 | echo "Password: ${MYSQL_USER_PASSWORD}" 207 | echo "Database: akaunting" 208 | echo "" 209 | echo "Please securely store these credentials!" 210 | echo "*****************************************************************" 211 | echo -e "${NO_COLOR}" 212 | 213 | # We could use the following command to install Akaunting, but it could 214 | # imply: 215 | # 216 | # - To pass environment variables that only will be use the first time. 217 | # - Force to user to run the container interactively the first time. 218 | # 219 | # Both are ugly. A better approach could be to make Akaunting store the 220 | # database credentials and in the web UI just ask for Company Name, Company 221 | # email, admin email and admin password only, but this will require support 222 | # from the application. 223 | 224 | # sudo -u www-data php artisan app:configure -vvv \ 225 | # --db-host=127.0.0.1 \ 226 | # --db-port=3306 \ 227 | # --db-name=akaunting \ 228 | # --db-username=akaunting \ 229 | # --db-password="${MYSQL_USER_PASSWORD}" \ 230 | # --no-interaction \ 231 | # --company-name="Company Name" \ 232 | # --company-email="info@company.com" \ 233 | # --admin-email="info@company.com" \ 234 | # --admin-password="AwesomeAdminPassword1$" 235 | 236 | else 237 | echo "Akaunting already installed. Continue ..." 238 | fi 239 | 240 | ################## 241 | # NGINX # 242 | ################## 243 | 244 | # Start service 245 | echo "Starting NGINX ..." 246 | supervisorctl start nginx 247 | 248 | ################## 249 | # Finish # 250 | ################## 251 | 252 | # Display final status 253 | supervisorctl status 254 | 255 | # Security clearing 256 | rm ~/.my.cnf 257 | 258 | unset MYSQL_DEFAULT_PASSWORD 259 | unset MYSQL_ROOT_PASSWORD 260 | unset MYSQL_USER_PASSWORD 261 | 262 | history -c 263 | history -w 264 | 265 | if [ -z "$@" ]; then 266 | echo "Done booting up. Waiting on supervisord pid $(supervisorctl pid) ..." 267 | wait $(supervisorctl pid) 268 | else 269 | echo "Running user command : $@" 270 | exec "$@" 271 | fi 272 | --------------------------------------------------------------------------------