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

How to start HAProxy with Docker on Raspberry

Raspberry is very cheap and has quite a lot of applications, for example, some people use it as a Wi-Fi router, For game consoles, monitors and many other IoT-related applications, I use it as a HAProxy. Long story short, since I have an old Windows server running old versions of PHP and Apache, and can't set up HTTPS certificates, I wanted to say Help through HAProxy. Let this old server also have https URL, So to share my docker-compose.yml configuration.

docker,laravel

[D-Laravel]./console node

When developing Laravel, sometimes we need to install nodejs packages through npm, but Node in our system is not new enough. It may be impossible to upgrade due to some factors, such as running an old version of nodejs program, etc. In fact, we can use docker through simple commands, so that we can use the latest version of node image to mount the /sites folder on the host side. In this way, we can execute the new version of the npm command at any time.

docker

Install docker-compose on ubuntu

Briefly introduce how I installed docker-compose on ubuntu. Quite easy.