Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
e9021e16
Commit
e9021e16
authored
7 years ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Run the server as an unprivileged user
parent
f72c9c1f
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
Dockerfile
+1
-1
1 addition, 1 deletion
Dockerfile
contrib/docker/start.py
+7
-4
7 additions, 4 deletions
contrib/docker/start.py
with
8 additions
and
5 deletions
Dockerfile
+
1
−
1
View file @
e9021e16
FROM
python:2-alpine
RUN
apk add
--no-cache
--virtual
.nacl_deps build-base libffi-dev zlib-dev openssl-dev libjpeg-turbo-dev linux-headers postgresql-dev
RUN
apk add
--no-cache
--virtual
.nacl_deps
su-exec
build-base libffi-dev zlib-dev openssl-dev libjpeg-turbo-dev linux-headers postgresql-dev
COPY
. /synapse
...
...
This diff is collapsed.
Click to expand it.
contrib/docker/start.py
+
7
−
4
View file @
e9021e16
...
...
@@ -9,14 +9,16 @@ convert = lambda src, dst, environ: open(dst, "w").write(jinja2.Template(open(sr
mode
=
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
>
1
else
None
environ
=
os
.
environ
.
copy
()
# Check mandatory parameters and build the base start arguments
if
"
SYNAPSE_SERVER_NAME
"
not
in
environ
:
print
(
"
Environment variable SYNAPSE_SERVER_NAME is mandatory, exiting.
"
)
sys
.
exit
(
2
)
permissions
=
"
{}:{}
"
.
format
(
environ
.
get
(
"
UID
"
,
991
),
environ
.
get
(
"
GID
"
,
991
))
args
=
[
"
python
"
,
"
-m
"
,
"
synapse.app.homeserver
"
,
"
--server-name
"
,
os
.
environ
.
get
(
"
SYNAPSE_SERVER_NAME
"
),
"
--report-stats
"
,
os
.
environ
.
get
(
"
SYNAPSE_REPORT_STATS
"
,
"
no
"
),
"
--config-path
"
,
os
.
environ
.
get
(
"
SYNAPSE_CONFIG_PATH
"
,
"
/compiled/homeserver.yaml
"
)]
"
--server-name
"
,
environ
.
get
(
"
SYNAPSE_SERVER_NAME
"
),
"
--report-stats
"
,
environ
.
get
(
"
SYNAPSE_REPORT_STATS
"
,
"
no
"
),
"
--config-path
"
,
environ
.
get
(
"
SYNAPSE_CONFIG_PATH
"
,
"
/compiled/homeserver.yaml
"
)]
# Generate any missing shared secret
for
secret
in
(
"
SYNAPSE_REGISTRATION_SHARED_SECRET
"
,
"
SYNAPSE_MACAROON_SECRET_KEY
"
):
...
...
@@ -35,4 +37,5 @@ if mode == "generate":
# In normal mode, generate missing keys if any, then run synapse
else
:
subprocess
.
check_output
(
args
+
[
"
--generate-keys
"
])
os
.
execv
(
"
/usr/local/bin/python
"
,
args
)
subprocess
.
check_output
([
"
chown
"
,
"
-R
"
,
permissions
,
"
/data
"
])
os
.
execv
(
"
/sbin/su-exec
"
,
[
"
su-exec
"
,
permissions
]
+
args
)
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