server
server copied to clipboard
Self-Hosting Error in DB Container
Problem Description: In the process of migrating services from Pi 4 to Pi 5 and I had to start with a fresh new install of Standard Notes. Followed their page's V2 instructions and the db does not seem to fully startup and initialize for some reason.
Troubleshooting Attempted I have tried removing all related volumes and folders several times, switching folders and modifying permissions, etc. with no luck. I would love to console into the container but I cannot while it's restarting and it never finishes unfortunately. I believe the crux of the issue is in the "--initialize specified but the data directory has files in it. Aborting." line but I cannot find anywhere where that flag is present. But the issue could be anything, I am not very confident. Any help is greatly appreciated!
Documentation Error Output:
==> logs/syncing-server.err <==
nc: bad address 'db'
==> logs/files.err <==
nc: bad address 'db'
==> logs/syncing-server.err <==
nc: bad address 'db'
nc: bad address 'db'
==> logs/files.err <==
nc: bad address 'db'
Container Log Output:
2023-12-20 22:22:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.2.0-1.el8 started.
2023-12-20 22:22:49+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-12-20 22:22:49+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.2.0-1.el8 started.
2023-12-20 22:22:50+00:00 [Note] [Entrypoint]: Initializing database files
2023-12-20T22:22:50.163260Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
2023-12-20T22:22:50.164994Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
2023-12-20T22:22:50.165104Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.2.0) initializing of server in progress as process 81
2023-12-20T22:22:50.166985Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2023-12-20T22:22:50.166991Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-12-20T22:22:50.167174Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-12-20T22:22:50.167380Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.2.0) MySQL Community Server - GPL.
2023-12-20T22:22:50.167709Z 0 [System] [MY-015018] [Server] MySQL Server Initialization - end
.env File Input:
######
# DB #
######
DB_HOST=db
DB_PORT=3306
DB_USERNAME=std_notes_user
DB_PASSWORD=4676cb18dfcb075b754783d5
DB_DATABASE=standard_notes_db
DB_TYPE=mysql
#########
# CACHE #
#########
REDIS_PORT=6379
REDIS_HOST=cache
CACHE_TYPE=redis
########
# KEYS #
########
AUTH_JWT_SECRET=219a5454ede149a785b801a6065eabebf0c4ab2d021c8dc9800ee60d24c38dea
AUTH_SERVER_ENCRYPTION_SERVER_KEY=770cd531474884ec18e295fcdd08dfcd026e56b61478b1fb6f71ae0b46c0f600
VALET_TOKEN_SECRET=ab0c0de58282aff01279ab62b19dd857adc68790d635cdcf2e21c0026c63069f
PUBLIC_FILES_SERVER_URL=https://10.0.0.117:3125
Docker-Compose Contents:
services:
server:
image: standardnotes/server
env_file: .env
container_name: server_self_hosted
restart: unless-stopped
ports:
- 2999:3000
- 3125:3104
volumes:
- ./logs:/var/lib/server/logs
- ./uploads:/opt/server/packages/files/dist/uploads
networks:
- standardnotes_self_hosted
localstack:
image: localstack/localstack:3.0
container_name: localstack_self_hosted
expose:
- 4566
restart: unless-stopped
environment:
- SERVICES=sns,sqs
- HOSTNAME_EXTERNAL=localstack
- LS_LOG=warn
volumes:
- ./localstack_bootstrap.sh:/etc/localstack/init/ready.d/localstack_bootstrap.sh
networks:
- standardnotes_self_hosted
db:
image: mysql:8
container_name: db_self_hosted
environment:
- MYSQL_DATABASE=standard_notes_db
- MYSQL_USER=std_notes_user
- MYSQL_ROOT_PASSWORD=4676cb18dfcb075b754783d5
- MYSQL_PASSWORD=4676cb18dfcb075b754783d5
expose:
- 3306
restart: unless-stopped
command: --authentication-policy=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
volumes:
- ./data/mysql:/var/lib/mysql
- ./data/import:/docker-entrypoint-initdb.d
networks:
- standardnotes_self_hosted
cache:
image: redis:6.0-alpine
container_name: cache_self_hosted
volumes:
- ./data/redis/:/data
expose:
- 6379
restart: unless-stopped
networks:
- standardnotes_self_hosted
networks:
standardnotes_self_hosted:
name: standardnotes_self_hosted
Hmm I think it might be the issue where previously you had MySQL 5.6 running and the data written in there was with that engine. Now the engine is 8.x which are not compatible.
If you don't care about any of the data (assuming that this is a fresh install) just remove everything in your data/*
folder for a fresh start.
If you have any data that you wish to preserve I think you might try changing the docker-compose to mysql:5.6 and check if that helps
@karolsojko Unfortunately I have tried removing everything from the ~/standardnotes/data folder several times already. Also, changing the "mysql:8" line in the docker-compose.yml file resulted in a "no matching manifest for linux/arm64/v8 in the manifest list entries" error when trying to pull the docker image.
This is a fresh install, I am completely alright with removing or deleting whatever is necessary since I have backups of my actual notes. I just want SN to run again.
It's not a SN issue per se but a broader scope. It looks like MySQL does not support linux/arm64/v8
architecture.
From what I can see MariaDB is supporting linux/arm64/v8
and should be compatible with MySQL.
You could try to configure it in the docker compose in place of the mysql database.