Skip to content
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and publish to GHCR

on:
push:
branches:
- master
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: akaunting/docker/akaunting

jobs:
build-and-push:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/akaunting/docker/akaunting:latest
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,19 @@ RUN docker-php-ext-configure gd \
pdo_mysql \
zip

RUN pecl install redis \
&& docker-php-ext-enable redis

RUN mkdir -p /var/www/akaunting \
&& curl -Lo /tmp/akaunting.zip 'https://akaunting.com/download.php?version=latest&utm_source=docker&utm_campaign=developers' \
&& unzip /tmp/akaunting.zip -d /var/www/html \
&& rm -f /tmp/akaunting.zip
&& VERSION=$(curl -fsSL https://api.github.com/repos/akaunting/akaunting/releases/latest \
| grep '"tag_name"' \
| head -1 \
| cut -d '"' -f4) \
&& echo "Downloading Akaunting ${VERSION}" \
&& curl -fLo /tmp/akaunting.zip \
"https://github.com/akaunting/akaunting/releases/download/${VERSION}/Akaunting_${VERSION#v}-Stable.zip" \
&& unzip /tmp/akaunting.zip -d /var/www/html \
&& rm -f /tmp/akaunting.zip

COPY files/akaunting.sh /usr/local/bin/akaunting.sh
COPY files/html /var/www/html
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ AKAUNTING_SETUP=true docker-compose -f fpm-alpine-nginx-docker-compose.yml -f fp
# Download Akaunting using git and install composer and npm and run Akaunting using FPM on Alpine and using Nginx as internal proxy and supervisor to manage the queues
AKAUNTING_SETUP=true docker-compose -f fpm-alpine-nginx-docker-compose.yml -f fpm-alpine-nginx-composer-supervisor-docker-compose.yml up --build
```
## Kubernetes
See kubernetes folder

## License

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ services:

akaunting:
container_name: akaunting
image: docker.io/akaunting/akaunting:latest
#image: docker.io/akaunting/akaunting:latest
image: ghcr.io/akaunting/docker/akaunting:latest
build:
context: .
ports:
Expand Down
12 changes: 11 additions & 1 deletion files/akaunting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ a2enmod rewrite
do_start=
do_shell=
do_setup=
do_queue_worker=

while [ $# -gt 0 ]; do
case "$1" in
Expand All @@ -19,14 +20,23 @@ while [ $# -gt 0 ]; do
do_setup=true
do_start=true
;;
--queue-worker)
do_start=false
do_queue_worker=true
;;
esac
shift
done

if [ "$do_queue_worker" ]; then
PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-256M}"
exec php -d memory_limit="$PHP_MEMORY_LIMIT" artisan queue:work redis --queue=imports,imports:notify,default --verbose --tries=3 --timeout=90 --sleep=3
fi

mkdir -p storage/framework/{sessions,views,cache}
mkdir -p storage/app/uploads

if [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
if [ -z "$do_queue_worker" ] && [ "$do_setup" -o "$AKAUNTING_SETUP" == "true" ]; then
retry_for=30
retry_interval=5
while sleep $retry_interval; do
Expand Down
51 changes: 51 additions & 0 deletions kubernetes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Setup behavior
Running each deployment on different nodes can cause performance issues, best to pin akaunting, mariadb and redis to the same node. Get the database and redis running first.

In the akaunting.yaml, set to install mode in both the akaunting and akaunting-worker containers:

```yaml
- name: APP_INSTALLED
value: "false"
- name: AKAUNTING_SETUP
value: "true"
```

The setup can take a while, so watch the logs until it completes. This should take you to the the language and database forms. These should be filled with whatever you put in the yaml. At this point scale the deployment to 0 and edit the yaml...

```yaml
- name: APP_INSTALLED
value: "true"
- name: AKAUNTING_SETUP
value: "false"
```

3. apply the manifest again with and scale back up to 1.

After the app comes back up, you should land on the login screen. After logging in, Akaunting will prompt for the API key, remaining business details such as currency and address information.

## TRAEFIK
If you get problems with the container creating HTTP links when HTTPS are needed... this should fix it...

`sudo vim /var/lib/rancher/k3s/server/manifests/traefik-config.yaml`

```yaml
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
ports:
web:
forwardedHeaders:
insecure: true
websecure:
forwardedHeaders:
insecure: true
```
It's best to do this before running the yamls.

## License

This project is released under the GPLv3 license. See [LICENSE.txt](LICENSE.txt).
181 changes: 181 additions & 0 deletions kubernetes/akaunting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
apiVersion: v1
kind: Secret
metadata:
name: akaunting-secrets
type: Opaque
stringData:
ADMIN_PASSWORD: Change-me

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: akaunting
spec:
replicas: 1
selector:
matchLabels:
app: akaunting
template:
metadata:
labels:
app: akaunting
spec:
nodeSelector:
kubernetes.io/hostname: node_1

containers:

# Akaunting container
- name: akaunting
image: ghcr.io/akaunting/docker/akaunting:latest
env:
- name: APP_INSTALLED
value: "false"
- name: AKAUNTING_SETUP
value: "true"
- name: APP_URL
value: "https://akaunting.mydomain.com"
- name: LOCALE
value: "en-GB"
- name: DB_HOST
value: "mariadb"
- name: DB_PORT
value: "3306"
- name: DB_NAME
value: "akaunting"
- name: DB_DATABASE
value: "akaunting"
- name: DB_USERNAME
value: "akaunting"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mariadb-secret
key: akaunting-password
- name: DB_PREFIX
value: "asd_"
- name: PHP_MEMORY_LIMIT
value: "256M"

- name: COMPANY_NAME
value: "Business Name"
- name: COMPANY_EMAIL
value: "contact@mydomain.com"
- name: ADMIN_EMAIL
value: "admin@mydomain.com"
- name: ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: akaunting-secrets
key: ADMIN_PASSWORD

# Redis
- name: REDIS_HOST
value: "redis"
- name: REDIS_PORT
value: "6379"
- name: REDIS_DB
value: "1"
- name: REDIS_DATABASE
value: "1"
- name: CACHE_DRIVER
value: "redis"
- name: SESSION_DRIVER
value: "redis"
- name: QUEUE_CONNECTION
value: "redis"

volumeMounts:
- name: storage
mountPath: /var/www/html/storage

# Worker container
- name: akaunting-worker
image: ghcr.io/akaunting/docker/akaunting:latest
args:
- --queue-worker
env:
- name: APP_INSTALLED
value: "false"
- name: AKAUNTING_SETUP
value: "true"
- name: APP_URL
value: "https://akaunting.mydomain.com"
- name: LOCALE
value: "en-GB"
- name: DB_HOST
value: "mariadb"
- name: DB_PORT
value: "3306"
- name: DB_NAME
value: "akaunting"
- name: DB_DATABASE
value: "akaunting"
- name: DB_USERNAME
value: "akaunting"
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: mariadb-secret
key: akaunting-password
- name: DB_PREFIX
value: "asd_"

# Redis
- name: REDIS_HOST
value: "redis"
- name: REDIS_PORT
value: "6379"
- name: REDIS_DB
value: "1"
- name: REDIS_DATABASE
value: "1"
- name: CACHE_DRIVER
value: "redis"
- name: SESSION_DRIVER
value: "redis"
- name: QUEUE_CONNECTION
value: "redis"
- name: PHP_MEMORY_LIMIT
value: "256M"

volumeMounts:
- name: storage
mountPath: /var/www/html/storage

volumes:
- name: storage
hostPath:
path: /path/to/akaunting-data/storage
type: DirectoryOrCreate

---

apiVersion: v1
kind: Service
metadata:
name: akaunting
spec:
selector:
app: akaunting
ports:
- port: 80
targetPort: 80

---

apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: akaunting
spec:
entryPoints:
- web
routes:
- match: Host(`akaunting.mydomain.com`)
kind: Rule
services:
- name: akaunting
port: 80
Loading