-- ---------------------------- -- Table structure for doc_changes -- ---------------------------- CREATE TABLE IF NOTEXISTS "public"."doc_changes" ( "id" varchar(255) COLLATE "default" NOT NULL, "change_id" int4 NOT NULL, "user_id" varchar(255) COLLATE "default" NOT NULL, "user_id_original" varchar(255) COLLATE "default" NOT NULL, "user_name" varchar(255) COLLATE "default" NOT NULL, "change_data" text COLLATE "default" NOT NULL, "change_date" timestampwithouttime zone NOT NULL, PRIMARY KEY ("id", "change_id") ) WITH (OIDS=FALSE);
-- ---------------------------- -- Table structure for task_result -- ---------------------------- CREATE TABLE IF NOTEXISTS "public"."task_result" ( "id" varchar(255) COLLATE "default" NOT NULL, "status" int2 NOT NULL, "status_info" int4 NOT NULL, "last_open_date" timestampwithouttime zone NOT NULL, "user_index" int4 NOT NULLDEFAULT1, "change_id" int4 NOT NULLDEFAULT0, "callback" text COLLATE "default" NOT NULL, "baseurl" text COLLATE "default" NOT NULL, PRIMARY KEY ("id") ) WITH (OIDS=FALSE);
CREATEOR REPLACE FUNCTION merge_db(_id varchar(255), _status int2, _status_info int4, _last_open_date timestampwithouttime zone, _user_index int4, _change_id int4, _callback text, _baseurl text, OUT isupdate char(5), OUT userindex int4) AS $$ DECLARE t_var "public"."task_result"."user_index"%TYPE; BEGIN LOOP -- first try to update the key -- note that "a" must be unique UPDATE "public"."task_result" SET last_open_date=_last_open_date, user_index=user_index+1WHERE id = _id RETURNING user_index into userindex; IF found THEN isupdate :='true'; RETURN; END IF; -- not there, so try to insert the key -- if someone else inserts the same key concurrently, -- we could get a unique-key failure BEGIN INSERT INTO "public"."task_result"(id, status, status_info, last_open_date, user_index, change_id, callback, baseurl) VALUES(_id, _status, _status_info, _last_open_date, _user_index, _change_id, _callback, _baseurl) RETURNING user_index into userindex; isupdate :='false'; RETURN; EXCEPTION WHEN unique_violation THEN -- do nothing, and loop to try the UPDATE again END; END LOOP; END; $$ LANGUAGE plpgsql;
ONLYOFFICE_DATA_CONTAINER_HOST上面都是符合条件就是localhost, 此时进else的话就是执行到行316行函数waiting_for_datacontainer just wait for remote data 此时执行函数read_setting 看了下默认的80端口是nginx占据的,此处应该是webserver
上面如果是localhost就会在容器里启动pgsql,rabbitmq,redis
然后下面这段代码
1 2 3 4
if [ ${PG_NEW_CLUSTER} = "true" ]; then create_postgresql_db create_postgresql_tbl fi
如果PG是初始化的(也就是前面的一开始不存在目录PGDATA)
1 2 3 4 5
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;" }
Software requirements For Debian, Ubuntu and derivatives OS 64-bit Debian, Ubuntu or other compatible distribution with kernel version 3.13 or later Additional Requirements PostgreSQL: version 9.1 or later NGINX: version 1.3.13 or later Node.js: version 8.12.0 or later libstdc++6: version 4.8.4 or later Redis RabbitMQ For RHEL, CentOS and derivatives OS RHEL 7 or CentOS 7 Additional Requirements PostgreSQL: version 9.1 or later NGINX: version 1.3.13 or later Node.js: version 8.12.0 or later Redis RabbitMQ