Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
7e433beb
Commit
7e433beb
authored
5 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Docker image: add support for SYNAPSE_DATA_DIR parameter
Fixes #4830.
parent
c58a6e61
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docker/README.md
+4
-0
4 additions, 0 deletions
docker/README.md
docker/start.py
+13
-4
13 additions, 4 deletions
docker/start.py
with
17 additions
and
4 deletions
docker/README.md
+
4
−
0
View file @
7e433beb
...
...
@@ -186,3 +186,7 @@ The following environment variables are supported in this mode:
*
`SYNAPSE_REPORT_STATS`
(mandatory,
`yes`
or
`no`
): whether to enable
anonymous statistics reporting.
*
`SYNAPSE_CONFIG_PATH`
(mandatory): path to the file to be generated.
*
`SYNAPSE_DATA_DIR`
: where the generated config will put persistent data
such as the datatase and media store. Defaults to
`/data`
.
*
`UID`
,
`GID`
: the user id and group id to use for creating the data
directories. Defaults to
`991`
,
`991`
.
This diff is collapsed.
Click to expand it.
docker/start.py
+
13
−
4
View file @
7e433beb
...
...
@@ -103,11 +103,12 @@ def generate_config_from_template(environ, ownership):
return
config_path
def
run_generate_config
(
environ
):
def
run_generate_config
(
environ
,
ownership
):
"""
Run synapse with a --generate-config param to generate a template config file
Args:
environ (dict): environment dictionary
environ (dict): env var dict
ownership (str):
"
userid:groupid
"
arg for chmod
Never returns.
"""
...
...
@@ -115,6 +116,11 @@ def run_generate_config(environ):
if
v
not
in
environ
:
error
(
"
Environment variable
'
%s
'
is mandatory in `generate` mode.
"
%
(
v
,))
data_dir
=
environ
.
get
(
"
SYNAPSE_DATA_DIR
"
,
"
/data
"
)
# make sure that synapse has perms to write to the data dir.
subprocess
.
check_output
([
"
chown
"
,
ownership
,
data_dir
])
args
=
[
"
python
"
,
"
-m
"
,
...
...
@@ -125,8 +131,11 @@ def run_generate_config(environ):
environ
[
"
SYNAPSE_REPORT_STATS
"
],
"
--config-path
"
,
environ
[
"
SYNAPSE_CONFIG_PATH
"
],
"
--data-directory
"
,
data_dir
,
"
--generate-config
"
,
]
# log("running %s" % (args, ))
os
.
execv
(
"
/usr/local/bin/python
"
,
args
)
...
...
@@ -134,9 +143,9 @@ def main(args, environ):
mode
=
args
[
1
]
if
len
(
args
)
>
1
else
None
ownership
=
"
{}:{}
"
.
format
(
environ
.
get
(
"
UID
"
,
991
),
environ
.
get
(
"
GID
"
,
991
))
# In generate mode, generate a configuration
,
missing keys, then exit
# In generate mode, generate a configuration
and
missing keys, then exit
if
mode
==
"
generate
"
:
return
run_generate_config
(
environ
)
return
run_generate_config
(
environ
,
ownership
)
# In normal mode, generate missing keys if any, then run synapse
if
"
SYNAPSE_CONFIG_PATH
"
in
environ
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment