1
0

fix: 更新数据库配置设置

This commit is contained in:
TsMask
2025-05-21 14:23:58 +08:00
parent 2f5031cbd4
commit e279b75c49
5 changed files with 14 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
#!/bin/bash
set -xe
# Check if Docker is installed
if command -v docker &> /dev/null; then
echo $(docker --version)
@@ -134,7 +134,6 @@ docker_build() {
# tar package
output=${ReleaseDir}/${ReleaseFileName}.tar.gz
tar -czf ${output} ./${ReleaseFileName}
echo "tar output ${output}"
# Generate MD5 file
rm -f omc_md5sum.txt
@@ -156,3 +155,4 @@ docker_build
# bash build-docker.sh --version 2.2505.2 --platform amd64 --system ubuntu22.04
# bash build-docker.sh --version 2.2505.2 --platform amd64 --system alpine3.20

View File

@@ -76,13 +76,11 @@ EXPOSE 80 443 33030 33443 33033 33034 33060
CMD [ "/usr/local/etc/omc/script/entrypoint.sh" ]
# build 546 MB
# build 707MB
# docker docker build --platform linux/amd64 --build-arg TARGETARCH=amd64 --build-arg VERSION=2.2505.2 -t omc:r2.2505.2-ubuntu22.04-amd64 .
# service ssh start && service nginx start && /usr/local/bin/omc --env prod -c /usr/local/etc/omc/omc.yaml
# docker run -it omc:2.2505.2-ubuntu22.04-amd64 /bin/bash
# docker run --network omcnet -it omc:2.2505.2-ubuntu22.04-amd64 /bin/bash
# docker run --privileged=true --restart=always -m 512M -e M_PARAM=lite --name omc_2.2505.2 -d omc:2.2505.2-ubuntu22.04-amd64
# docker run --privileged=true --restart=always -m 512M \
# -e TZ=Asia/Shanghai \
# -e M_PARAM=lite \
@@ -91,5 +89,3 @@ CMD [ "/usr/local/etc/omc/script/entrypoint.sh" ]
# --network omcnet \
# --name omc \
# -d omc:2.2505.2-ubuntu22.04-amd64
# docker rm -f omc_2.2505.2
# docker run -it omc_2.2505.2 bash

View File

@@ -1,5 +1,4 @@
#!/bin/bash
# shellcheck disable=SC1091
set -o errexit
@@ -12,15 +11,17 @@ set -o pipefail
# We add the copy from default config in the entrypoint to not break users
# case someone mounts a configuration file in /usr/local/etc/omc/default)
cp -nr "$BASE_DIR"/default/. "$BASE_DIR"
cp -n $BASE_DIR/default/omc.conf $BASE_DIR/omc.conf
cp -n $BASE_DIR/default/omc.yaml $BASE_DIR/omc.yaml
# cp -n $BASE_DIR/default/sshsvc.yaml $BASE_DIR/sshsvc.yaml
# Initialize OMC DB
if [ ! -f /usr/local/etc/omc/machine.ini ]; then
bash /usr/local/etc/omc/script/setup.sh -i -r -m $M_PARAM -c $C_PARAM
fi
# Start Nginx server
nginx -g "daemon off;"
# Start Nginx server | -s stop
nginx
# Parse CLI flags to pass to the 'omc' call
args=("--config" "${BASE_DIR}/omc.yaml")
@@ -30,5 +31,5 @@ read -r -a extra_flags <<< "$CMD_EXTRA_FLAGS"
# Add flags passed to this script
args+=("$@")
omc --version
exec omc "${args[@]}"
# Run omc
omc "${args[@]}"

View File

@@ -23,9 +23,9 @@ cp $BASE_DIR/default/omc.yaml $BASE_DIR/omc.yaml
sed -i "s/port: 33030/port: $API_HTTP_PORT/" "$BASE_DIR"/omc.yaml
sed -i "s/port: 33443/port: $API_HTTPS_PORT/" "$BASE_DIR"/omc.yaml
sed -i '/webServer:/,/-/s/^\( *enabled:\) true/\1 false/' "$BASE_DIR"/omc.yaml
sed -i '/type: "mysql"/,/-/s/^\( *host:\) "127.0.0.1"/\1 "omc_mariadb"/' "$BASE_DIR"/omc.yaml
sed -i 's/host: "127.0.0.1"$/host: "omc_mariadb"/' "$BASE_DIR"/omc.yaml
sed -i 's/port: 33066/port: 3306/' "$BASE_DIR"/omc.yaml
sed -i '/port: 6379 # Redis port/ {n; s/host: "127.0.0.1"/host: "omc_keydb"/}' "$BASE_DIR"/omc.yaml
sed -i 's/host: "127.0.0.1" # Redis host$/host: "omc_keydb" # Redis host/' "$BASE_DIR"/omc.yaml
# Nginx config
sed -i 's/# gzip_/gzip_/' /etc/nginx/nginx.conf

View File

@@ -31,9 +31,8 @@ install(){
echo "Container name ($OMC_CONTAINER_NAME):"
read OMC_CONTAINER_NAME
OMC_CONTAINER_NAME=${OMC_CONTAINER_NAME:-"omc"}
echo "==> Checking Docker version $OMC_CONTAINER_NAME"
sed -i "s/^OMC_CONTAINER_NAME=.*/OMC_CONTAINER_NAME=\"$OMC_CONTAINER_NAME\"/" ./omc-docker.sh
echo "===================== Install container omc service ====================="
echo "===================== Start ====================="
echo "==> Checking Docker version"
if sudo docker -v > /dev/null 2>&1; then