Support >
  About cloud server >
  Use an American vps server to set up a test environment
Use an American vps server to set up a test environment
Time : 2024-08-09 14:58:16
Edit : Jtti

In the current software development, the selection of servers to build a test environment, the American vps server has become the mainstream choice. The flexibility, scalability and cost effectiveness of setting up a test environment using a US vps server. Here is a guide for you to share about vps setting up a test environment.

Choose a US vps server, consider its CPU and memory, storage space and bandwidth, also need to make sure that the vps vendor can support the system you need, check whether there are pre-installed software packages and tools to speed up the environment setup.

Compare the prices of different vps service providers and choose the plan that meets the budget. Make sure there are no hidden charges, such as traffic fees and storage fees, check the SLA of the vps service provider to ensure that it has high availability and technical support, and find real reviews and feedback from users to understand the reliability of the provider and the quality of customer service.

Jtti provides US vps server rental, provides test IP and uninterrupted 24/7 technical guidance, and the price of vps servers is more favorable than other service providers.

With your vps server selected, you can start configuring your infrastructure. Use SSH to connect to a US vps server:

ssh root@your_vps_ip

Update the operating system

sudo apt update && sudo apt upgrade -y

Installing Basic Tools

sudo apt install -y git curl wget build-essential

Configuring the firewall

sudo ufw allow ssh

sudo ufw allow http

sudo ufw allow https

sudo ufw enable

Set SSH key authentication to enhance security and prohibit password login

ssh-keygen -t rsa -b 4096

ssh-copy-id user@your_vps_ip

sudo nano /etc/ssh/sshd_config

Modify the parameters to disable password login

PasswordAuthentication no

Restarting the SSH Service

sudo systemctl restart ssh

If you need to use a domain name to access the test environment, you can configure DNS at the domain name registrar to point the domain name to the vps IP address. You can then start setting up your test environment. Select a web server such as Nginx according to your project requirements:

sudo apt install nginx

sudo systemctl start nginx

sudo systemctl enable nginx

Apache:

sudo apt install apache2

sudo systemctl start apache2

sudo systemctl enable apache2

Set up the database system MySQL/MariaDB:

sudo apt install mysql-server

sudo mysql_secure_installation

PostgreSQL:

sudo apt install postgresql postgresql-contrib

Clone the application code

git clone https://github.com/your-repo.git /var/www/your-app

To configure application dependencies, Node.js applications:

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -

sudo apt install -y nodejs

cd /var/www/your-app

npm install

Python applications:

sudo apt install python3-pip

cd /var/www/your-app

pip3 install -r requirements.txt

Configure the application server, Node.js application, and use PM2 to manage the Node.js process

npm install pm2 -g

pm2 start app.js

pm2 startup

pm2 save

Python application (using Gunicorn) :

pip3 install gunicorn

gunicorn --workers 3 --bind 0.0.0.0:8000 wsgi:app

Configure the reverse proxy, using Nginx or Apache to configure the reverse proxy to forward requests to the application server. Example Nginx configuration:

server {

listen 80;

server_name example.com;

 

location / {

proxy_pass http://localhost:8000;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

Enable the configuration and restart Nginx

sudo ln -s /etc/nginx/sites-available/example /etc/nginx/sites-enabled/

sudo systemctl restart nginx

Now that you've set up your test environment, you can start verifying it. Use testing frameworks such as JUnit, pytest, Mocha, etc., for unit testing, integration testing, and end-to-end testing. Run the test suite to ensure the normal operation of the code in the VPS environment to complete the functional test; Use tools (such as Apache JMeter, Locust, Gatling) to simulate load and test application performance, identify performance bottlenecks, and optimize; Scan for common vulnerabilities and fix them, and perform penetration testing using tools such as OWASP ZAP, Nessus.

Set up monitoring tools (such as Prometheus, Grafana) to monitor server performance. Configure a log management system, such as ELK Stack, to collect and analyze log data. Automate the deployment process with CI/CD tools such as Jenkins, GitLab CI. Write scripts (such as Shell, Python) to automate routine maintenance tasks. Update the operating system and software regularly to fix security vulnerabilities.

sudo apt update && sudo apt upgrade -y

Back up important data and protect VPS with security policies.

Using vps to build the test environment, using reasonable configuration and maintenance to ensure the efficient operation of the test environment, can provide reliable support for the development process.

JTTI-Defl
JTTI-COCO
JTTI-Selina
JTTI-Ellis
JTTI-Eom