Commit 63b9c4ea authored by D's avatar D Committed by GitHub

Merge pull request #12430 from tomaer/2.8.0-dev

🐳 Fix #12426
parents 5b713f67 5ca09ed3
FROM maven:3 FROM maven:3
MAINTAINER Liang Ding <d@b3log.org> LABEL maintainer="Tomaer Ma<i@tomaer.com>"
ADD . /solo WORKDIR /opt/b3log/solo
WORKDIR /solo ADD . /tmp
RUN mvn install
WORKDIR /solo/target/solo RUN cd /tmp && mvn install && mv target/solo/* /opt/b3log/solo/ \
&& mkdir -p /opt/b3log/backup/ && mkdir -p /opt/b3log/tmp/ \
&& rm -rf /opt/b3log/solo/WEB-INF/classes/local.properties /opt/b3log/solo/WEB-INF/classes/mail.properties /opt/b3log/solo/WEB-INF/classes/latke.properties \
&& rm -rf /tmp/* && rm -rf ~/.m2
ADD ./src/main/resources/docker/entrypoint.sh $WORKDIR
ADD ./src/main/resources/docker/local.properties.h2 /opt/b3log/tmp
ADD ./src/main/resources/docker/local.properties.mysql /opt/b3log/tmp
ADD ./src/main/resources/docker/mail.properties /opt/b3log/tmp
ADD ./src/main/resources/docker/latke.properties /opt/b3log/tmp
RUN chmod 777 /opt/b3log/solo/entrypoint.sh
VOLUME ["/opt/b3log/backup/"]
EXPOSE 8080 EXPOSE 8080
CMD ["/bin/sh", "-c", "java -cp WEB-INF/lib/*:WEB-INF/classes org.b3log.solo.Starter"] ENTRYPOINT [ "/opt/b3log/solo/entrypoint.sh" ]
\ No newline at end of file
...@@ -71,6 +71,29 @@ After the JDK environment is ready, [download](https://pan.baidu.com/s/1dzk7SU) ...@@ -71,6 +71,29 @@ After the JDK environment is ready, [download](https://pan.baidu.com/s/1dzk7SU)
* Windows: `java -cp "WEB-INF/lib/*;WEB-INF/classes" org.b3log.solo.Starter` * Windows: `java -cp "WEB-INF/lib/*;WEB-INF/classes" org.b3log.solo.Starter`
* Unix-like: `java -cp "WEB-INF/lib/*:WEB-INF/classes" org.b3log.solo.Starter` * Unix-like: `java -cp "WEB-INF/lib/*:WEB-INF/classes" org.b3log.solo.Starter`
Run with docker?
`docker volume create solo_datas && docker run --privileged --name solo --restart=unless-stopped -p 8080:8080 -v solo_datas:/opt/b3log/backup/ -d 88250/solo`
Recommend using mysql, if you used h2, database will auto save in docker volume, you can backup plugins & skins same as docker volume, Restore through backup after upgrade
`docker exec -it solo cp -r /opt/b3log/solo/plugins /opt/b3log/backup/ && docker exec -it solo cp -r /opt/b3log/solo/skins /opt/b3log/backup/`
| Environment | Description | Optional Value | Default Value |
| :------------- | :------------- | :------------- | :------------- |
| DATABASE_TYPE | Database Type, H2 or MySQL | h2, mysql | h2 |
| DATABASE_HOST | Database Server host or ip,Only for MySQL | | localhost |
| DATABASE_PORT | Database Port,Only for MySQL | | 3306 |
| DATABASE_NAME | Database Name,Only for MySQL | | solo |
| DATABASE_USERNAME | Database Username,Only for MySQL | | root |
| DATABASE_PASSWORD | Database Password,Only for MySQL | | |
| SERVER_SCHMEA | Server schema | https,http | http |
| SERVER_NAME | Server Name or Domain Name | | localhost |
| EMAIL_ADDRESS | Email Address | | |
| EMAIL_PASSWORD | Email Password | | |
| SMTP_HOST | SMTP Server Host | | smtp.gmail.com |
| SMTP_PROT | SMTP Server Port | | 587 |
| SMTP_SOCKETFACTORY_PORT | SMTP Socket Factory Port | | 465 |
**See the [Solo User Guide](https://hacpai.com/article/1492881378588) for more details. In addition, if you want to use Solo but do not want to maintain the server yourself, you can purchase our built Solo and [use it directly](https://b3log.org/services/#solo).** **See the [Solo User Guide](https://hacpai.com/article/1492881378588) for more details. In addition, if you want to use Solo but do not want to maintain the server yourself, you can purchase our built Solo and [use it directly](https://b3log.org/services/#solo).**
## Documents ## Documents
......
...@@ -71,6 +71,28 @@ JDK 环境准备好之后[下载](https://pan.baidu.com/s/1dzk7SU)最新的 Solo ...@@ -71,6 +71,28 @@ JDK 环境准备好之后[下载](https://pan.baidu.com/s/1dzk7SU)最新的 Solo
* Windows: `java -cp "WEB-INF/lib/*;WEB-INF/classes" org.b3log.solo.Starter` * Windows: `java -cp "WEB-INF/lib/*;WEB-INF/classes" org.b3log.solo.Starter`
* Unix-like: `java -cp "WEB-INF/lib/*:WEB-INF/classes" org.b3log.solo.Starter` * Unix-like: `java -cp "WEB-INF/lib/*:WEB-INF/classes" org.b3log.solo.Starter`
`Docker`运行 ?
`docker volume create solo_datas && docker run --privileged --name solo --restart=unless-stopped -p 8080:8080 -v solo_datas:/opt/b3log/backup/ -d 88250/solo`
推荐使用mysql,如果你使用h2,数据库将会自动保存在`docker卷`中, 你可以将你的 plugins & skins 同样备份到`docker卷`中.升级之后通过备份还原
`docker exec -it solo cp -r /opt/b3log/solo/plugins /opt/b3log/backup/ && docker exec -it solo cp -r /opt/b3log/solo/skins /opt/b3log/backup/`
| 环境变量 | 描述 | 可选值 | 默认值 |
| :------------- | :------------- | :------------- | :------------- |
| DATABASE_TYPE | 数据库类型, H2 或 MySQL | h2, mysql | h2 |
| DATABASE_HOST | 数据库地址或IP,针对MySQL | | localhost |
| DATABASE_PORT | 数据库端口,针对MySQL |   | 3306 |
| DATABASE_NAME | 数据库名称,针对MySQL |   | solo |
| DATABASE_USERNAME | 数据库用户名,针对MySQL |   | root |
| DATABASE_PASSWORD | 数据库密码,针对MySQL |   |   |
| SERVER_SCHMEA | Server schema | https,http | http |
| SERVER_NAME | 服务器名称或域名 |   | localhost |
| EMAIL_ADDRESS | 电子邮件地址 |   |   |
| EMAIL_PASSWORD | 电子邮件密码 |   |   |
| SMTP_HOST | SMTP 服务器地址 |   | smtp.gmail.com |
| SMTP_PROT | SMTP 服务器端口 |   | 587 |
| SMTP_SOCKETFACTORY_PORT | SMTP Socket Factory Port | | 465 |
**更多细节请参考 [Solo 用户指南](https://hacpai.com/article/1492881378588)。另外,如果你想用 Solo 但又不想自己维护服务器,可以购买我们搭建好的 Solo 直接[使用](https://b3log.org/services/#solo)。** **更多细节请参考 [Solo 用户指南](https://hacpai.com/article/1492881378588)。另外,如果你想用 Solo 但又不想自己维护服务器,可以购买我们搭建好的 Solo 直接[使用](https://b3log.org/services/#solo)。**
## 文档 ## 文档
...@@ -142,3 +164,4 @@ Solo 的诞生离不开以下开源项目: ...@@ -142,3 +164,4 @@ Solo 的诞生离不开以下开源项目:
<br><br> <br><br>
<img src="https://cloud.githubusercontent.com/assets/873584/26024667/c031e40a-3808-11e7-9176-f2c9af01bd64.png"> <img src="https://cloud.githubusercontent.com/assets/873584/26024667/c031e40a-3808-11e7-9176-f2c9af01bd64.png">
</p> </p>
...@@ -246,6 +246,7 @@ ...@@ -246,6 +246,7 @@
<excludes> <excludes>
<exclude>etc/</exclude> <exclude>etc/</exclude>
<exclude>lib/</exclude> <exclude>lib/</exclude>
<exclude>docker/</exclude>
</excludes> </excludes>
</resource> </resource>
</resources> </resources>
......
#!/bin/bash
## author: tomaer.Ma <i@tomaer.com>
DATEBASE_TYPE=${DATEBASE_TYPE:-h2}
if [ ! -f "/opt/b3log/solo/WEB-INF/classes/local.properties" ]; then
if [ "$DATEBASE_TYPE" == "mysql" ]; then
cat /otp/b3log/tmp/local.properties.mysql | sed \
-e "s|{{DATABASE_HOST}}|${DATABASE_HOST}|g" \
-e "s|{{DATABASE_PORT}}|${DATABASE_PORT:-3306}|g" \
-e "s|{{DATABASE_NAME}}|${DATABASE_NAME:-solo}|g" \
-e "s|{{DATABASE_USERNAME}}|${DATABASE_USERNAME:-root}|g" \
-e "s|{{DATABASE_PASSWORD}}|${DATABASE_PASSWORD}|g" \
> /opt/b3log/solo/WEB-INF/classes/local.properties
else
cp /opt/b3log/tmp/local.properties.h2 /opt/b3log/solo/WEB-INF/classes/local.properties
fi
cat /opt/b3log/tmp/latke.properties | sed \
-e "s|{{SERVER_SCHMEA}}|${SERVER_SCHMEA:-http}|g" \
-e "s|{{SERVER_NAME}}|${SERVER_NAME:-localhost}|g" \
> /opt/b3log/solo/WEB-INF/classes/latke.properties
cat /opt/b3log/tmp/mail.properties | sed \
-e "s|{{EMAIL_ADDRESS}}|${EMAIL_ADDRESS}|g" \
-e "s|{{EMAIL_PASSWORD}}|${EMAIL_PASSWORD}|g" \
-e "s|{{SMTP_HOST}}|${SMTP_HOST:-smtp.gmail.com}|g" \
-e "s|{{SMTP_PROT}}|${SMTP_PROT:-587}|g" \
-e "s|{{SMTP_SOCKETFACTORY_PORT}}|${SMTP_SOCKETFACTORY_PORT:-465}|g" \
> /opt/b3log/solo/WEB-INF/classes/mail.properties
rm -rf /opt/b3log/tmp
fi
java -cp WEB-INF/lib/*:WEB-INF/classes org.b3log.solo.Starter
#
# Copyright (c) 2010-2018, b3log.org & hacpai.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: B3log Latke configurations. Configures the section "Server" carefully.
# Version: 1.5.3.9, Aug 11, 2017
# Author: Liang Ding
#
#### Server ####
# Browser visit protocol
serverScheme={{SERVER_SCHMEA}}
# Browser visit domain name
serverHost={{SERVER_NAME}}
# Browser visit port, 80 as usual, THIS IS NOT SERVER LISTEN PORT!
serverPort=8080
#### Cookie ####
cookieName=solo
cookieSecret=Beyond
#### Runtime Mode ####
### runtimeMode=DEVELOPMENT
runtimeMode=PRODUCTION
#
# Copyright (c) 2010-2018, b3log.org & hacpai.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: Solo local environment configurations for test.
# Version: 1.1.3.9, Sep 13, 2016
# Author: Liang Ding
#
#### H2 runtime ####
runtimeDatabase=H2
jdbc.username=root
jdbc.password=
jdbc.driver=org.h2.Driver
jdbc.URL=jdbc:h2:/opt/b3log/backup/solo_h2/db
jdbc.pool=h2
#### MySQL runtime ####
# runtimeDatabase=MYSQL
# jdbc.username={{DATABASE_USERNAME}}
# jdbc.password={{DATABASE_PASSWORD}}
# jdbc.driver=com.mysql.jdbc.Driver
# jdbc.URL=jdbc:mysql://{{DATABASE_HOST}}:{{DATABASE_PORT}}/{{DATABASE_NAME}}?useUnicode=yes&characterEncoding=utf8
# jdbc.pool=druid
# The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt=5
jdbc.maxConnCnt=10
# Be care to change the transaction isolation
jdbc.transactionIsolation=REPEATABLE_READ
# The specific table name prefix
jdbc.tablePrefix=b3_solo
#
# Copyright (c) 2010-2018, b3log.org & hacpai.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: Solo local environment configurations for test.
# Version: 1.1.3.9, Sep 13, 2016
# Author: Liang Ding
#
#### H2 runtime ####
# runtimeDatabase=H2
# jdbc.username=root
# jdbc.password=
# jdbc.driver=org.h2.Driver
# jdbc.URL=jdbc:h2:~/solo_h2/db
# jdbc.pool=h2
#### MySQL runtime ####
runtimeDatabase=MYSQL
jdbc.username={{DATABASE_USERNAME}}
jdbc.password={{DATABASE_PASSWORD}}
jdbc.driver=com.mysql.jdbc.Driver
jdbc.URL=jdbc:mysql://{{DATABASE_HOST}}:{{DATABASE_PORT}}/{{DATABASE_NAME}}?useUnicode=yes&characterEncoding=utf8
jdbc.pool=druid
# The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt=5
jdbc.maxConnCnt=10
# Be care to change the transaction isolation
jdbc.transactionIsolation=REPEATABLE_READ
# The specific table name prefix
jdbc.tablePrefix=b3_solo
#
# Copyright (c) 2010-2018, b3log.org & hacpai.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Description: Solo mail configurations.
# Version: 1.0.0.4, Jul 19, 2017
# Author: Liang Ding
#
mail.user={{EMAIL_ADDRESS}}
mail.password={{EMAIL_PASSWORD}}
mail.debug=false
mail.smtp.host={{SMTP_HOST}}
mail.smtp.port={{SMTP_PROT}}
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback=false
mail.smtp.socketFactory.port={{SMTP_SOCKETFACTORY_PORT}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment