by Devin Yang
(This article was automatically translated.)

Published - 2 years ago ( Updated - 1 year ago )

Although we may use websites such as speedtest to test the speed of uploading and uploading, what if we want to test the speed of our own Server?
For example, if the user is in another country, the speed of connecting to our host is slow, then the self-hosted test tool is very convenient.
The latest version of phpenv has added openspeedtest.yml to the yml file of services.

version: '3.6'
services:
 fastapi:
  image: openspeedtest/latest
  ports:
    - ${HTTP_PORT-3000}:3000
  restart: unless-stopped
  networks:
    - dlaravel_net
networks:
    dlaravel_net:

We can use one line of docker command to start, you can check it on the official website, I copied it for you as follows:

docker run --restart=unless-stopped --name openspeedtest -d -p 3000:3000 -p 3001:3001 openspeedtest/latest

In fact, it is very simple. Here is the process of using phpenv to start. How do I do it? 1. Because I want to use an independent environment, I use the following command to make a soft link to services/openspeedtest.yml and put it in the upper directory.

ln -s services/openspeedtest.yml ost.yml

Set the name yourself, I will call it ost.yml, the actual execution screen is as follows:

2. Because my phpenv has a large number of environment configuration files, I can use the following command to check those ./ports that are useless to me, so conflicts must be avoided.
There will be a bunch of ports in the configuration file in envs, because there are too many, we can add a filter.

./ports |grep HTTP_PORT

The operation screen is as follows:

In the figure above, the port numbers listed in the ./ports command in phpenv will be arranged in order from small to large. I can probably see that 1061 should be available.
3. Here I will use the Linux netstat command to verify again to confirm that 1061 is not Listened.

sudo netstat -ntlp|grep :1061

On the contrary, if the connection port is enabled, it will be displayed on the screen, similar to the one below, how to tell, just change the connection port that will not flush🥲

Under normal circumstances, it should not rush to this port, it will look like the following.

4. Set the environment configuration file of openspeed, specify the yml file used, the project name and the opened port.
Here I named it openspeed and put it in the envs directory.

DEFAULT=ost
PROJECT=speedtest
HTTP_PORT=1061

The actual screen is as shown in the figure below. DEFAULT=ost represents the soft link ost.yml I executed in the first step above.

After completing the configuration file, we can switch the environment, execute ./link, and switch to the openspeed environment.

As you can see in the services/openspeedtest.yml above, it directly uses the official image (openspeedtest/latest), so we don't need to build it, just start it directly.
5. Execute the ./start command to start the environment. If there is no image, it will be downloaded automatically. If there is an image, it will be started directly.

./start

Actual operation screen: (use ./start to start, use ./console ps to view status)

6. Test it directly on another computer. Here I use the intranet test. Press Start on the screen to test.
Because I have a 10G network, the measured value is close to 10000Mb, which seems normal. 🥹

Tags: openspeedtest docker phpenv

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker,cli

Docker container formatted display

I think if you want to write some automation functions, it may be useful to be able to format the output container content. The following are some reference examples of Docker container formatting and display instructions

php,docker,dlaravel

A brief introduction to the phpenv container environment I built

I don't have time to shoot an introduction video, so I'll just grab some pictures and introduce the container environment deviny/phpenv I use. https://github.com/DevinY/phpenvphpenv can be regarded as an evolutionary version of my previous D-Laravel open source project, conceptually extending the use of many Dlaravel operation methods. The update of the container tends to be controlled by the user to build his own image, so I am not very good at changing the version number. In fact, the php version number of D-Laravel seems to have not been changed for a long time:p

docker,phpenv

Ran out of Docker IPv4 address pool problem solving

Maybe in the old version of the docker environment, when using Docker compose to start the container, you will encounter the following error: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network This is actually this It is a symptom of running out of default-address-pools. In some environments, docker-compose will use the private network of Class B by default. The private IP of segment 172 has a range, from 172.16.0.0 to 172.31.255.255. That is to say, when we start a docker-compose Project, it will eat a private section of Class B, which is very heroic.