Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

After updating SN with the latest tag files are not saved anymore in the upload folder. #83

Open
BobWs opened this issue Aug 26, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@BobWs
Copy link

BobWs commented Aug 26, 2022

Hi,
I've noticed that after uploading a file (picture or text file) the encrypted files isn't saved anymore in the upload folder.
The files can be preview in the desktop app and they look fine but the upload folder is empty.
Did something changed with the latest tag?

With the previous version every file that was uploaded in notes ended up in the upload folder.

# File upload path (relative to root directory)
FILE_UPLOAD_PATH=standardnotes/uploads

Am I missing something? Do I need to change some setting because of the latest tag?
TIA

@BobWs BobWs added the bug Something isn't working label Aug 26, 2022
@Wadera
Copy link

Wadera commented Oct 5, 2022

I've notice the same issue.

Potentially we are doing something wrong or stupid, or documentation missing some important bits. For some reason - after standard notes standalone update - all my uploaded files are gone (so I revert the snapshot, to retrieve them back). Looks like some of the docker volumes aren't set as persistent storage?

I'm also surprised that they are gone from all local clients after standalone sync server upgrade and that backups don't contain them? Or am I looking in the wrong places (I'm using decrypt.html to read the last backup.txt file, to get a decrypted-sn-data.zip I have all information about notes, tags, but I can't see attachments)?

That's how it looks after the update:

1

I can see metadata, and I'm able to Download file Successfully but files are 0 bytes size

2

Where files are stored?!

Like I've mentioned - I've reverted my docker server snapshot, and all files are back, but I can't see them on the box. data/uploads contain only .gitkeep file, but no attachments.

root@docker:/opt/standalone/data/uploads# ls -la
total 10
drwxrwxr-x 2 root root 3 Aug 14 16:19 .
drwxrwxr-x 6 root root 7 Aug 14 16:22 ..
-rwxrwxr-x 1 root root 0 Aug 14 16:19 .gitkeep

Regardless of that - all files are sync within multiple devices and are also available again on webclient. I have no clue where they are stored currently (MySQL Database within notes?) and why they are always deleted after running ./server.sh update and rebuilding all containers for latest versions.

Any ideas? Where should we start looking for solution?

@BobWs
Copy link
Author

BobWs commented Oct 6, 2022

Potentially we are doing something wrong or stupid, or documentation missing some important bits. For some reason - after standard notes standalone update - all my uploaded files are gone (so I revert the snapshot, to retrieve them back). Looks like some of the docker volumes aren't set as persistent storage?

At the moment I'm in the process of migrating all my notes and that of my users over to Joplin (server)!
After testing Joplin for a few months besides Standardnotes I've slightly grown to appreciate the way Joplin works. I must say it's not the best design when it comes to GUI for desktop and especially the mobile apps, but it works for my needs.
And with the plugins you can install on the desktop app, that helps a lot to make things easier.

Best thing about Joplin (server) is that you only have one container to install (2 if you count the database) and it just works! (can't say that about Standardnotes).
Also Attachments in notes works great, never had any problems adding attachments to any notes. (can't say that either about Standardnotes).

So in the end I have decided to migrate everything over to Joplin (server) and say goodbye to Standardnotes!

@moughxyz
Copy link
Member

moughxyz commented Oct 7, 2022

We'll take a look at this. As for backups, they are separate from note backups, and you can access them in Preferences > Backups > File Backups. But that preference has to be enabled first.

@karolsojko
Copy link
Member

Should be fixed now

@Wadera
Copy link

Wadera commented Nov 1, 2022

I've just tried to upgrade - and no luck - still the same issue 😢

@karolsojko karolsojko reopened this Nov 2, 2022
@karolsojko
Copy link
Member

@Wadera do you have any custom value on FILE_UPLOAD_PATH ? Maybe I'm missing something in the context

@Wadera
Copy link

Wadera commented Nov 3, 2022

Yes, I've keep it default:

That's my full .env configs (where mydomain.tdl is my domain and secrets at cut off for obvious reasons):

root@docker:/opt/standalone# cat .env
LOG_LEVEL=info
NODE_ENV=development
VERSION=local

AUTH_JWT_SECRET=ThI$is$3cr3t

EXPOSED_PORT=3000

DB_HOST=db
DB_REPLICA_HOST=db
DB_PORT=3306
DB_USERNAME=std_notes_user
DB_PASSWORD=changeme123
DB_DATABASE=standard_notes_db
DB_DEBUG_LEVEL=all # "all" | "query" | "schema" | "error" | "warn" | "info" | "log" | "migration"
DB_MIGRATIONS_PATH=dist/migrations/*.js

REDIS_URL=redis://cache

SNS_TOPIC_ARN=
SNS_AWS_REGION=
SQS_QUEUE_URL=
SQS_AWS_REGION=
S3_AWS_REGION=
S3_BACKUP_BUCKET_NAME=

REDIS_EVENTS_CHANNEL=events

AUTH_SERVER_URL=http://auth:3000

EMAIL_ATTACHMENT_MAX_BYTE_SIZE=10485760

REVISIONS_FREQUENCY=300

# (Optional) New Relic Setup
NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME="Syncing Server JS"
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_NO_CONFIG_FILE=true
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
NEW_RELIC_LOG_ENABLED=false
NEW_RELIC_LOG_LEVEL=info

# File upload path (relative to root directory)
FILE_UPLOAD_PATH=data/uploads

# File uploads
VALET_TOKEN_SECRET=ThI$is$3cr3t
EXPOSED_FILES_PORT=3125
# Public-facing URL of the Files server. Endpoint on which clients will access it.
FILES_SERVER_URL=https://notefile.mydomain.tdl
root@docker:/opt/standalone# more docker/*.env
::::::::::::::
docker/api-gateway.env
::::::::::::::
LOG_LEVEL=info
NODE_ENV=production
VERSION=local

NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME="API Gateway"
NEW_RELIC_NO_CONFIG_FILE=true

SYNCING_SERVER_JS_URL=http://syncing-server-js:3000
AUTH_SERVER_URL=http://auth:3000

REDIS_EVENTS_CHANNEL="api-gateway-events"
::::::::::::::
docker/auth.env
::::::::::::::
LOG_LEVEL="info"
NODE_ENV="production"
VERSION="local"

AUTH_JWT_TTL=60000
JWT_SECRET=c21d4fc8SECRETe5b
LEGACY_JWT_SECRET=legacy_jwt_ThI$is$3cr3t

NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME=Auth
NEW_RELIC_NO_CONFIG_FILE=true

REDIS_EVENTS_CHANNEL="auth-events"

DISABLE_USER_REGISTRATION=false

PSEUDO_KEY_PARAMS_KEY=ThI$is$3cr3t_key

ACCESS_TOKEN_AGE=5184000
REFRESH_TOKEN_AGE=31556926

MAX_LOGIN_ATTEMPTS=6
FAILED_LOGIN_LOCKOUT=3600

EPHEMERAL_SESSION_AGE=259200

# Must be a hex string exactly 32 bytes long
# e.g. feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308
ENCRYPTION_SERVER_KEY=ThI$is$3cr3t

SYNCING_SERVER_URL=http://syncing-server-js:3000

# File Uploads
VALET_TOKEN_TTL=7200
::::::::::::::
docker/files.env
::::::::::::::
LOG_LEVEL=info
NODE_ENV=production
VERSION=local

PORT=3000

S3_BUCKET_NAME=
S3_AWS_REGION=
SNS_TOPIC_ARN=
SNS_AWS_REGION=

REDIS_URL=redis://cache
REDIS_EVENTS_CHANNEL=events

MAX_CHUNK_BYTES=100000000

NEW_RELIC_ENABLED=false

@Wadera
Copy link

Wadera commented Nov 3, 2022

I've also tried to rebuild it with a full path like:

FILE_UPLOAD_PATH=/opt/standalone/data/uploads

No luck.

Full console output for upgrade on my host:

root@docker:/opt/standalone# ./server.sh update
Stopping all services.
[+] Running 8/8
 ⠿ Container syncing-server-js-worker-standalone  Killed                                                                                                                            0.9s
 ⠿ Container auth-worker-standalone               Killed                                                                                                                            1.0s
 ⠿ Container api-gateway-standalone               Killed                                                                                                                            1.4s
 ⠿ Container cache-standalone                     Killed                                                                                                                            1.0s
 ⠿ Container db-standalone                        Killed                                                                                                                            1.3s
 ⠿ Container auth-standalone                      Killed                                                                                                                            1.2s
 ⠿ Container syncing-server-js-standalone         Killed                                                                                                                            1.3s
 ⠿ Container files-standalone                     Killed                                                                                                                            1.1s
Pulling changes from Git.
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 17 (delta 11), reused 14 (delta 8), pack-reused 0
Unpacking objects: 100% (17/17), 4.32 KiB | 736.00 KiB/s, done.
From https://github.com/standardnotes/standalone
 * branch            main       -> FETCH_HEAD
   5b507cf..13c5de2  main       -> origin/main
Updating 5b507cf..13c5de2
Fast-forward
 .gitignore                    |  1 +
 docker-compose.yml            | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
 docker/api-gateway.env.sample |  2 ++
 docker/workspace.env.sample   | 10 ++++++++++
 server.sh                     | 12 +++++++++---
 5 files changed, 93 insertions(+), 15 deletions(-)
 create mode 100644 docker/workspace.env.sample
Checking for env file changes
The docker/api-gateway.env file contains different amount of lines than docker/api-gateway.env.sample. This may be caused by the fact that there is a new environment variable to configure. Please update your environment file and try again.
root@docker:/opt/standalone# ./server.sh update
Stopping all services.
unknown flag: --remove-orphans
Pulling changes from Git.
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
From https://github.com/standardnotes/standalone
 * branch            main       -> FETCH_HEAD
Already up to date.
Checking for env file changes
Could not find workspace service environment file. Please run the './server.sh setup' command and try again.
root@docker:/opt/standalone# ./server.sh setup
Initializing default configuration
Default configuration files created as .env and docker/*.env files. Feel free to modify values if needed.
root@docker:/opt/standalone# diff docker/api-gateway.env docker/api-gateway.env.sample 
12a13,14
> 
> WORKSPACE_SERVER_URL=http://workspace:3000
root@docker:/opt/standalone# vim docker/api-gateway.env
root@docker:/opt/standalone# diff docker/api-gateway.env docker/api-gateway.env.sample 
root@docker:/opt/standalone# 
root@docker:/opt/standalone# ./server.sh update
Stopping all services.
unknown flag: --remove-orphans
Pulling changes from Git.
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
From https://github.com/standardnotes/standalone
 * branch            main       -> FETCH_HEAD
Already up to date.
Checking for env file changes
Downloading latest images of Standard Notes services.
[+] Running 40/40
 ⠿ syncing-server-js Pulled                                                                                                                                                        17.8s
   ⠿ 2408cc74d12b Already exists                                                                                                                                                    0.0s
   ⠿ 5b80453a567d Already exists                                                                                                                                                    0.0s
   ⠿ 3420de6432e1 Already exists                                                                                                                                                    0.0s
   ⠿ 65b549a28248 Already exists                                                                                                                                                    0.0s
   ⠿ 37c7761ca3c1 Pull complete                                                                                                                                                     5.8s
   ⠿ 08cba79d194b Pull complete                                                                                                                                                     7.8s
   ⠿ 23fa90d444ba Pull complete                                                                                                                                                     9.7s
   ⠿ a58c3f840a7a Pull complete                                                                                                                                                    13.8s
 ⠿ workspace-worker Pulled                                                                                                                                                         17.6s
 ⠿ files Pulled                                                                                                                                                                    18.4s
   ⠿ 89b391e99628 Pull complete                                                                                                                                                     8.0s
   ⠿ 338bd92a6f14 Pull complete                                                                                                                                                     9.7s
   ⠿ 57751bd39fea Pull complete                                                                                                                                                    11.2s
   ⠿ 29c4400ceeba Pull complete                                                                                                                                                    13.9s
 ⠿ cache Pulled                                                                                                                                                                    12.4s
   ⠿ 213ec9aee27d Already exists                                                                                                                                                    0.0s
   ⠿ fb541f77610a Pull complete                                                                                                                                                     4.6s
   ⠿ dc2e3041aaa5 Pull complete                                                                                                                                                     5.0s
   ⠿ d4b75a8d6475 Pull complete                                                                                                                                                     6.4s
   ⠿ af043c1b682f Pull complete                                                                                                                                                     7.3s
   ⠿ c1bd2cc8b576 Pull complete                                                                                                                                                     8.0s
 ⠿ workspace Pulled                                                                                                                                                                17.6s
   ⠿ 738fd75f4ffb Pull complete                                                                                                                                                     5.6s
   ⠿ 6c9ef9001ba1 Pull complete                                                                                                                                                     7.8s
   ⠿ 43f2100b62d2 Pull complete                                                                                                                                                     9.4s
   ⠿ d40666dce1a2 Pull complete                                                                                                                                                    13.3s
 ⠿ db Pulled                                                                                                                                                                        4.3s
 ⠿ auth-worker Pulled                                                                                                                                                              18.6s
   ⠿ 29eddf4b7214 Pull complete                                                                                                                                                     7.5s
   ⠿ 3910f1f602a4 Pull complete                                                                                                                                                     9.3s
   ⠿ 4078a97f469e Pull complete                                                                                                                                                    10.6s
   ⠿ adc82ac75291 Pull complete                                                                                                                                                    14.2s
 ⠿ auth Pulled                                                                                                                                                                     18.6s
 ⠿ syncing-server-js-worker Pulled                                                                                                                                                 17.8s
 ⠿ api-gateway Pulled                                                                                                                                                              17.3s
   ⠿ 66e2181d533e Pull complete                                                                                                                                                     5.6s
   ⠿ 097a160d4a4a Pull complete                                                                                                                                                     7.9s
   ⠿ 8de2b2f9ad6e Pull complete                                                                                                                                                     9.5s
   ⠿ a950f6a4a07e Pull complete                                                                                                                                                    13.0s
Images up to date. Starting all services.
[+] Running 10/10
 ⠿ Container cache-standalone                     Started                                                                                                                          73.8s
 ⠿ Container files-standalone                     Started                                                                                                                          73.7s
 ⠿ Container db-standalone                        Started                                                                                                                          73.6s
 ⠿ Container syncing-server-js-standalone         Started                                                                                                                          41.8s
 ⠿ Container syncing-server-js-worker-standalone  Started                                                                                                                          32.7s
 ⠿ Container auth-standalone                      Started                                                                                                                          32.8s
 ⠿ Container api-gateway-standalone               Started                                                                                                                          19.7s
 ⠿ Container workspace-standalone                 Started                                                                                                                          19.9s
 ⠿ Container auth-worker-standalone               Started                                                                                                                          19.9s
 ⠿ Container workspace-worker-standalone          Started                                                                                                                          17.4s
Infrastructure started. Give it a moment to warm up. If you wish please run the './server.sh logs' command to see details.

@Wadera
Copy link

Wadera commented Nov 3, 2022

I'm happy to help with further testing.
Discord tag: Wadera#3202
Or on SN Slack: Wadera

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

No branches or pull requests

4 participants