xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
736 stars 50 forks source link

Azure Container Deploys continuously restarts - Is unable to find config.yml #124

Closed OhhHellooow closed 4 months ago

OhhHellooow commented 4 months ago

Hello,

I created a container in Azure successfully, however, it continuously restarts and the error logs state:

Error: Error: Configuration file /data/config/gallery.config.yml does not exist

Is there a way to fix this manually within the Azure console or command line, to get this specifically deployed image up-and-running? Otherwise, what would be the correct method to get this deployed to Azure if I were to deploy it a second time?

Thanks!

xemle commented 4 months ago

I guess #101 might help here as kind of duplicate.

At the end, the gallery needs a configuration file gallery.config.yml in /data/config in the container. It should be generated like descibed in the docker compose installation instructions.

You can add it manually as well by coping and modifying it from the repo file gallery.config-example.yml

OhhHellooow commented 4 months ago

Deployed the container again, but this time also Mounted a share to /data in Storage Container. Added the Config directory and config file. Get past that error. Now, the error shows: /data/Pictures doesn't exist. Create another folder in that mapped Storage Container. Get past that error. Now I see in the Logs within Azure:

""" [?25l? Gallery main menu … ▸ Start server Update and process source files Export meta data System Exit[?25h """

And the Logs that are located in the folder /data/config/gallery.yml:

""" ... {"level":20,"time":"2024-03-03T23:26:40.612Z","pid":222,"hostname":"SandboxHost-638451051097264264","module":"cli.config.find","levelName":"debug","msg":"Found configuration at /data/config/gallery.config.yml"} {"level":20,"time":"2024-03-03T23:26:46.655Z","pid":237,"hostname":"SandboxHost-638451051097264264","module":"cli.config.find","levelName":"debug","msg":"Found configuration at /data/config/gallery.config.yml"} {"level":20,"time":"2024-03-03T23:26:52.595Z","pid":252,"hostname":"SandboxHost-638451051097264264","module":"cli.config.find","levelName":"debug","msg":"Found configuration at /data/config/gallery.config.yml"} ... """

image

xemle commented 4 months ago

Somehow the container starts the interactive menu which is the default, if only the main file /app/gallery.js is called. Have you tried to setup the command which maps the docker compose command run server so that /app/gallery.js run server is called?

The default docker compose file has following definition

    entrypoint: ['node', '/app/gallery.js']
    command: ['run', 'server']

Maybe that helps?

OhhHellooow commented 4 months ago

works!

Below is the full deployment using Azure Shell

# vars
ACI_PERS_RESOURCE_GROUP=HomeGalleryRG01
ACI_PERS_STORAGE_ACCOUNT_NAME=mystorageaccount123
ACI_PERS_LOCATION=eastus
ACI_PERS_SHARE_NAME=acishare

#create storage
az storage account create --resource-group $ACI_PERS_RESOURCE_GROUP --name $ACI_PERS_STORAGE_ACCOUNT_NAME --location $ACI_PERS_LOCATION --sku Standard_LRS

#create share
az storage share create --name $ACI_PERS_SHARE_NAME --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME

#var for storage key
STORAGE_KEY=$(az storage account keys list --resource-group $ACI_PERS_RESOURCE_GROUP --account-name $ACI_PERS_STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)

#create container and mapping of the share
az container create \
    --resource-group $ACI_PERS_RESOURCE_GROUP \
    --name homegallery-01 \
    --image xemle/home-gallery  \
    --dns-name-label homegallery-01 \
    --ports 3000 \
    --command-line "node /app/gallery.js run server" \
    --azure-file-volume-account-name $ACI_PERS_STORAGE_ACCOUNT_NAME \
    --azure-file-volume-account-key $STORAGE_KEY \
    --azure-file-volume-share-name $ACI_PERS_SHARE_NAME \
    --azure-file-volume-mount-path /data

Connect to the hostname:3000 and it works!

The only issue is that the image doesn't contain these 2 steps. create /data/Pictures , create gallery.config.yml , ... Comes in handy though, as I now use the aci share to upload the files within the Azure RG.