同步操作将从 answerdev/answer 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Before installing Answer, you need to install the base environment first.
You can then install Answer in several ways:
$ mkdir answer && cd answer
$ wget https://raw.githubusercontent.com/answerdev/answer/main/docker-compose.yaml
$ docker-compose up
In browser, open URL http://127.0.0.1:9080/.
You can log in with the default administrator username (admin@admin.com
) and password (admin
).
Visit Docker Hub or GitHub Container registry to see all available images and tags.
To persist data beyond the life of a Docker container, use a volume (/var/data -> /data). You can modify this based on your situation.
# Pull image from Docker Hub.
$ docker pull answerdev/answer:latest
# Create local directory for volume.
$ mkdir -p /var/data
# Run the image first
$ docker run --name=answer -p 9080:80 -v /var/data:/data answerdev/answer
# After successful first startup, a configuration file will be generated in the /var/data directory
# /var/data/conf/config.yaml
# Need to modify the Mysql database address in the configuration file
vim /var/data/conf/config.yaml
# Modify database connection
# connection: [username]:[password]@tcp([host]:[port])/[DbName]
...
# After configuring the configuration file, you can start the container again to start the service
$ docker start answer
cd
to enter the directory you just created./answer init
./data
directory in the current directorydata
directory and modify the config.yaml
fileconnection: [username]:[password]@tcp([host]:[port])/[DbName]
cd ..
to return the directory from step 2, and execute ./answer run -c ./data/conf/config.yaml
Usage: answer [command]
help
: Help about any commandinit
: Init answer applicationrun
: Run answer applicationcheck
: Check answer required environmentdump
: Backup answer dataHere is a sample/default config.yaml file, as would be created from answer init
.
server:
http:
addr: 0.0.0.0:80 #Project access port number
data:
database:
connection: root:root@tcp(127.0.0.1:3306)/answer #MySQL database connection address
cache:
file_path: "/tmp/cache/cache.db" #Cache file storage path
i18n:
bundle_dir: "/data/i18n" #Internationalized file storage directory
swaggerui:
show: true #Whether to display the swaggerapi documentation, address /swagger/index.html
protocol: http #swagger protocol header
host: 127.0.0.1 #An accessible IP address or domain name
address: ':80' #accessible port number
service_config:
secret_key: "answer" #encryption key
web_host: "http://127.0.0.1" #Page access using domain name address
upload_path: "./upfiles" #upload directory
If you have modified the source files and want to repackage the image, you can use the following to repackage the image
docker build -t answer:v1.0.0 .
config.yaml
, as well as the internationalization translation directory (i18n
), and the upload file storage directory (upfiles
). Ensure that the configuration file is loaded when the project starts, such as when using answer run -c config.yaml
and that the config.yaml
correctly specifies the i18n and upfiles directories.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。