Merge pull request #44 from ONLYOFFICE/feature/mount-var-lib
Feature/mount var lib
This commit is contained in:
commit
be8d335063
|
@ -41,6 +41,6 @@ RUN echo "$REPO_URL" | tee /etc/apt/sources.list.d/onlyoffice.list && \
|
|||
rm -rf /var/log/onlyoffice && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /usr/share/fonts/truetype/custom
|
||||
VOLUME /etc/onlyoffice /var/log/onlyoffice /var/lib/onlyoffice /var/www/onlyoffice/Data /var/lib/postgresql /usr/share/fonts/truetype/custom
|
||||
|
||||
CMD bash -C '/app/onlyoffice/run-document-server.sh';'bash'
|
||||
|
|
|
@ -40,9 +40,9 @@ Integrating it with ONLYOFFICE Community Server you will be able to:
|
|||
|
||||
* **RAM**: 4 GB or more
|
||||
* **CPU**: dual-core 2 GHz or higher
|
||||
* **Swap file**: at least 2 GB
|
||||
* **Swap**: at least 2 GB
|
||||
* **HDD**: at least 2 GB of free space
|
||||
* **Distributive**: 64-bit Red Hat, CentOS or other compatible distributive with kernel version 3.8 or later, 64-bit Debian, Ubuntu or other compatible distributive with kernel version 3.8 or later
|
||||
* **Distribution**: 64-bit Red Hat, CentOS or other compatible distributive with kernel version 3.8 or later, 64-bit Debian, Ubuntu or other compatible distributive with kernel version 3.8 or later
|
||||
* **Docker**: version 1.9.0 or later
|
||||
|
||||
## Running Docker Image
|
||||
|
|
|
@ -33,6 +33,11 @@ JSON="json -q -f ${ONLYOFFICE_DEFAULT_CONFIG}"
|
|||
|
||||
LOCAL_SERVICES=()
|
||||
|
||||
PG_VERSION=9.3
|
||||
PG_NAME=main
|
||||
PGDATA=/var/lib/postgresql/${PG_VERSION}/${PG_NAME}
|
||||
PG_NEW_CLUSTER=false
|
||||
|
||||
read_setting(){
|
||||
POSTGRESQL_SERVER_HOST=${POSTGRESQL_SERVER_HOST:-$(${JSON} services.CoAuthoring.sql.dbHost)}
|
||||
POSTGRESQL_SERVER_PORT=${POSTGRESQL_SERVER_PORT:-$(${JSON} services.CoAuthoring.sql.dbPort)}
|
||||
|
@ -127,7 +132,24 @@ update_redis_settings(){
|
|||
${JSON} -I -e "this.services.CoAuthoring.redis.port = '${REDIS_SERVER_PORT}'"
|
||||
}
|
||||
|
||||
create_postgresql_cluster(){
|
||||
local pg_conf_dir=/etc/postgresql/${PG_VERSION}/${PG_NAME}
|
||||
local postgresql_conf=$pg_conf_dir/postgresql.conf
|
||||
local hba_conf=$pg_conf_dir/pg_hba.conf
|
||||
|
||||
mv $postgresql_conf $postgresql_conf.backup
|
||||
mv $hba_conf $hba_conf.backup
|
||||
|
||||
pg_createcluster ${PG_VERSION} ${PG_NAME}
|
||||
}
|
||||
|
||||
create_postgresql_db(){
|
||||
sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
|
||||
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
|
||||
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
|
||||
}
|
||||
|
||||
create_postgresql_tbl(){
|
||||
CONNECTION_PARAMS="-h${POSTGRESQL_SERVER_HOST} -U${POSTGRESQL_SERVER_USER} -w"
|
||||
if [ -n "${POSTGRESQL_SERVER_PASS}" ]; then
|
||||
export PGPASSWORD=${POSTGRESQL_SERVER_PASS}
|
||||
|
@ -209,8 +231,12 @@ if [ ${ONLYOFFICE_DATA_CONTAINER_HOST} = "localhost" ]; then
|
|||
if [ ${POSTGRESQL_SERVER_HOST} != "localhost" ]; then
|
||||
update_postgresql_settings
|
||||
waiting_for_postgresql
|
||||
create_postgresql_db
|
||||
create_postgresql_tbl
|
||||
else
|
||||
if [ ! -d ${PGDATA} ]; then
|
||||
create_postgresql_cluster
|
||||
PG_NEW_CLUSTER=true
|
||||
fi
|
||||
LOCAL_SERVICES+=("postgresql")
|
||||
fi
|
||||
|
||||
|
@ -239,6 +265,10 @@ for i in ${LOCAL_SERVICES[@]}; do
|
|||
service $i start
|
||||
done
|
||||
|
||||
if [ ${PG_NEW_CLUSTER} = "true" ]; then
|
||||
create_postgresql_tbl
|
||||
fi
|
||||
|
||||
if [ ${ONLYOFFICE_DATA_CONTAINER} != "true" ]; then
|
||||
waiting_for_postgresql
|
||||
waiting_for_rabbitmq
|
||||
|
|
Loading…
Reference in a new issue