by Devin Yang
(This article was automatically translated.)

Published - 1 year 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,dlaravel

D-Laravel 1.5.5 Change Notes

D-Laravel's fpm image was rebuilt using the official dockerfile of docker php before php 7.2.1. And so I can specify that the default owner of fpm is dlaravel, --with-fpm-user=USER Set the user for php-fpm to run as. (default: nobody) --with-fpm-group=GRP Set the group for php-fpm to run as.

docker

The use of iptabels is required in the Docker Swarm environment

First of all, in the Linux environment, Docker uses iptables rules to provide network isolation. However, in the environment of Docker swarm mode, we cannot identify the connection port under 127.0.0.1 of the host. At this time, we can customize the rules through the DOCKER-USER chain in iptables.

docker

How to simply use Docker to create an internet command line speed test program?

How to simply use Docker to create an internet command line speed test program? Here we use the python program speedtest-cli Will use Docker for the main use case, for example, I want to test the speed in my NAS, Although there is python in my NAS, but there is no pip command, it feels much safer to use Docker at this time. Of course, your NAS needs to be able to run Docker :). Or, I am in a MacOS environment, and I don't want to install speedtest-cli into my MacOS. At this time, it is not bad to use Docker to build a simple execution environment by yourself.