Deployment
Step 1: Download the deployment package
You can download the deployment package from web page or command line.
From web:
Go to the release page of this project. Select the package according to the architecture of your machine and the mode you want to use.From command line:
wget https://github.com/elespejo/sskcp/releases/download/[VERSION]/[MODE]-client-imageAPI-[ARCH]-[VERSION].zip
- VERSION : the release tag.
- MODE : ss or sskcp.
- ARCH : the architecture of your machine. It can be x86 and armv6.
e.g : Deploy a sskcp client on a x86 machine with the release 0.4.8 by executing
wget https://github.com/elespejo/sskcp/releases/download/0.4.8/sskcp-client-imageAPI-x86-0.4.8.zip
Step 2: Unzip
unzip [MODE]-client-imageAPI-[ARCH]-[VERSION].zip
cd [MODE]-client-imageAPI-[ARCH]/
Step 3: Prepare the configuration
The configuration for client imageAPI looks like following:
configuration
├── conf
│ ├── kcp.json # if mode is ss, this file is not exists.
│ └── ss.json
└── config.env
The explanation of each file:
- [ss.json]: the configuration of ss.
- [kcp.json]: the configuration of kcp.
- [config.env]: the environment file which content is the variables for the instance.
The template of environment file looks like following:
LOG_DIR=[path]
MODE=[ss or sskcp]
The configuration can use the confgenerator to generate.
Step 4: Config a instance
cd [mode]-client-imageAPI-[ARCH]/
make config CONFIG=[configuration path] NAME=[NAME]
The explanation of those arguments:
- [CONFIG] : The absolute path to configuration directory.
- [NAME] : The instance name. This name is used to control the instance. Must be uniqueness.
e.g : Generate a compose file named 7010.yml
with the configuration in ~/conf/2010-123.45.67.8-7010/
.
cd ~/sskcp-client-imageAPI-x86/
make config CONF=~/conf/2010-123.45.67.8-7010 NAME=7010
Therefore a compose file named 7010.yml
is generated in ~/sskcp-client-imageAPI-x86/compose/
.
# 7010.yml
services:
sskcp-client:
command: supervisord -c /service.conf.d/sskcp-redir-x86.conf
image: elespejo/sskcp-x86:0.4.8
network_mode: host
restart: always
volumes:
- source: ~/conf/2010-123.45.67.8-7010
target: /clientconf
type: bind
- source: ~/log/2010-123.45.67.8-7010
target: /clientlog
type: bind
version: '3.2'
For testing configed instance , use another makefile target 'test_config':
make test_config NAME=[NAME]
Step 5: Start the instance
Start the instance with the name you specified in the config step above.
make start NAME=[NAME]
e.g: start instance 7010
cd sskcp-client-imageAPI-x86/
make start NAME=7010
After starting the instance successfully, you may see the output similar with the following:
docker-compose -p 7010 -f ~/sskcp-client-imageAPI-x86/compose/7010.yml up -d
Creating 7010_sskcp-client_1 ... done
Step 6: Restart the instance
make restart NAME=[NAME]
e.g
make restart NAME=7010
After restarting the instance successfully, you may see the output similar with the following:
docker-compose -p 7010 -f ~/sskcp-client-imageAPI-x86/compose/7010.yml up -d --force-recreate
Recreating 7010_sskcp-client_1 ... done
Step 7: Check status of the instance
make status NAME=[NAME]
e.g,
make stop NAME=7010
You may see the output similar with the following:
docker-compose -p 7010 -f ~/sskcp-client-imageAPI-x86/compose/7010.yml ps
Name Command State Ports
--------------------------------------------------------------------
7010_sskcp-client_1 supervisord -c /service.co ... Up
docker-compose -p 7010 -f ~/sskcp-client-imageAPI-x86/compose/7010.yml logs
Attaching to 7010_sskcp-client_1
sskcp-client_1 | 2018-10-12 04:02:09,572 CRIT Supervisor is running as root...
sskcp-client_1 | 2018-10-12 04:02:09,572 CRIT Supervisor is running as root...
sskcp-client_1 | 2018-10-12 04:02:09,574 INFO supervisord started with pid 1
sskcp-client_1 | 2018-10-12 04:02:09,574 INFO supervisord started with pid 1
...
Step 8: Stop the instance
make stop NAME=[NAME]
e.g,
make stop NAME=7010
After stoping the instance successfully, you may see the output similar with the following:
docker-compose -p 7010 -f ~/sskcp-client-imageAPI-x86/compose/7010.yml down
Stopping 7010_sskcp-client_1 ... done
Removing 7010_sskcp-client_1 ... done
Step 9: List the instances
make list
You may see the output similar with the following:
for compose in `ls ~/sskcp-client-imageAPI-x86/compose`;do name=`echo $compose|awk -F "." '{print $1}'`;echo $name;docker-compose -p $name -f ~/sskcp-client-imageAPI-x86/compose/$compose ps;done
7010
Name Command State Ports
--------------------------------------------------------------------
7010_sskcp-client_1 supervisord -c /service.co ... Up
...
Step 10: Remove the compose file
make remove NAME=[NAME]
e.g,
make remove NAME=7010
You may see the output similar with the following:
rm ~/sskcp-client-imageAPI-x86/compose/7010.yml
Check whether the remove step successfully:
ls compose | grep 7010