Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Ship Cat container manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wizards
Ship Cat container manager
Commits
606570f3
Commit
606570f3
authored
1 year ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Implement env_path
parent
77bd0bfa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
etc/container.toml.example
+4
-0
4 additions, 0 deletions
etc/container.toml.example
shipcat/config.py
+8
-1
8 additions, 1 deletion
shipcat/config.py
shipcat/main.py
+17
-14
17 additions, 14 deletions
shipcat/main.py
with
29 additions
and
15 deletions
etc/container.toml.example
+
4
−
0
View file @
606570f3
...
...
@@ -19,3 +19,7 @@ create_on_start = false
# Extra options passed to "podman create" (default=none)
podman_create_options = []
# Environment file (relative to root_dir, default=none)
# Contains lines of format "KEY=VALUE"
# env_file = "environment"
This diff is collapsed.
Click to expand it.
shipcat/config.py
+
8
−
1
View file @
606570f3
...
...
@@ -6,7 +6,7 @@ from grp import getgrnam
from
pathlib
import
Path
import
re
import
tomllib
from
typing
import
Set
,
List
from
typing
import
Set
,
List
,
Optional
from
.json_walker
import
Walker
,
WalkerError
...
...
@@ -62,6 +62,7 @@ class ContainerConfig:
create_on_start
:
bool
global_config
:
GlobalConfig
podman_create_options
:
List
[
str
]
env_path
:
Optional
[
Path
]
# Automatically generated
pid_file
:
str
...
...
@@ -125,6 +126,12 @@ class ContainerConfig:
self
.
create_on_start
=
w
[
'
create_on_start
'
].
as_bool
(
self
.
global_config
.
default_create_on_start
)
self
.
podman_create_options
=
[
o
.
as_str
()
for
o
in
w
[
'
podman_create_options
'
].
default_to
([]).
array_values
()]
env_file
=
w
[
'
env_file
'
].
as_optional_str
()
if
env_file
is
None
:
self
.
env_path
=
None
else
:
self
.
env_path
=
self
.
root_path
/
env_file
self
.
pid_file
=
f
'
/run/shc/
{
self
.
name
}
.pid
'
self
.
user_name
=
self
.
name
self
.
service_name
=
f
'
shc@
{
self
.
name
}
.service
'
This diff is collapsed.
Click to expand it.
shipcat/main.py
+
17
−
14
View file @
606570f3
...
...
@@ -220,8 +220,7 @@ def create_container(cc: ContainerConfig) -> None:
[
'
podman
'
,
'
rm
'
,
'
-if
'
,
cc
.
name
]
)
run_command
(
[
cmd
=
[
'
podman
'
,
'
create
'
,
'
--name
'
,
cc
.
name
,
'
--conmon-pidfile
'
,
cc
.
pid_file
,
...
...
@@ -232,8 +231,12 @@ def create_container(cc: ContainerConfig) -> None:
'
--ip
'
,
ip
,
'
--subuidname
'
,
cc
.
user_name
,
'
--subgidname
'
,
cc
.
user_name
,
]
+
cc
.
podman_create_options
+
[
cc
.
image
]
)
]
if
cc
.
env_path
is
not
None
:
cmd
.
extend
([
'
--env-file
'
,
str
(
cc
.
env_path
)])
cmd
.
extend
(
cc
.
podman_create_options
)
cmd
.
append
(
cc
.
image
)
run_command
(
cmd
)
def
cmd_start
(
args
:
argparse
.
Namespace
)
->
None
:
...
...
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