mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-08-31 23:19:36 +00:00
Add rpc pipe path (#326)
* Add rpc pipe path * Add seahub.sh env and change pipe path
This commit is contained in:
@@ -201,6 +201,7 @@ start_seaf_server ()
|
|||||||
"-d", ctl->seafile_dir,
|
"-d", ctl->seafile_dir,
|
||||||
"-l", logfile,
|
"-l", logfile,
|
||||||
"-P", ctl->pidfile[PID_SERVER],
|
"-P", ctl->pidfile[PID_SERVER],
|
||||||
|
"-p", ctl->rpc_pipe_path,
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
int pid = spawn_process (argv);
|
int pid = spawn_process (argv);
|
||||||
@@ -314,6 +315,7 @@ setup_env ()
|
|||||||
g_setenv ("CCNET_CONF_DIR", ctl->config_dir, TRUE);
|
g_setenv ("CCNET_CONF_DIR", ctl->config_dir, TRUE);
|
||||||
g_setenv ("SEAFILE_CONF_DIR", ctl->seafile_dir, TRUE);
|
g_setenv ("SEAFILE_CONF_DIR", ctl->seafile_dir, TRUE);
|
||||||
g_setenv ("SEAFILE_CENTRAL_CONF_DIR", ctl->central_config_dir, TRUE);
|
g_setenv ("SEAFILE_CENTRAL_CONF_DIR", ctl->central_config_dir, TRUE);
|
||||||
|
g_setenv ("SEAFILE_RPC_PIPE_PATH", ctl->rpc_pipe_path, TRUE);
|
||||||
|
|
||||||
char *seahub_dir = g_build_filename (installpath, "seahub", NULL);
|
char *seahub_dir = g_build_filename (installpath, "seahub", NULL);
|
||||||
char *seafdav_conf = g_build_filename (ctl->central_config_dir, "seafdav.conf", NULL);
|
char *seafdav_conf = g_build_filename (ctl->central_config_dir, "seafdav.conf", NULL);
|
||||||
@@ -524,6 +526,7 @@ seaf_controller_init (SeafileController *ctl,
|
|||||||
ctl->central_config_dir = central_config_dir;
|
ctl->central_config_dir = central_config_dir;
|
||||||
ctl->config_dir = config_dir;
|
ctl->config_dir = config_dir;
|
||||||
ctl->seafile_dir = seafile_dir;
|
ctl->seafile_dir = seafile_dir;
|
||||||
|
ctl->rpc_pipe_path = g_build_filename (installpath, "runtime", NULL);
|
||||||
ctl->logdir = logdir;
|
ctl->logdir = logdir;
|
||||||
|
|
||||||
if (read_seafdav_config() < 0) {
|
if (read_seafdav_config() < 0) {
|
||||||
|
@@ -41,6 +41,7 @@ struct _SeafileController {
|
|||||||
char *central_config_dir;
|
char *central_config_dir;
|
||||||
char *config_dir;
|
char *config_dir;
|
||||||
char *seafile_dir;
|
char *seafile_dir;
|
||||||
|
char *rpc_pipe_path;
|
||||||
char *logdir;
|
char *logdir;
|
||||||
|
|
||||||
CcnetClient *client;
|
CcnetClient *client;
|
||||||
|
@@ -31,11 +31,13 @@ def _load_path_from_env(key, check=True):
|
|||||||
CCNET_CONF_PATH = _load_path_from_env('CCNET_CONF_DIR')
|
CCNET_CONF_PATH = _load_path_from_env('CCNET_CONF_DIR')
|
||||||
SEAFILE_CONF_DIR = _load_path_from_env('SEAFILE_CONF_DIR')
|
SEAFILE_CONF_DIR = _load_path_from_env('SEAFILE_CONF_DIR')
|
||||||
SEAFILE_CENTRAL_CONF_DIR = _load_path_from_env('SEAFILE_CENTRAL_CONF_DIR', check=False)
|
SEAFILE_CENTRAL_CONF_DIR = _load_path_from_env('SEAFILE_CENTRAL_CONF_DIR', check=False)
|
||||||
|
SEAFILE_RPC_PIPE_PATH = _load_path_from_env ("SEAFILE_RPC_PIPE_PATH", check=False)
|
||||||
|
|
||||||
ccnet_pipe_path = os.path.join (CCNET_CONF_PATH, 'ccnet-rpc.sock')
|
ccnet_pipe_path = os.path.join (CCNET_CONF_PATH, 'ccnet-rpc.sock')
|
||||||
ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(ccnet_pipe_path)
|
ccnet_threaded_rpc = ccnet.CcnetThreadedRpcClient(ccnet_pipe_path)
|
||||||
|
|
||||||
seafile_pipe_path = os.path.join(SEAFILE_CONF_DIR, 'seafile.sock')
|
seafile_pipe_path = os.path.join(SEAFILE_RPC_PIPE_PATH if SEAFILE_RPC_PIPE_PATH else SEAFILE_CONF_DIR,
|
||||||
|
'seafile.sock')
|
||||||
seafserv_threaded_rpc = seafile.ServerThreadedRpcClient(seafile_pipe_path)
|
seafserv_threaded_rpc = seafile.ServerThreadedRpcClient(seafile_pipe_path)
|
||||||
|
|
||||||
# load ccnet server addr and port from ccnet.conf.
|
# load ccnet server addr and port from ccnet.conf.
|
||||||
|
@@ -18,6 +18,7 @@ TOPDIR=$(dirname "${INSTALLPATH}")
|
|||||||
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
default_ccnet_conf_dir=${TOPDIR}/ccnet
|
||||||
default_seafile_data_dir=${TOPDIR}/seafile-data
|
default_seafile_data_dir=${TOPDIR}/seafile-data
|
||||||
central_config_dir=${TOPDIR}/conf
|
central_config_dir=${TOPDIR}/conf
|
||||||
|
seafile_rpc_pipe_path=${INSTALLPATH}/runtime
|
||||||
|
|
||||||
manage_py=${INSTALLPATH}/seahub/manage.py
|
manage_py=${INSTALLPATH}/seahub/manage.py
|
||||||
gunicorn_conf=${TOPDIR}/conf/gunicorn.conf.py
|
gunicorn_conf=${TOPDIR}/conf/gunicorn.conf.py
|
||||||
@@ -212,6 +213,7 @@ function prepare_env() {
|
|||||||
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
export CCNET_CONF_DIR=${default_ccnet_conf_dir}
|
||||||
export SEAFILE_CONF_DIR=${default_seafile_data_dir}
|
export SEAFILE_CONF_DIR=${default_seafile_data_dir}
|
||||||
export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir}
|
export SEAFILE_CENTRAL_CONF_DIR=${central_config_dir}
|
||||||
|
export SEAFILE_RPC_PIPE_PATH=${seafile_rpc_pipe_path}
|
||||||
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
|
||||||
|
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ SeafileSession *seaf;
|
|||||||
|
|
||||||
char *pidfile = NULL;
|
char *pidfile = NULL;
|
||||||
|
|
||||||
static const char *short_options = "hvc:d:l:fP:D:F:";
|
static const char *short_options = "hvc:d:l:fP:D:F:p:";
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
{ "help", no_argument, NULL, 'h', },
|
{ "help", no_argument, NULL, 'h', },
|
||||||
{ "version", no_argument, NULL, 'v', },
|
{ "version", no_argument, NULL, 'v', },
|
||||||
@@ -38,6 +38,7 @@ static struct option long_options[] = {
|
|||||||
{ "debug", required_argument, NULL, 'D' },
|
{ "debug", required_argument, NULL, 'D' },
|
||||||
{ "foreground", no_argument, NULL, 'f' },
|
{ "foreground", no_argument, NULL, 'f' },
|
||||||
{ "pidfile", required_argument, NULL, 'P' },
|
{ "pidfile", required_argument, NULL, 'P' },
|
||||||
|
{ "rpc-pipe-path", required_argument, NULL, 'p' },
|
||||||
{ NULL, 0, NULL, 0, },
|
{ NULL, 0, NULL, 0, },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,7 +56,8 @@ static void usage ()
|
|||||||
|
|
||||||
#define NAMED_PIPE_SERVER_THREAD_POOL_SIZE 50
|
#define NAMED_PIPE_SERVER_THREAD_POOL_SIZE 50
|
||||||
|
|
||||||
static void start_rpc_service (const char *seafile_dir)
|
static void start_rpc_service (const char *seafile_dir,
|
||||||
|
const char *rpc_pipe_path)
|
||||||
{
|
{
|
||||||
SearpcNamedPipeServer *rpc_server = NULL;
|
SearpcNamedPipeServer *rpc_server = NULL;
|
||||||
char *pipe_path = NULL;
|
char *pipe_path = NULL;
|
||||||
@@ -765,7 +767,11 @@ static void start_rpc_service (const char *seafile_dir)
|
|||||||
"set_server_config_boolean",
|
"set_server_config_boolean",
|
||||||
searpc_signature_int__string_string_int());
|
searpc_signature_int__string_string_int());
|
||||||
|
|
||||||
pipe_path = g_build_path ("/", seafile_dir, SEAFILE_RPC_PIPE_NAME, NULL);
|
if (rpc_pipe_path) {
|
||||||
|
pipe_path = g_build_path ("/", rpc_pipe_path, SEAFILE_RPC_PIPE_NAME, NULL);
|
||||||
|
} else {
|
||||||
|
pipe_path = g_build_path ("/", seafile_dir, SEAFILE_RPC_PIPE_NAME, NULL);
|
||||||
|
}
|
||||||
rpc_server = searpc_create_named_pipe_server_with_threadpool (pipe_path, NAMED_PIPE_SERVER_THREAD_POOL_SIZE);
|
rpc_server = searpc_create_named_pipe_server_with_threadpool (pipe_path, NAMED_PIPE_SERVER_THREAD_POOL_SIZE);
|
||||||
|
|
||||||
g_free(pipe_path);
|
g_free(pipe_path);
|
||||||
@@ -877,6 +883,7 @@ main (int argc, char **argv)
|
|||||||
char *seafile_dir = NULL;
|
char *seafile_dir = NULL;
|
||||||
char *central_config_dir = NULL;
|
char *central_config_dir = NULL;
|
||||||
char *logfile = NULL;
|
char *logfile = NULL;
|
||||||
|
char *rpc_pipe_path = NULL;
|
||||||
const char *debug_str = NULL;
|
const char *debug_str = NULL;
|
||||||
int daemon_mode = 1;
|
int daemon_mode = 1;
|
||||||
|
|
||||||
@@ -915,6 +922,9 @@ main (int argc, char **argv)
|
|||||||
case 'P':
|
case 'P':
|
||||||
pidfile = optarg;
|
pidfile = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
rpc_pipe_path = g_strdup (optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage ();
|
usage ();
|
||||||
exit (1);
|
exit (1);
|
||||||
@@ -973,7 +983,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
event_init ();
|
event_init ();
|
||||||
|
|
||||||
start_rpc_service (seafile_dir);
|
start_rpc_service (seafile_dir, rpc_pipe_path);
|
||||||
|
|
||||||
seaf = seafile_session_new (central_config_dir, seafile_dir, ccnet_dir);
|
seaf = seafile_session_new (central_config_dir, seafile_dir, ccnet_dir);
|
||||||
if (!seaf) {
|
if (!seaf) {
|
||||||
@@ -988,6 +998,7 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
g_free (seafile_dir);
|
g_free (seafile_dir);
|
||||||
g_free (logfile);
|
g_free (logfile);
|
||||||
|
g_free (rpc_pipe_path);
|
||||||
|
|
||||||
set_signal_handlers (seaf);
|
set_signal_handlers (seaf);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user