mirror of https://gitee.com/answerdev/answer.git
feat: update all default config file path to absolute path
This commit is contained in:
parent
eafddedce6
commit
731fc63690
|
@ -21,7 +21,6 @@ WORKDIR ${BUILD_DIR}
|
|||
COPY --from=node-builder /tmp/build ${BUILD_DIR}/ui/build
|
||||
RUN make clean build && \
|
||||
cp answer /usr/bin/answer && \
|
||||
mkdir -p /tmp/cache && chmod 777 /tmp/cache && \
|
||||
mkdir -p /data/conf && chmod 777 /data/conf && cp configs/config.yaml /data/conf/config.yaml && \
|
||||
mkdir -p /data/upfiles && chmod 777 /data/upfiles && \
|
||||
mkdir -p /data/i18n && chmod 777 /data/i18n && cp -r i18n/*.yaml /data/i18n
|
||||
|
@ -34,7 +33,8 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.li
|
|||
&& apt -y update \
|
||||
&& apt -y upgrade \
|
||||
&& apt -y install ca-certificates openssl tzdata curl netcat dumb-init \
|
||||
&& apt -y autoremove
|
||||
&& apt -y autoremove \
|
||||
&& mkdir -p /tmp/cache
|
||||
|
||||
COPY --from=golang-builder /data /data
|
||||
VOLUME /data
|
||||
|
|
|
@ -27,9 +27,9 @@ $ mkdir -p /var/data
|
|||
$ docker run --name=answer -p 9080:80 -v /var/data:/data answer/answer
|
||||
|
||||
# After the first startup, a configuration file will be generated in the /var/data directory
|
||||
# /var/data/config.yaml
|
||||
# /var/data/conf/config.yaml
|
||||
# Need to modify the Mysql database address in the configuration file
|
||||
vim /var/data/config.yaml
|
||||
vim /var/data/conf/config.yaml
|
||||
|
||||
# Modify database connection
|
||||
# connection: [username]:[password]@tcp([host]:[port])/[DbName]
|
||||
|
@ -51,7 +51,7 @@ $ docker start answer
|
|||
6. Modify the database connection address to your database connection address
|
||||
|
||||
connection: [username]:[password]@tcp([host]:[port])/[DbName]
|
||||
7. Exit the data directory and execute ./answer run -c ./data/config.yaml
|
||||
7. Exit the data directory and execute ./answer run -c ./data/conf/config.yaml
|
||||
|
||||
## config.yaml Description
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ $ mkdir -p /var/data
|
|||
$ docker run --name=answer -p 9080:80 -v /var/data:/data answer/answer
|
||||
|
||||
# 第一次启动后会在/var/data 目录下生成配置文件
|
||||
# /var/data/config.yaml
|
||||
π# /var/data/conf/config.yaml
|
||||
# 需要修改配置文件中的Mysql 数据库地址
|
||||
vim /var/data/config.yaml
|
||||
vim /var/data/conf/config.yaml
|
||||
|
||||
# 修改数据库连接 connection: [username]:[password]@tcp([host]:[port])/[DbName]
|
||||
...
|
||||
|
@ -50,7 +50,7 @@ $ docker start answer
|
|||
6. 将数据库连接地址修改为你的数据库连接地址
|
||||
|
||||
connection: [username]:[password]@tcp([host]:[port])/[DbName]
|
||||
7. 退出data 目录 执行 ./answer run -c ./data/config.yaml
|
||||
7. 退出data 目录 执行 ./answer run -c ./data/conf/config.yaml
|
||||
|
||||
## 配置文件 config.yaml 参数说明
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ services:
|
|||
condition: service_healthy
|
||||
links:
|
||||
- db
|
||||
volumes:
|
||||
- answer-data:/data
|
||||
db:
|
||||
image: mariadb:10.4.7
|
||||
ports:
|
||||
|
@ -22,3 +24,5 @@ services:
|
|||
test: [ "CMD", "mysqladmin" ,"ping", "-uroot", "-proot"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
volumes:
|
||||
answer-data:
|
||||
|
|
|
@ -15,9 +15,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
defaultConfigFilePath = "data/config.yaml"
|
||||
defaultUploadFilePath = "data/upfiles"
|
||||
defaultI18nPath = "data/i18n"
|
||||
defaultConfigFilePath = "/data/conf/config.yaml"
|
||||
defaultUploadFilePath = "/data/upfiles"
|
||||
defaultI18nPath = "/data/i18n"
|
||||
)
|
||||
|
||||
// InstallAllInitialEnvironment install all initial environment
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
if [ ! -f "/data/config.yaml" ]; then
|
||||
if [ ! -f "/data/conf/config.yaml" ]; then
|
||||
/usr/bin/answer init
|
||||
fi
|
||||
/usr/bin/answer run -c /data/conf/config.yaml
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git clone https://git.backyard.segmentfault.com/opensource/pacman.git /tmp/sf-pacman
|
||||
|
||||
cat <<'EOF' > go.work
|
||||
go 1.18
|
||||
|
||||
use (
|
||||
.
|
||||
/tmp/sf-pacman
|
||||
/tmp/sf-pacman/contrib/cache/redis
|
||||
/tmp/sf-pacman/contrib/cache/memory
|
||||
/tmp/sf-pacman/contrib/conf/viper
|
||||
/tmp/sf-pacman/contrib/log/zap
|
||||
/tmp/sf-pacman/contrib/i18n
|
||||
/tmp/sf-pacman/contrib/server/http
|
||||
)
|
||||
EOF
|
||||
|
||||
go work sync
|
Loading…
Reference in New Issue