English | 简体中文
A CLI tool for managing Sub-Store backend service. Because of this tool based on docker, you should install docker first.
You can install this tool by running the following command:
curl -sSL https://sub-store-org.github.io/resource/ssm/install.sh | bash
Or you can download release binary and configure your environment variable manually.
If you are using a script installation, you can directly execute the following commands. However, if you are doing a manual installation, please make sure to modify the program name in each command to match the executable file name.
Create a new sub-store docker container and run it. If the Image does not exist, it will be build automatically.
ssm new
this command support the following flags:
-
--interface
or-i
: When you use the-i
flag, a sub-store front-end container is created instead of a backend container. The default behavior is to create a backend container. -
--name
or-n
: A unique name for the container, default name isssm-backend
, If you create a frontend container with the-i
flag, the default name will bessm-frontend
. This name will be used to manage persistent data. As long as the persistent data with this name is not manually deleted, or executessm delete
with-c
flag, it will be accessible whenever the container is rebuilt or when the image is deleted and then launched using this name. -
--version
or-v
: A Sub-Store release version string, default is latest. If you pass-i
to create a front-end container,-v
will be ignored, it always uses the latest version of the front-end. -
--port
or-p
: To successfully create a new Docker container, you need to specify the port mapping. The default port is3000
, and it must be available. If you pass-i
to create a front-end container, the default port will be80
. If you want to access the container using a domain name, you will need to manually proxy this port with a reverse proxy tool such as Nginx or Caddy. -
--network
: Specify a docker network, which has the same effect as--network
indocker run
. If not specified, use Host mode. If specified, use Bridge mode. If the network exists, join it; if not, create it and then join. -
--private
: The default is to create a container with a HostIP of127.0.0.1
. If--private=false
is used, then it is0.0.0.0
.
⚠️ NoticeFor security reasons, starting from version
0.0.12
, ssm will automatically create a random hash prefix for the backend service container to prevent scanning and leakage of subscriptions. After the creation is complete, please use thessm ls
command to view the hash prefix corresponding to the container interface.As shown in the figure above, when adding a service on port 3000, use
http://localhost:3000/4424703b2bae575f0861bf07eafa
to add it to the Sub-Store backend list.For containers created before version
0.0.12
, please delete the container and use thessm new
command to create it again to enable the random hash, and be sure to keep the original container name to maintain the old data.
To update a sub-store docker container, ensure that the image already exists and is running.
ssm update
this command support the following flags:
-
--name
or-n
: A name of running container, default name isssm-backend
. -
--version
or-v
: A Sub-Store release version string, default is latest. If you update a front-end container,-v
will be ignored, it always uses the latest version of the front-end.
Start a non-running sub-store Docker container by name, default name set as ssm-backend
.
Equivalent to
docker start <name>
.
ssm new <name>
Stop a running sub-store Docker container by name, default name set as ssm-backend
.
Equivalent to
docker stop <name>
.
ssm stop <name>
Delete a sub-store Docker container by name, default name set as ssm-backend
.
Equivalent to
docker rm -f <name>
.
ssm delete <name>
this command support the following flags:
--clear
or-c
: Delete the persistent data of the container at the same time. If you delete a front-end container,-c
will be ignored, because the front-end container does not have persistent data.
List all sub-store Docker containers.
Equivalent to
docker ps -a
, filter which container started byssm
image.
ssm ls
Print the version number of ssm.
ssm version
If you are using a script installation, you can directly execute the following command. If you are doing a manual installation, please manually remove your executable file.
rm -rf /usr/local/bin/ssm
If you want to delete the persistent data of the container at the same time, you can execute the following command:
rm -rf ~/.ssm
GPL-3.0 License