Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ RUN docker-php-ext-configure gd \
pcntl \
pdo \
pdo_mysql \
pdo_pgsql \
zip

RUN mkdir -p /var/www/akaunting \
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ DB_HOST_WRITE: "example-write"
DB_HOST_READ: "example-read"
```

To use PostgreSQL instead of MySQL/MariaDB, point the `DB_*` variables at your PostgreSQL server and set the driver:

```
# In env/run.env put:
DB_CONNECTION=pgsql
DB_PORT=5432
```

During setup the container retries the installation for 30 seconds, every 5 seconds, until the database is reachable, and then exits with `Unable to find database!`. If your database takes longer to start (for example on Kubernetes), raise the timeout:

```
# In env/run.env put:
AKAUNTING_SETUP_TIMEOUT=300
AKAUNTING_SETUP_RETRY_INTERVAL=10
```

You can use Redis with Akaunting for performance enhancement and scalability, if you have a Redis you can take advantage of the following environment variables:

```
Expand Down
8 changes: 8 additions & 0 deletions env/run.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ DB_NAME=akaunting
DB_USERNAME=admin
DB_PASSWORD=akaunting_password

# For PostgreSQL instead of MySQL/MariaDB, uncomment this and set DB_PORT to 5432
#DB_CONNECTION=pgsql

# You should change this to a random string of three numbers or letters followed by an underscore
DB_PREFIX=asd_

Expand All @@ -21,3 +24,8 @@ COMPANY_EMAIL=my@company.com
# This will be the first administrative user created on setup.
ADMIN_EMAIL=me@company.com
ADMIN_PASSWORD=password

# How long setup keeps retrying while the database is not reachable yet, and the wait between attempts (in seconds).
# Raise the timeout if your database takes longer to start, e.g. on Kubernetes.
#AKAUNTING_SETUP_TIMEOUT=30
#AKAUNTING_SETUP_RETRY_INTERVAL=5
12 changes: 8 additions & 4 deletions files/akaunting-php-fpm-nginx-supervisord.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
retry_for="${AKAUNTING_SETUP_TIMEOUT:-30}"
retry_interval="${AKAUNTING_SETUP_RETRY_INTERVAL:-5}"
if ! [[ "$retry_for" =~ ^[0-9]+$ && "$retry_interval" =~ ^[1-9][0-9]*$ ]]; then
echo "AKAUNTING_SETUP_TIMEOUT and AKAUNTING_SETUP_RETRY_INTERVAL must be whole numbers of seconds (interval greater than 0)." >&2
exit 1
fi
while sleep $retry_interval; do
if php artisan install \
--db-host=$DB_HOST \
Expand All @@ -20,11 +24,11 @@ if [ "$AKAUNTING_SETUP" == "true" ]; then
"--admin-password=$ADMIN_PASSWORD" \
"--locale=$LOCALE" --no-interaction; then break
else
if [ $retry_for -le 0 ]; then
retry_for=$(( retry_for - retry_interval ))
if [ "$retry_for" -le 0 ]; then
echo "Unable to find database!" >&2
exit 1
fi
(( retry_for -= retry_interval ))
fi
done
else
Expand Down
12 changes: 8 additions & 4 deletions files/akaunting-php-fpm-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
retry_for="${AKAUNTING_SETUP_TIMEOUT:-30}"
retry_interval="${AKAUNTING_SETUP_RETRY_INTERVAL:-5}"
if ! [[ "$retry_for" =~ ^[0-9]+$ && "$retry_interval" =~ ^[1-9][0-9]*$ ]]; then
echo "AKAUNTING_SETUP_TIMEOUT and AKAUNTING_SETUP_RETRY_INTERVAL must be whole numbers of seconds (interval greater than 0)." >&2
exit 1
fi
while sleep $retry_interval; do
if php artisan install \
--db-host=$DB_HOST \
Expand All @@ -41,11 +45,11 @@ if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
"--admin-password=$ADMIN_PASSWORD" \
"--locale=$LOCALE" --no-interaction; then break
else
if [ $retry_for -le 0 ]; then
retry_for=$(( retry_for - retry_interval ))
if [ "$retry_for" -le 0 ]; then
echo "Unable to find database!" >&2
exit 1
fi
(( retry_for -= retry_interval ))
fi
done
else
Expand Down
12 changes: 8 additions & 4 deletions files/akaunting-php-fpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
retry_for="${AKAUNTING_SETUP_TIMEOUT:-30}"
retry_interval="${AKAUNTING_SETUP_RETRY_INTERVAL:-5}"
if ! [[ "$retry_for" =~ ^[0-9]+$ && "$retry_interval" =~ ^[1-9][0-9]*$ ]]; then
echo "AKAUNTING_SETUP_TIMEOUT and AKAUNTING_SETUP_RETRY_INTERVAL must be whole numbers of seconds (interval greater than 0)." >&2
exit 1
fi
while sleep $retry_interval; do
if php artisan install \
--db-host=$DB_HOST \
Expand All @@ -41,11 +45,11 @@ if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
"--admin-password=$ADMIN_PASSWORD" \
"--locale=$LOCALE" --no-interaction; then break
else
if [ $retry_for -le 0 ]; then
retry_for=$(( retry_for - retry_interval ))
if [ "$retry_for" -le 0 ]; then
echo "Unable to find database!" >&2
exit 1
fi
(( retry_for -= retry_interval ))
fi
done
else
Expand Down
12 changes: 8 additions & 4 deletions files/akaunting-v.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
retry_for="${AKAUNTING_SETUP_TIMEOUT:-30}"
retry_interval="${AKAUNTING_SETUP_RETRY_INTERVAL:-5}"
if ! [[ "$retry_for" =~ ^[0-9]+$ && "$retry_interval" =~ ^[1-9][0-9]*$ ]]; then
echo "AKAUNTING_SETUP_TIMEOUT and AKAUNTING_SETUP_RETRY_INTERVAL must be whole numbers of seconds (interval greater than 0)." >&2
exit 1
fi

if [[ -z "${DB_HOST_WRITE}" ]]; then
db_host="${DB_HOST}"
Expand All @@ -58,11 +62,11 @@ if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
"--admin-password=$ADMIN_PASSWORD" \
"--locale=$LOCALE" --no-interaction; then break
else
if [ $retry_for -le 0 ]; then
retry_for=$(( retry_for - retry_interval ))
if [ "$retry_for" -le 0 ]; then
echo "Unable to find database!" >&2
exit 1
fi
(( retry_for -= retry_interval ))
fi
done
else
Expand Down
12 changes: 8 additions & 4 deletions files/akaunting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
retry_for="${AKAUNTING_SETUP_TIMEOUT:-30}"
retry_interval="${AKAUNTING_SETUP_RETRY_INTERVAL:-5}"
if ! [[ "$retry_for" =~ ^[0-9]+$ && "$retry_interval" =~ ^[1-9][0-9]*$ ]]; then
echo "AKAUNTING_SETUP_TIMEOUT and AKAUNTING_SETUP_RETRY_INTERVAL must be whole numbers of seconds (interval greater than 0)." >&2
exit 1
fi
while sleep $retry_interval; do
if php artisan install \
--db-host=$DB_HOST \
Expand All @@ -43,11 +47,11 @@ if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
"--admin-password=$ADMIN_PASSWORD" \
"--locale=$LOCALE" --no-interaction; then break
else
if [ $retry_for -le 0 ]; then
retry_for=$(( retry_for - retry_interval ))
if [ "$retry_for" -le 0 ]; then
echo "Unable to find database!" >&2
exit 1
fi
(( retry_for -= retry_interval ))
fi
done
else
Expand Down
2 changes: 1 addition & 1 deletion fpm-alpine-nginx-composer-supervisor.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do

# Install PHP Extensions
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql redis
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql pdo_pgsql redis

# Configure Extension
RUN docker-php-ext-configure \
Expand Down
2 changes: 1 addition & 1 deletion fpm-alpine-nginx-composer.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do

# Install PHP Extensions
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql redis
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql pdo_pgsql redis

# Configure Extension
RUN docker-php-ext-configure \
Expand Down
2 changes: 1 addition & 1 deletion fpm-alpine-nginx.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do

# Install PHP Extensions
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql pdo_pgsql

# Configure Extension
RUN docker-php-ext-configure \
Expand Down
2 changes: 1 addition & 1 deletion fpm-alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/do

# Install PHP Extensions
RUN chmod +x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql redis pcntl
install-php-extensions gd zip intl imap xsl pgsql opcache bcmath mysqli pdo_mysql pdo_pgsql redis pcntl

# Configure Extension
RUN docker-php-ext-configure \
Expand Down
1 change: 1 addition & 0 deletions fpm.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ RUN docker-php-ext-configure gd \
pcntl \
pdo \
pdo_mysql \
pdo_pgsql \
zip

# Download Akaunting application
Expand Down
1 change: 1 addition & 0 deletions v.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ RUN docker-php-ext-configure gd \
pcntl \
pdo \
pdo_mysql \
pdo_pgsql \
zip

RUN pecl install redis && docker-php-ext-enable redis
Expand Down
Loading