The ops project
Tool¤
After installation of devapps
you have the ops project
command available1. The tool allows to install and
maintain projects and resources.
Project¤
To use the tool, first activate your environment via poetry shell
in case of a development installation (virtual
environ activation in case of a pip(x) based install).
Verification:
$ poetry debug info
[1mPoetry
[0m[34m[49mVersion[39m: [32m1.1.15
[34mPython[39m: [32m3.7.12
[1m[39mVirtualenv
[0m[34m[49mPython[39m: [32m3.7.12
[34mImplementation[39m: [32mCPython
[34mPath[39m: [32m/home/runner/miniconda3/envs/devapps_py3.7
[34mValid[39m: [32mTrue
[1m[39mSystem
[0m[34m[49mPlatform[39m: [32mlinux
[34mOS[39m: [32mposix
[34mPython[39m: [32m/home/runner/miniconda3/envs/devapps_py3.7
[39m
Let's now create a (new) directory for the project:
$ mkdir $HOME/myproject && cd $HOME/myproject && ls -lta
total 8
drwxr-xr-x 2 runner docker 4096 Jul 25 16:06 .
drwxr-x--- 17 runner docker 4096 Jul 25 16:06 ..
Resources¤
devapps
(and derived packages) contain resource defining python modules named resources.py
.
Resources of devapps
¤
Here are the resources defined in devapps
. They are required for running the tests but also provide some tools:
$ ops project --list_resources_files
$ ops project --list_resources_files
[2m[38;5;5m07-25 16:06:21[0m[39m[49m [[38;5;2minfo [39m] Directories [[38;5;5mproject[39m] [1m[32mconda_prefix[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3[0m[39m[49m [1m[32mfs_dir[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3/fs(default)
[0;2m[38;5;5m[49m07-25 16:06:21[0m[39m[49m [[38;5;2minfo [39m] Listing Defined Resources [[38;5;5mproject[39m]
[2m[38;5;5m07-25 16:06:21[0m[39m[49m [[38;5;2minfo [39m] details [[38;5;5mproject[39m] [1m[32mjson[0m[39m[49m=[
[90m [39m{
[90m [94m"bin_name"[39m:[90m [33m"lc_tools"[39m,
[90m [94m"conda_chan"[39m:[90m [33m"conda-forge"[39m,
[90m [94m"conda_pkg"[39m:[90m [33m"git fzf jq ripgrep fd-find httpie htop tmux"[39m,
[90m [94m"disabled"[39m:[90m [94mfalse[39m,
[90m [94m"doc"[39m:[90m [33m""[39m,
[90m [94m"host_conf_dir"[39m:[90m [33m"$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools"[39m,
[90m [94m"installed"[39m:[90m [94mtrue[39m,
[90m [94m"module"[39m:[90m [33m"devapp"[39m,
[90m [94m"module_dir"[39m:[90m [33m"/home/runner/work/devapps/devapps/src/devapp"[39m,
[90m [94m"name"[39m:[90m [33m"lc_tools"[39m,
[90m [94m"path"[39m:[90m [33m"/home/runner/miniconda3/envs/lc_tools/bin"[39m,
[90m [94m"provides"[39m:[90m [39m[
[90m [33m"git"[39m,
[90m [33m"fzf"[39m,
[90m [33m"jq"[39m,
[90m [33m"rg"[39m,
[90m [33m"fd"[39m,
[90m [33m"http"[39m,
[90m [33m"htop"[39m,
[90m [33m"tmux"
[90m [39m],
[90m [94m"run"[39m:[90m [33m"lc_tools"[39m,
[90m [94m"verify_present"[39m:[90m [33m"verify_tools"
[90m [39m},
[90m [39m{
[90m [94m"bin_name"[39m:[90m [33m"lc_tools_kf"[39m,
[90m [94m"conda_chan"[39m:[90m [33m"kalefranz"[39m,
[90m [94m"conda_pkg"[39m:[90m [33m"httpd"[39m,
[90m [94m"disabled"[39m:[90m [94mfalse[39m,
[90m [94m"doc"[39m:[90m [33m""[39m,
[90m [94m"host_conf_dir"[39m:[90m [33m"$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools_kf"[39m,
[90m [94m"installed"[39m:[90m [94mtrue[39m,
[90m [94m"module"[39m:[90m [33m"devapp"[39m,
[90m [94m"module_dir"[39m:[90m [33m"/home/runner/work/devapps/devapps/src/devapp"[39m,
[90m [94m"name"[39m:[90m [33m"lc_tools_kf"[39m,
[90m [94m"path"[39m:[90m [33m"/home/runner/miniconda3/envs/lc_tools_kf/bin"[39m,
[90m [94m"provides"[39m:[90m [39m[
[90m [33m"rotatelogs"
[90m [39m],
[90m [94m"verify_present"[39m:[90m [33m"verify_tools"
[90m [39m},
[90m [39m{
[90m [94m"bin_name"[39m:[90m [33m"redis_server"[39m,
[90m [94m"cmd"[39m:[90m [33m"redis-server"[39m,
[90m [94m"disabled"[39m:[90m [94mfalse[39m,
[90m [94m"doc"[39m:[90m [33m""[39m,
[90m [94m"host_conf_dir"[39m:[90m [33m"$PROJECT_ROOT/conf/${host:-$HOSTNAME}/redis_server"[39m,
[90m [94m"installed"[39m:[90m [94mtrue[39m,
[90m [94m"module"[39m:[90m [33m"devapp"[39m,
[90m [94m"module_dir"[39m:[90m [33m"/home/runner/work/devapps/devapps/src/devapp"[39m,
[90m [94m"name"[39m:[90m [33m"redis_server"[39m,
[90m [94m"path"[39m:[90m [33m"/home/runner/miniconda3/envs/redis_server/bin"[39m,
[90m [94m"pkg"[39m:[90m [33m"redis-server"[39m,
[90m [94m"port"[39m:[90m [94m6379[39m,
[90m [94m"provides"[39m:[90m [39m[
[90m [33m"redis-server"[39m,
[90m [33m"redis-cli"
[90m [39m],
[90m [94m"run"[39m:[90m [33m"redis_server"[39m,
[90m [94m"systemd"[39m:[90m [33m"redis-server"
[90m [39m}
]
[
[90m [33m" i lc_tools ['git', 'fzf', 'jq', 'rg', 'fd', 'http', 'htop', 'tmux']"[39m,
[90m [33m" i lc_tools_kf ['rotatelogs']"[39m,
[90m [33m"s i redis-server ['redis-server', 'redis-cli']"
[39m]
More Tools
devapps
based applications usually define more, e.g. databases, more tools or log targets.
Batteries Included - but Replaceable
DevApps' resource management is only meant as a convenience machinery to quickly get up projects or dev setups up and running. In production you'll have more distributed setups anyway, installed e.g. via Ansible and/or Container Orchestrators.
Means: You do not need to have those resources managed as shown below - we install "normal" versions, packaged as Conda packages and use standard config options (see previous chapter why).
Project Init¤
Via the --init_at
flag you set up a new project, within the given directory, plus its resources:
$ ops project --init_at . --port_offset 2000 --force
$ tree -L 2
$ ops project --init_at . --port_offset 2000 --force
[2m[38;5;5m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] chdir [[38;5;5mproject[39m] [1m[32margs[0m[39m[49m=[1m[38;5;11m/home/runner/myproject[0m[39m[49m [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] Directories [[38;5;5mproject[39m] [1m[32mconda_prefix[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3[0m[39m[49m [1m[32mfs_dir[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3/fs(default)
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[1m[38;5;124mwarning [0m[39m[49m] Installing resources [[38;5;5mproject[39m] [1m[32mresources[0m[39m[49m=[1m[38;5;11m[{'bin_name': 'lc_tools', 'conda_chan': 'conda-forge', 'conda_pkg': 'git fzf jq ripgrep fd-find httpie htop tmux', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'lc_tools', 'path': '/home/runner/miniconda3/envs/lc_tools/bin', 'provides': ['git', 'fzf', 'jq', 'rg', 'fd', 'http', 'htop', 'tmux'], 'run': 'lc_tools', 'verify_present': 'verify_tools'}, {'bin_name': 'lc_tools_kf', 'conda_chan': 'kalefranz', 'conda_pkg': 'httpd', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools_kf', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'lc_tools_kf', 'path': '/home/runner/miniconda3/envs/lc_tools_kf/bin', 'provides': ['rotatelogs'], 'verify_present': 'verify_tools'}, {'bin_name': 'redis_server', 'cmd': 'redis-server', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/redis_server', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'redis_server', 'path': '/home/runner/miniconda3/envs/redis_server/bin', 'pkg': 'redis-server', 'port': 6379, 'provides': ['redis-server', 'redis-cli'], 'run': 'redis_server', 'systemd': 'redis-server'}]
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] create_project_dirs [[38;5;5mproject[39m] [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/bin
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/data
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/log
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/work
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/conf
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/tmp
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] creating [[38;5;5mproject[39m] [1m[32mdir[0m[39m[49m=[1m[38;5;11m/home/runner/myproject/build
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] chdir [[38;5;5mproject[39m] [1m[32margs[0m[39m[49m=[1m[38;5;11m/home/runner/myproject[0m[39m[49m [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:22[0m[39m[49m [[38;5;2minfo [39m] git_init [[38;5;5mproject[39m] [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0m[39m[49m-ne
[38;5;240mbin/git: line 34: MC: command not found
[33mhint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: [39m [33mgit config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: [39m [33mgit branch -m <name>
[39mInitialized empty Git repository in /home/runner/myproject/.git/
-ne
$ tree -L 2
.
├── bin
│ ├── fd
│ ├── fzf
│ ├── git
│ ├── htop
│ ├── http
│ ├── jq
│ ├── redis-cli
│ ├── redis-server
│ ├── rg
│ ├── rotatelogs
│ └── tmux
├── build
├── conf
├── data
├── log
├── tmp
│ └── tmux
└── work
9 directories, 11 files
As you can see, we created start files in the bin
subdirectory of the project directory, pointing to where the actual binaries
had been installed. We did set a global port_offset
, which affects any port of listening resources started.
Controlling Resources Installation
There are few options regarding which resources are to be installed, where.
See the output of the -h
regarding this:
$ ops p -h
$ ops p -h
[1m[38;5;11mCreating A Project With Resources
────────────────────────────────────────────────────────────────────────────────
[0m[39m[49mThis plugin is helper for creating a project directory, incl. required local
resources. Your system remains unchanged, except <project_dir> and
<conda_prefix>.
It provides an [38;5;5minstall[39m action (implicitely by providing the
--init_resource_match or --init_at switch)
Default action is: [38;5;5mlist[39m (show installable resources, -m <match> filters).
At install we will (re-)initialize a "project_dir", at location given with
--init_at (default: '.'), incl:
[38;5;5m❖ [39mInstalling available resources, like databases and tools within a given
directory (conda_prefix)
[38;5;5m❖ [39mCreating resource start wrappers in <project_dir>/bin
[38;5;5m❖ [39mGenerating default config when required
[38;5;5m❖ [39mOptionally generating systemd unit files (e.g. via: --init_create_all_units)
[38;5;5m❖ [39mInstances support: export <name>_instances=x before running and you'll get x
systemd units created, for startable commands.
[38;5;5m Example: export client_instances=10; ops p -irm client -icau
(Name of a resource: ops p [-m <match>])
❖ [39mAny other parametrization: Via environ variables Check key environ vars in
list output and also doc text.
Privilege escalation is not required for any of these steps.
Main command line flags [matching [1m[32mops_devapp.project[0m[39m[49m]:
[32mappc [1m[33madd_post_process_cmd [0m[31m[49m''
[38;5;245mAdd this to all commands which have systemd service units. Intended for output redirection. Not applied when stdout is a tty.
Example: -appc='2>&1 | rotatelogs -e -n1 "$logfile" 1M' ($logfile defined in wrapper -> use single quotes).
Tip: Use rotatelogs only on powers of 10 - spotted problems with 200M. Use 100M or 1G in that case.
[32mcp [1m[33mconda_prefix [0m[31m[49m/home/runner/miniconda3
[38;5;245m Resources install location, except filesystem based ones. Env vars resolved.
Aliases:
- local|l: <project_dir>/conda
- default|d: $HOME/miniconda3 (default path of conda)
- current|c: Any current conda_prefix set when running.
Note: Installing resources outside the project keeps the project relocatable and resources reusable for other products.
[32mdamsu [1m[33mdelete_all_matching_service_unit_files [0m[31m[49m''
[38;5;245mThis removes all matching unit files calling devapp service wrappers. Say "service" to match all
[32mdi [1m[33mdev_install [0m[31m[49mFalse
[38;5;245mSet the project up in developer mode - incl. make and poetry file machinery
[32memrf [1m[33medit_matching_resource_file [0m[31m[49m''
[38;5;245mOpen resource files in $EDITOR, matching given string in their content
[32mf [1m[33mforce [0m[31m[49mFalse
[38;5;245mAssume y on all questions. Required when started w/o a tty
[32mfr [1m[33mforce_reinstall [0m[31m[49mFalse
[38;5;245mDo not only install resources detected uninstalled but reinstall all
[32mfd [1m[33mfs_dir [0m[31m[49mdefault
[38;5;245m Filesystem based resource location. Env vars resolved.
Aliases:
- local|l: <project_dir>/fs
- default|d: $HOME/miniconda3/fs (default path of conda)
- conda|c: Within conda_prefix/fs
[32mia [1m[33minit_at [0m[31m[49m''
[38;5;245mSet up project in given directory. env vars / relative dirs supported. Sets install action implicitly
[32micau [1m[33minit_create_all_units [0m[31m[49mFalse
[38;5;245mIf set we create unit files for ALL service type resources
[32micuf [1m[33minit_create_unit_files [0m[31m[49m''
[38;5;245mList service unit files you want to have created for systemctl --user.
[38;5;241mValid: Entries in rsc.provides, rsc.cmd or rsc.exe (i.e. the filename of the wrapper in bin dir). Not: rsc.name.
[32mirm [1m[33minit_resource_match [0m[31m[49m''
[38;5;245mLike resource match but implies install action
[32mi [1m[33minstall [0m[33m[49mACTION
[38;5;245mInstall
[32mis [1m[33minstall_state [0m[31m[49mFalse
[38;5;245mshow install state infos
[32ml [1m[33mlist ACTION*
[0m[38;5;245m[49mShow available definition files.
[32mlrf [1m[33mlist_resources_files [0m[33m[49mACTION
[38;5;245mAlias for list action
[32m [1m[33mlog_resources_fully [0m[31m[49mFalse
[38;5;245mAlways output all settings of resources when logging
[32mm [1m[33mresource_match [0m[31m[49m''
[38;5;245mProvide a match string for actions. Examples: -irm "redis, hub" or -irm '!mysql, !redis' (! negates).
[32ms [1m[33msystem [0m[31m[49m''
[38;5;245mSet to a server for system mode API (e.g. lc hub(s))
[36m-hf [match string][39m: List [1m[36mALL[0m[39m[49m (matching) flags. E.g. -hf or -hf log.
More CLI flags
More control flags are only accessible via --helpfull <match>
(-hf
):
Try ops p -hf log_level
, ops p -hf port
(...)
Project initialization flags
In the example above, a --port_offset=2000
flag was given, determining the start parameters written into the redis wrapper:
$ bin/redis-server
bin/redis-server: line 35: MC: command not found
4103:C 25 Jul 2023 16:06:25.162 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4103:C 25 Jul 2023 16:06:25.162 # Redis version=7.0.12, bits=64, commit=22906652, modified=1, pid=4103, just started
4103:C 25 Jul 2023 16:06:25.162 # Configuration loaded
4103:M 25 Jul 2023 16:06:25.163 * monotonic clock: POSIX clock_gettime
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 7.0.12 (22906652/1) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 8379
| `-._ `._ / _.-' | PID: 4103
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
4103:M 25 Jul 2023 16:06:25.163 # Server initialized
4103:M 25 Jul 2023 16:06:25.163 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
4103:M 25 Jul 2023 16:06:25.164 # WARNING You have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled (set to 'madvise' or 'never').
4103:M 25 Jul 2023 16:06:25.164 * Ready to accept connections
Idempotency
If you need to re-parametrize the project (e.g. set different port offsets) then run ops project --init_at
again
and have new start wrappers created.
Unit Files¤
We do not try to manage the live cycle of services but leave that to systemd (available on all Linux major distributions).
The --init_create_unit_files=<name of daemon resource>
will create a unit file after installing the resource itself:
Creating a resource incl. unit file
$ ops project --init_at=. --init_create_unit_files=redis-server --force
$ ops project --init_at=. --init_create_unit_files=redis-server --force
[2m[38;5;5m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] chdir [[38;5;5mproject[39m] [1m[32margs[0m[39m[49m=[1m[38;5;11m/home/runner/myproject[0m[39m[49m [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] Directories [[38;5;5mproject[39m] [1m[32mconda_prefix[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3[0m[39m[49m [1m[32mfs_dir[0m[39m[49m=[1m[38;5;11m/home/runner/miniconda3/fs(default)
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] verify_systemctl_availability [[38;5;5mproject[39m] [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0m[39m[49msystemctl is /usr/bin/systemctl
[2m[38;5;5m07-25 16:06:26[0m[39m[49m [[1m[38;5;124mwarning [0m[39m[49m] Installing resources [[38;5;5mproject[39m] [1m[32mresources[0m[39m[49m=[1m[38;5;11m[{'bin_name': 'lc_tools', 'conda_chan': 'conda-forge', 'conda_pkg': 'git fzf jq ripgrep fd-find httpie htop tmux', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'lc_tools', 'path': '/home/runner/miniconda3/envs/lc_tools/bin', 'provides': ['git', 'fzf', 'jq', 'rg', 'fd', 'http', 'htop', 'tmux'], 'run': 'lc_tools', 'verify_present': 'verify_tools'}, {'bin_name': 'lc_tools_kf', 'conda_chan': 'kalefranz', 'conda_pkg': 'httpd', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/lc_tools_kf', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'lc_tools_kf', 'path': '/home/runner/miniconda3/envs/lc_tools_kf/bin', 'provides': ['rotatelogs'], 'verify_present': 'verify_tools'}, {'bin_name': 'redis_server', 'cmd': 'redis-server', 'disabled': False, 'doc': '', 'host_conf_dir': '$PROJECT_ROOT/conf/${host:-$HOSTNAME}/redis_server', 'installed': True, 'module': 'devapp', 'module_dir': '/home/runner/work/devapps/devapps/src/devapp', 'name': 'redis_server', 'path': '/home/runner/miniconda3/envs/redis_server/bin', 'pkg': 'redis-server', 'port': 6379, 'provides': ['redis-server', 'redis-cli'], 'run': 'redis_server', 'systemd': 'redis-server'}]
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] create_project_dirs [[38;5;5mproject[39m] [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] chdir [[38;5;5mproject[39m] [1m[32margs[0m[39m[49m=[1m[38;5;11m/home/runner/myproject[0m[39m[49m [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] have written unit file [[38;5;5mproject[39m] [1m[32mfn[0m[39m[49m=[1m[38;5;11m/home/runner/.config/systemd/user/redis-server-myproject.service
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] have written unit file [[38;5;5mproject[39m] [1m[32mfn[0m[39m[49m=[1m[38;5;11m/home/runner/.config/systemd/user/redis-server-myproject.service
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] git_init [[38;5;5mproject[39m] [1m[32mstore_log[0m[39m[49m=[1m[38;5;11mNone
[0;2m[38;5;5m[49m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] All project file created. [[38;5;5mproject[39m]
[2m[38;5;5m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] Enabling systemd user service units. [[38;5;5mproject[39m]
[2m[38;5;5m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] systemd --user available, calling daemon-reload [[38;5;5mproject[39m]
[2m[38;5;5m07-25 16:06:26[0m[39m[49m [[38;5;2minfo [39m] Done init. [[38;5;5mproject[39m]
You control the service using systemctl --user
:
$ systemctl --user --no-pager start redis-server-myproject
$ systemctl --user --no-pager status redis-server-myproject
$ systemctl --user --no-pager stop redis-server-myproject
$ systemctl --user --no-pager start redis-server-myproject
$ systemctl --user --no-pager status redis-server-myproject
[1m[32m●[0m[39m[49m redis-server-myproject.service - redis-server myproject redis-server
Loaded: loaded (/home/runner/.config/systemd/user/redis-server-myproject.service; disabled; vendor preset: enabled)
Active: [1m[32mactive (running)[0m[39m[49m since Tue 2023-07-25 16:06:26 UTC; 36ms ago
Main PID: 4150 (bash)
Tasks: 6 (limit: 8307)
Memory: 7.9M
CPU: 9ms
CGroup: /user.slice/user-1001.slice/user@1001.service/app.slice/redis-server-myproject.service
├─4150 bash /home/runner/myproject/bin/redis-server
└─4152 "redis-server *:6379" "" "" "" "" ""
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2…79.
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2…zed
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:26.4…
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:26.4…
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2….12
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2…nds
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2… Mb
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2… 0.
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2…nds
Jul 25 16:06:26 fv-az1030-910 redis-server[4152]: 4152:M 25 Jul 2023 16:06:2…ons
Hint: Some lines were ellipsized, use -l to show in full.
$ systemctl --user --no-pager stop redis-server-myproject
Hint
In order to install unit files for ALL service type resources, you can supply --init_create_all_units
, alternatively.