Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error while updating docker Image 2023.12.0 #2011

Closed
1 task done
nmathey opened this issue Dec 2, 2023 · 29 comments
Closed
1 task done

[Bug]: Error while updating docker Image 2023.12.0 #2011

nmathey opened this issue Dec 2, 2023 · 29 comments
Labels
bug Something isn't working

Comments

@nmathey
Copy link
Contributor

nmathey commented Dec 2, 2023

Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

While updating docker image with latest tag 2023.12.0, the container is not able to start properly and crash.

What error did you receive?

Node.js v18.19.0
Checking if there are any migrations to run for direction "up"...
file:///app/src/migrations.js:21
            throw err;
            ^
[Error: EACCES: permission denied, open '.migrate'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '.migrate'
}

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

No response

Operating System

Other

@nmathey nmathey added the bug Something isn't working label Dec 2, 2023
@reesehopkins
Copy link

Running into the same issue. I am running on Synology NAS using these instructions

@youngcw
Copy link
Member

youngcw commented Dec 3, 2023

Have you tried using Actual's docker account instead of using the old jlongster one? The new one is actualbudget/actual-server

@carpenike
Copy link

Having the same issue with

            image:
              repository: ghcr.io/actualbudget/actual-server
              tag: 23.12.0

@Ethics0928
Copy link

I'm having the same issue as well. I am using Actual's docker account instead of the old jlongster one as I am trying to update to 23.12.0

@mattang687
Copy link

Running into the same issue using docker.io/actualbudget/actual-server:latest

@pogora
Copy link

pogora commented Dec 3, 2023

Same here.
Even created a new clone with empty folders. Still the same.
Going back to: ghcr.io/actualbudget/actual-server:23.11.0
Gets everything back and working with the previous version.

@fopoku2k2
Copy link

I also have the same issue. I am using docker on synology nas with the actualbudget/actual-server docker account

@MatissJanis
Copy link
Member

👋

I followed the install instructions here and I think for v23.12.0 you will want to change a few things in those instructions to be more stable.

On step 11: do not create any folders.

On step 13: remove the volumes argument. Instead use this:

volumes:
      - /volume1/docker/actual:/app

This should mount the entire folder. At which point it should be able to run the migrations that will automatically create the server-files and user-files folders inside there (if they are not already there).

If someone could try doing this and letting me know if that works - I'd very much appreciate it.

@MatissJanis
Copy link
Member

MatissJanis commented Dec 3, 2023

☝️ a bit more context for the technically savy.

Before v23.12.0 we used to have code that manually creates server-files and user-files folders (if they do not exist). And then it created databases for the server to use. Over time we added more features so the initial database schema was not sufficient. And because we didn't have a proper database migration system in place - the migrations were hacked.

Since v23.12.0 we moved to proper DB migrations. They are run when you launch the server. And they use a local .migrate file to store the state of the migrations (i.e. which ones have been ran) so that we don't need to re-run them on every boot.

As it turns out: some set-ups don't allow writing this .migrate file in the root actual directory. I think the esiest solution for Synology NAS users is this comment. But if there are other ideas - lets chat. And obviously PRs are welcome :)

@youngcw
Copy link
Member

youngcw commented Dec 3, 2023

I run Actual on my synology box and this is the docker-compose I use. I haven't had any issues that weren't my own doing with it. Edit the image and volumes to match your desired setup

version: "3"                                                                    
services:
  actual_server:
    image: actualbudget/actual-server:edge
    container_name: actual_budget
    network_mode: bridge
    ports:
      - "5006:5006"
    environment:
      - ACTUAL_UPLOAD_FILE_SYNC_SIZE_LIMIT_MB=50
      - ACTUAL_UPLOAD_FILE_SIZE_LIMIT_MB=50
      #- ACUTAL_HTTPS_KEY=/data/selfhost.key
      #- ACUTAL_HTTPS_CERT=/data/selfhost.crt
    volumes:
      - ./data:/data
    restart: unless-stopped

carpenike added a commit to carpenike/k8s-gitops that referenced this issue Dec 3, 2023
@youngcw
Copy link
Member

youngcw commented Dec 3, 2023

Hi everyone. That guide from Marius Hosting has been updated. My recommended process, if you are still having issues, would be to:

  1. Revert to 23.11.0 and export your data as a backup
  2. follow the new setup process in the guide
  3. pull the updated docker container
  4. if needed, import your exported budget.

That should get passed the issue of missing the .migration file and not having proper permissions.

@fopoku2k2
Copy link

fopoku2k2 commented Dec 3, 2023 via email

@nmathey
Copy link
Contributor Author

nmathey commented Dec 3, 2023

Working like a charm!
I guess this issue can be close as is since the problem was more related to an installation type rather than Actua itself?

@samcre
Copy link

samcre commented Dec 4, 2023

Hi everyone. That guide from Marius Hosting has been updated. My recommended process, if you are still having issues, would be to:

1. Revert to 23.11.0 and export your data as a backup

2. follow the new setup process in the guide

3. pull the updated docker container

4. if needed, import your exported budget.

That should get passed the issue of missing the .migration file and not having proper permissions.

If I understand the workflow of the app correctly, mounting the path /data of the container on your host will not fail on the start-up. But your server-files and user-files will be ONLY on the container, so you will lose them at any point. Please correct me if I'm wrong. Longtime user of docker and containers, but not so sure about Actual's behavior.

👋

I followed the install instructions here and I think for v23.12.0 you will want to change a few things in those instructions to be more stable.

On step 11: do not create any folders.

On step 13: remove the volumes argument. Instead use this:

volumes:
      - /volume1/docker/actual:/app

This should mount the entire folder. At which point it should be able to run the migrations that will automatically create the server-files and user-files folders inside there (if they are not already there).

If someone could try doing this and letting me know if that works - I'd very much appreciate it.

I tried this config on my Synology NAS, and it doesn't work. When you mount your host's /volume1/docker/actual onto your containers' /app, inside the container, the content of the /app directory is empty because it contains the host directory, which is empty on a new installation.

What it worked for me is to manually create the .migrate file on your host, and mount it directly to the container, like this:

    volumes:
      - /volume1/docker/actual/server-files:/app/server-files
      - /volume1/docker/actual/user-files:/app/user-files
      - /volume1/docker/actual/.migrate:/app/.migrate

With this config, the container start-up without problems because the .migrate file already exist.

In the long term, it would be a good idea to store this .migrate file inside server-files directly, or use a table inside an already created SQLite database, and store the migration's data on that table.

@jaredhenderson
Copy link

I'm still having this issue and I've tried the solutions in this thread. Mounting my docker dir as /data or /app doesn't seem to make a difference, and the container won't stay alive long enough for me to get to the console inside it.

If I need to make the .migrate file manually, where would it go? Currently my docker dir just contains server-files and user-files, I tried a .migrate file alongside those two and didn't seem to work.

@samcre
Copy link

samcre commented Dec 4, 2023

I'm still having this issue and I've tried the solutions in this thread. Mounting my docker dir as /data or /app doesn't seem to make a difference, and the container won't stay alive long enough for me to get to the console inside it.

If I need to make the .migrate file manually, where would it go? Currently my docker dir just contains server-files and user-files, I tried a .migrate file alongside those two and didn't seem to work.

The .migrate file should be alongside the directories server-files and user-files, just like this:

$ pwd
/volume1/docker/actualbudget
$ ls -la
total 4
drwxrwxrwx+ 1 user users  60 Dec  4 08:28 .
drwxrwxrwx+ 1 root          root  360 Nov 17 10:08 ..
-rwxrwxrwx+ 1 user users 373 Dec  4 08:28 .migrate
drwxrwxrwx+ 1 user users  28 Dec  4 08:27 server-files
drwxrwxrwx+ 1 user users 950 Dec  4 09:32 user-files

You can create the file simply using touch .migrate (be sure to use the same user that will run the docker container), and mount it inside the container with this docker-compose config:

    volumes:
      - /volume1/docker/actual/server-files:/app/server-files
      - /volume1/docker/actual/user-files:/app/user-files
      - /volume1/docker/actual/.migrate:/app/.migrate

If you face any error, send us the log, so we can help you. 😊

@samip5
Copy link

samip5 commented Dec 4, 2023

As it turns out: some set-ups don't allow writing this .migrate file in the root actual directory. I think the esiest solution for Synology NAS users is this comment. But if there are other ideas - lets chat. And obviously PRs are welcome :)

It might be a good time as any to move to an SQL query builder maybe?
Eg. https://knexjs.org which would allow to support Postgres and sqlite aswell as database-agostic migrations. :)

@ajfromuk
Copy link

ajfromuk commented Dec 4, 2023

Hi everyone. That guide from Marius Hosting has been updated. My recommended process, if you are still having issues, would be to:

  1. Revert to 23.11.0 and export your data as a backup
  2. follow the new setup process in the guide
  3. pull the updated docker container
  4. if needed, import your exported budget.

That should get passed the issue of missing the .migration file and not having proper permissions.

I am honestly going to sound like a noob and I have been searching online but how to I revert the container to 23.11.0. I'm trying to recreate it and point the image to actualbudget/actual-server:23.11.0 but each time I click create it just doesnt pull it down and loads the current one I have installed.

@samip5
Copy link

samip5 commented Dec 4, 2023

Hey @MatissJanis, it think the migration file shouldn't live in the app root as if anybody is running this non-privileged, they don't have any way to write to things there.

@bjw-s
Copy link
Contributor

bjw-s commented Dec 4, 2023

I've created actualbudget/actual-server#289 that will have the server store the migrations file in the dataDir instead of the application root

@MatissJanis
Copy link
Member

Could someone please verify if the patch @bjw-s has graciously provided fixes the issue for you? actualbudget/actual-server#289

On my machine it works as expected (but TBH it worked fine before too).

@samip5
Copy link

samip5 commented Dec 5, 2023

Could someone please verify if the patch @bjw-s has graciously provided fixes the issue for you? actualbudget/actual-server#289

On my machine it works as expected (but TBH it worked fine before too).

Could you please push the container with it? It seems PR's are built but not pushed.

@bjw-s
Copy link
Contributor

bjw-s commented Dec 5, 2023

Could someone please verify if the patch @bjw-s has graciously provided fixes the issue for you? actualbudget/actual-server#289
On my machine it works as expected (but TBH it worked fine before too).

Could you please push the container with it? It seems PR's are built but not pushed.

https://github.com/users/bjw-s/packages/container/actual-server/154582722?tag=pr-289 (based on the edge-ubuntu Dockerfile)

@samip5
Copy link

samip5 commented Dec 5, 2023

I have tested the container and it does indeed now go to the /data path, which is writable and works as one would expect it to.

actual-0:/data$ ls -al
total 8
drwxrwsr-x 4 root  568   60 Dec  5 10:02 .
drwxr-xr-x 1 root root 4096 Dec  5 10:02 ..
-rw-r--r-- 1  568  568  373 Dec  5 10:02 .migrate
drwxr-sr-x 2  568  568   28 Dec  5 10:02 server-files
drwxr-sr-x 2  568  568    6 Dec  5 10:02 user-files

@pogora
Copy link

pogora commented Dec 5, 2023

Hi everyone. That guide from Marius Hosting has been updated. My recommended process, if you are still having issues, would be to:

  1. Revert to 23.11.0 and export your data as a backup
  2. follow the new setup process in the guide
  3. pull the updated docker container
  4. if needed, import your exported budget.

That should get passed the issue of missing the .migration file and not having proper permissions.

That worked for me as well.

@pogora
Copy link

pogora commented Dec 5, 2023

ly going to sound like a noob and I have been searching online but how to I revert the container to 23.11.0. I'm trying to recreate it and point the image to actualbudget/actual-server:23.11.0 but each time I click create it just doesnt pull it down and loads the current one I have installed.

That would depend on the software you use to manage your Docker. Personally I'd recommend Dockge or Portainer.
Then you need to create 2 containers 1. actualbudget-old and 2. actualbudget with the latest version.

Personally I prefer Dockge it's got a very simple UI and you can also add convert "docker run". It looked like this for me:
2023-12-05 15_59_23-Dockge - 192 168 147 3_8010 - Vivaldi

  1. actualbudget-old:
version: "3.9"
services:
  actualbudget-old:
    image: ghcr.io/actualbudget/actual-server:23.11.0-alpine
    container_name: actualbudget-old
    security_opt:
      - no-new-privileges:true
    ports:
      - #yourport#:5006
    volumes:
      - /volume2/docker/actual/server:/app/server-files
      - /volume2/docker/actual/user:/app/user-files
    restart: unless-stopped
networks: {}

  1. actualbudget:latest
version: "3.9"
services:
  actualbudget:
    image: ghcr.io/actualbudget/actual-server:latest-alpine
    container_name: actualbudget
    security_opt:
      - no-new-privileges:true
    ports:
      - #yourport#:5006
    volumes:
      - /volume1/docker/actualbudget:/data
    restart: unless-stopped
networks: {}

Then as mentioned by the guide before just export the data and import it to the latest version. After that you can delete the actualbudget-old container.

@joryirving
Copy link

Can confirm it's working as expected.

I have no name!@actual-8f59f864f-n45l2:/data$ ls -al
total 36
drwxrwsr-x 5 root  568  4096 Dec  5 15:32 .
drwxr-xr-x 1 root root  4096 Dec  5 15:32 ..
-rw-r--r-- 1  568  568   373 Dec  5 15:32 .migrate
drwxrws--- 2 root  568 16384 Nov 23 23:28 lost+found
drwxrwsr-x 2  568  568  4096 May  5  2023 server-files
drwxrwsr-x 2  568  568  4096 Apr 11  2023 user-files

@jaredhenderson
Copy link

I have also tested @bjw-s fix and it is working for me with no additional changes required, simply mounting /data as with 23.11.0.

I have no name!@7d780b104931:/data$ ls -al
total 4
drwxr-xr-x 1 1030 users  60 Dec  6 17:48 .
drwxr-xr-x 1 root root  178 Dec  6 17:45 ..
-rwxr-xr-x 1 1030 users 373 Dec  6 17:45 .migrate
drwxr-xr-x 1 1030 users  28 Nov 23 19:49 server-files
drwxr-xr-x 1 1030 users 190 Dec  6 17:48 user-files

I tried other solutions in this thread but this is the only one that is working for me - I'm on a Synology as well in case that matters. Thank you for your advice though @samcre

@MatissJanis
Copy link
Member

v23.12.1 has been released with the patch from @bjw-s .

Now that we have multiple solutions to the problem reported here. Thanks for everyone involved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests