Issue with Addon persistent /data storage

Hi,
I’ve been reading through doco and posts regarding persistent storage for addons. In here, it says under the “map” option that /data is always available and writable.

I am testing a new addon locally (not via repository) using huginn/huginn and when exec’ed into the container, I cannot read or write into the data folder getting permission denied. I am not using any “map” option since this is on by default.

I’ve tested mappings to different folders, runtime sym links and who knows what else. But I am not getting past this.

What am I missing or what am I doing wrong? Thanks in advance.

Please show your dockerfile

FROM huginn/huginn


# Add any additional dependencies or scripts here if needed
COPY run.sh /usr/bin/run.sh
RUN chmod +x /usr/bin/run.sh

CMD [ "/usr/bin/run.sh" ]

I have not added anything extra at the moment. I have been experimenting with some GPT suggested options to create symlinks in run.sh like this:

#!/bin/bash

# Ensure the persistent MySQL directory exists
mkdir -p /data/mysql

# Fix permissions to allow MySQL access
chown -R mysql:mysql /data/mysql
chmod -R 775 /data/mysql

# Symlink the persistent directory to MySQL's data directory
if [ ! -L /var/lib/mysql ]; then
    rm -rf /var/lib/mysql
    ln -s /data/mysql /var/lib/mysql
fi

# Initialize MySQL data directory if not already initialized
if [ ! -f /data/mysql/ibdata1 ]; then
    echo "Initializing MySQL data directory..."
    mysql_install_db --user=mysql --datadir=/data/mysql
fi

# Start MySQL service
service mysql start

# Start Huginn
bundle exec rake db:create db:migrate
rails server -b 0.0.0.0 -p 3000

But this is GPT adding stuff which is also not needed like MYSQL as it is included. This is just an example I was given when experimenting.

So you’re not building from ghcr.io/hassio-addons/base? Probably the source of your issue.

Dockerfile:

ARG BUILD_FROM
FROM $BUILD_FROM as builder
...

build.yaml:

---
build_from:
  aarch64: ghcr.io/hassio-addons/base/aarch64:16.3.4
  amd64: ghcr.io/hassio-addons/base/amd64:16.3.4
  armv7: ghcr.io/hassio-addons/base/armv7:16.3.4

You want to duplicate the dockerfile of huginn/huginn rather than deriving from it.

Thanks. I will give it a go and will let you know.