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

Wenchat about the evolution history of my network

Hear about the evolution of my network. My GCP costs $46.35 per month, and the current free trial balance is $111.05, I've almost spent $300, and I'm about to move back to a self-managed host.

docker

Update docker-compose version with bash

Install the latest version of docker-compose

docker,laravel

How to use multiple YAML files to execute multiple docker container services

This video introduces how to use the docker-compose command to specify multiple YAML structure language configuration files to create container execution, and introduces how we simplify docker-compose by using .env in the D-Laravel environment Start command.