mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: some issues with "small" docker improvements (#12564)
* fix: support previous FORCE_BUILD_BEFORE_START variable too * fix: attempt to fix permission issues and inform properly on failure * fix: profile-gate redis and re-add profile-gated postgres to main file For now it's better to maintain compatibility - current postgres users will run mongodb unnecessarily withuot changes, but at least it'll still work fine
This commit is contained in:
@@ -30,6 +30,8 @@ services:
|
|||||||
# command: ["redis-server", "--save", "60", "1", "--loglevel", "warning"] # uncomment if you want to use snapshotting instead of AOF
|
# command: ["redis-server", "--save", "60", "1", "--loglevel", "warning"] # uncomment if you want to use snapshotting instead of AOF
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data
|
- redis-data:/data
|
||||||
|
profiles:
|
||||||
|
- redis
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
|
|||||||
@@ -33,6 +33,20 @@ services:
|
|||||||
# command: ['redis-server', '--save', '60', '1', '--loglevel', 'warning'] # uncomment if you want to use snapshotting instead of AOF
|
# command: ['redis-server', '--save', '60', '1', '--loglevel', 'warning'] # uncomment if you want to use snapshotting instead of AOF
|
||||||
volumes:
|
volumes:
|
||||||
- redis-data:/data
|
- redis-data:/data
|
||||||
|
profiles:
|
||||||
|
- redis
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:16.1-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: nodebb
|
||||||
|
POSTGRES_PASSWORD: nodebb
|
||||||
|
POSTGRES_DB: nodebb
|
||||||
|
volumes:
|
||||||
|
- postgres-data:/var/lib/postgresql/data
|
||||||
|
profiles:
|
||||||
|
- postgres
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
mongo-data:
|
mongo-data:
|
||||||
@@ -49,6 +63,13 @@ volumes:
|
|||||||
type: none
|
type: none
|
||||||
device: ./.docker/database/redis
|
device: ./.docker/database/redis
|
||||||
|
|
||||||
|
postgres-data:
|
||||||
|
driver: local
|
||||||
|
driver_opts:
|
||||||
|
o: bind
|
||||||
|
type: none
|
||||||
|
device: ./.docker/database/postgresql/data
|
||||||
|
|
||||||
nodebb-build:
|
nodebb-build:
|
||||||
driver: local
|
driver: local
|
||||||
driver_opts:
|
driver_opts:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ set_defaults() {
|
|||||||
export CONFIG_DIR="${CONFIG_DIR:-/opt/config}"
|
export CONFIG_DIR="${CONFIG_DIR:-/opt/config}"
|
||||||
export CONFIG="$CONFIG_DIR/config.json"
|
export CONFIG="$CONFIG_DIR/config.json"
|
||||||
export NODEBB_INIT_VERB="${NODEBB_INIT_VERB:-install}"
|
export NODEBB_INIT_VERB="${NODEBB_INIT_VERB:-install}"
|
||||||
export START_BUILD="${START_BUILD:-false}"
|
export START_BUILD="${START_BUILD:-${FORCE_BUILD_BEFORE_START:-false}}"
|
||||||
export SETUP="${SETUP:-}"
|
export SETUP="${SETUP:-}"
|
||||||
export PACKAGE_MANAGER="${PACKAGE_MANAGER:-npm}"
|
export PACKAGE_MANAGER="${PACKAGE_MANAGER:-npm}"
|
||||||
export OVERRIDE_UPDATE_LOCK="${OVERRIDE_UPDATE_LOCK:-false}"
|
export OVERRIDE_UPDATE_LOCK="${OVERRIDE_UPDATE_LOCK:-false}"
|
||||||
@@ -24,8 +24,13 @@ check_directory() {
|
|||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
if [ ! -w "$dir" ]; then
|
if [ ! -w "$dir" ]; then
|
||||||
echo "Error: No write permission for directory $dir"
|
echo "Warning: No write permission for directory $dir, attempting to fix..."
|
||||||
exit 1
|
chown -R $USER:$USER "$dir" || true # attempt to change ownership, do not exit on failure
|
||||||
|
chmod -R 760 "$dir" || true # attempt to change permissions, do not exit on failure
|
||||||
|
if [ ! -w "$dir" ]; then
|
||||||
|
echo "Error: No write permission for directory $dir. Exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user