The best way to install and upgrade for Linux docker
The best way to install and upgrade for Linux docker
Note
- For digital currency, overseas dockers should be selected. For commodity futures, you can rent domestic servers monthly with one click on FMZ platform, and the price is close to the lowest. One click rental of overseas dockers is more expensive.
- A docker can run multiple robots.
- A server can run multiple dockers, but it is generally unnecessary.
- If you are prompted that Python cannot be found, you need to install and restart it on the machine running the docker.
- The latest docker (March 1, 2021) has upgraded the automatic background. That is, after the foreground runs, you can exit the ssh connection directly without interrupting the docker. The original method can still be used.
Overseas server recommendation
Alibaba Cloud, Alibaba Cloud Lightweight Application Server select Hong Kong (OKX is in Hong Kong), system image CentOS, package is 34 yuan/month, 2G RAM. Pay monthly (or half a year). It is a cost-effective option currently.
Amazon ec2 has many optional regions, and the Binance and Huobi Exchanges have the option of Tokyo, with the lowest delay. Generally, the lowest configuration t2.small is enough. But you need to bind a visa credit card to pay.
Vultr is cheap and has many options. It supports Alipay payment. However, the server and website may be blocked, and the correct Internet access is required.
Linux installation docker steps
- To purchase a server, you usually choose the centOS system with the minimum configuration. The general price is 1 yuan/day. Commodity futures are served in the domestic market, while digital currency transactions are carried out abroad. Here is a specific purchase demonstration.
- Log in to the server. Windows recommends using the Xshell client. The specific SSH login method can be searched by yourself.
- Download the docker, right click on https://www.fmz.com/m/add-node to copy the link of the docker that matches the system version. Note that the command run in step 5 should also be viewed here.
Server input: wget https://www.fmz.com/dist/robot_linux_amd64.tar.gz
to download (the Shift+Ins
key is pasted on the terminal). If prompted that wget does not exist, run yum install wget - y
to install wget
. Other systems also have corresponding download tools.
If a certificate problem is prompted (as shown in the following figure):
When downloading with wget you can use: --no-check-certificate parameter.
For example:wget --no-check-certificate https://www.fmz.com/dist/robot_linux_amd64.tar.gz
When downloading with curl you can use: -k parameter.
For example:curl -O -k https://www.fmz.com/dist/robot_linux_amd64.tar.gz
- Run
tar - xzvf robot_linux_amd64.tar.gz
to decompress (after entering the robot, press TAB to complete the path automatically). - To test docker need to run
./robot -s node. fmz. com/xxxxxx -p yourFMZpassword
, the number string represented by xxxxxx is different for each user. The details are found at https://www.fmz.com/m/add-node. YourFMZpassword represents your FMZ website login password, which is required to decrypt API Key.
Prompt such as:2018/07/05 05:04:10 Login OK, SID: 62086, PID: 7226, Name: host. localdomain
, the operation succeeds. If you encounter permission problems, runchmod +x robot
. - At this time, the docker runs in the foreground, and it will be disconnected when the SSH connection is closed. It needs to run in the background. Press ctrl+C to end the test.
- Run the command
nohup ./robot -s node.fmz.com/xxxxxx -p yourFMZpassword &
in the background. - You can see the deployed docker on the docker page. After the page is deleted, the server docker will exit automatically.
- You can also use the
screen
command to make the docker run in the background. You can enter the password without explicitly (the command parameter does not add -p), and you can search for it by yourself.
Upgrade steps
Dockers on FMZ generally do not need to be upgraded. If new exchanges are added, bugs are modified, or dockers are too old, they can be upgraded as the following steps:
- Log in to the directory where the server docker is located (if it has not been changed, it is generally the default directory after SSH login) and execute
ls
to view the file.
We can see logs robot robot_linux_amd64.tar.gz
, where logs is the log folder, robot is the docker execution program, and robot_linux_amd64.tar.gz is the original compressed package.
- Execute
rm - rf robot*
to delete the old robot program and compressed file package at the same time, and keep the log. - Execute
wget https://www.fmz.com/dist/robot_linux_amd64.tar.gz
to download a new docker package. - Execute
tar -xzvf robot_linux_amd64.tar.gz
to unzip. - Execute
nohup ./robot - s node.fmz.com/xxxxxx - p yourFMZpassword &
to run in the background,node.fmz.com/xxxxxx
can be found in https://www.fmz.com/m/add-node.
The advantage of upgrading in this way is that the log can be retained, and the robots run by the old docker will not stop (they have been loaded into memory to run). To upgrade the docker of a robot, you only need to stop the robot, change the docker in the parameter interface (the id of the latest docker is the largest) and restart.
If the old docker no longer runs the robot, the page can be deleted directly on https://www.fmz.com/m/nodes.
From: https://blog.mathquant.com/2023/01/10/the-best-way-to-install-and-upgrade-for-linux-docker.html