If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Transferring a Preconfigured Site on Ubuntu VPS

Started by Kralj187, Jul 24, 2023, 12:03 AM

Previous topic - Next topic

Kralj187Topic starter

I have a VPS server running Ubuntu 16.04. The site on this server is built using NodeJS and React/Redux, and it has been configured accordingly. Now, I want to transfer the site to another provider. However, it's not feasible for me to manually install all the libraries and configure every single config file. The site was originally set up by someone else, and I want to preserve it as much as possible without relying on external dependencies.

Additionally, some of the repositories used by the site have become inactive, and certain utilities have been updated and are no longer compatible. Unfortunately, I don't have physical access to the server, so any changes need to be made remotely via SSH access. Given these constraints, what options do I have? How can I successfully transfer and save the site?
  •  


giorgio

To successfully transfer and save the site to another provider while preserving its configuration and minimizing external dependencies, you can follow these steps:

1. Take a Snapshot: Before making any changes, take a snapshot of your current VPS server. This ensures that you have a backup in case anything goes wrong during the transfer process.

2. Package Dependencies: Gather and package all the necessary dependencies required by your NodeJS and React/Redux application. You can use package managers like npm or yarn to create a package.json file containing all the dependencies.

3. Transfer Code and Configurations: Copy the entire codebase, including the package.json file and configuration files, from your current VPS server to the new provider using SSH access. Use the secure copy command (scp) to transfer files between servers.

4. Update Dependencies: Once the code is transferred, navigate to the project directory on the new server and run the package manager's install command (e.g., npm install or yarn install) to update and install the required dependencies based on the package.json file.

5. Configure Environment Variables: Check if any environment variables are used in the application and ensure they are correctly set and accessible on the new server. This includes database connection strings, API keys, and other relevant configurations.

6. Test the Site: Start the NodeJS server and test the site thoroughly to ensure all functionality is working as expected. Make any necessary adjustments to the server configuration and troubleshooting any issues that may arise during this stage.

7. Handle Inactive Repositories: If some of the repositories used by the site have become inactive, you have a few options:

  a. Replace or Remove Libraries: Identify alternative libraries or packages that provide the same functionality but are actively maintained. Replace the inactive repositories with the active ones in your codebase. If the functionality provided by the inactive repositories is no longer required, remove them from your codebase altogether.

  b. Fork and Maintain: If the inactive repositories are critical to your application and there are no suitable alternatives, consider forking the repositories and maintaining them yourself. This way, you can address compatibility issues and ensure their continued functionality.

8. Ongoing Maintenance: Once the site is successfully transferred, regularly monitor and maintain the environment, keeping track of any updates or deprecated technologies. This includes updating libraries, fixing security vulnerabilities, and ensuring the server's overall health.

Transferring a site to a new provider can be complex, especially when dealing with specific configurations and dependencies. It's always a good idea to consult with knowledgeable professionals or seek assistance from the new provider's support team if needed.
  •  

searchcandy

To spy on the exact distribution, the simplest method is to install the same Ubuntu 16.04 server on a new VPS and use the rsync command to transfer the data. Here is an example of the command:

sudo rsync -aAXvP — exclude={/boot/,/dev/,/etc/fstab,/etc/modprobe*,/etc/modules/,/lost+found/,/etc/mtab,/etc/network*,/etc/sysconfig/ip*,/etc/sysconfig/kernel,/etc/sysconfig/network*,/lib/modules/,/media/,/mnt/,/proc/,/run/,/sys/,/tmp/,/var/lib/lxcfs/,/var/lock/}  root@mysite.com:/ /
I recommend trying this method on different virtualization systems, such as at home or at work, to ensure it works. After that, you can replace the hosts file on the host machine and ensure everything is functioning correctly. This machine image can then be saved as a backup. Once everything is working fine, you can purchase a new VPS and repeat the process.

PS
If everything runs smoothly on the new VPS, you can consider updating the distribution to 22.04 on the same machine where the site was copied. Before doing so, make sure to thoroughly check all the functionalities. If everything works well, proceed with installing the supported system.
  •  

encoche

First, we create a backup. With root access, Linux can easily be transferred using a simple tar.

The hoster has the ability to add their own utilities, scripts, network configurations, and even customize the boot method. Basically, everything can be restored, the hoster's scripts can be cleaned, and any problems can be easily resolved.

Next, we move on to the recovery process, which may potentially encounter some issues. Generally, everything should work fine with virtualization systems other than OpenVZ/LXC/Docker. The reason is that these systems may not allow working with different versions of system libraries. In addition, the hoster may prohibit or not provide the tools needed to replace system files, making it difficult to do so from within the operating system itself.

It's worth mentioning that there is an alternative method of containerization without hardware support for virtualization called user-mode Linux. This method allows you to load the system even without admin rights, and it works well with OpenVZ (although some kernel modules may be missing by default). This method is often forgotten, but it can be considered the oldest, most powerful, and convenient method of containerization (although performance-wise, it may have slower system calls compared to newer methods).

If the virtual machine is kvm/vbox/vmware/..., then there should be no problems at all. To deploy the backup, you would need to boot into the recovery console using an ISO image, format the file system, and unpack the backup archive. Additionally, you may need to manually copy certain files, especially if /dev is not included in the archive. Finally, the bootloader needs to be reinstalled using the command "grub-install /dev/sdX --root-directory=/path/to/mounted/root/".

Of course, it's important to ensure that the architecture of the original machine matches the new one. This means that the processor type (x86/arm) and bitness of x86/x64 should not be mixed, although running x86 on x64 should generally not pose any significant issues.
  •  

Wegetotoacef

One approach is to create a plan that involves using containerization technology such as Docker to encapsulate the entire application, including its dependencies, into a portable container.
By containerizing the NodeJS and React/Redux application, you can ensure that all required libraries and configurations are preserved and replicated. This will also help in addressing the issue of inactive repositories and incompatible utilities. You can use Docker Compose to define and run multi-container Docker applications, which will enable you to manage all the services as a single unit.

Furthermore, for remote server access via SSH, you can utilize tools like Ansible or Chef to automate the deployment process. These configuration management tools will allow you to define the desired state of your servers and automate the process of ensuring that state is maintained.

To start the transfer process, first dockerize the application by creating a Dockerfile and defining the necessary dependencies and configurations. Once the application is containerized, use Docker Compose to define the services required for the application to run. This will ensure that the site can be easily deployed and run on a new provider without the need to manually install libraries or configure files.

Additionally, consider version-controlling the configuration files and scripts using Git so that the entire setup is dоcumented and reproducible. With version control, changes made during the transfer process can be tracked, and the history of modifications will be available for reference.
By containerizing the application with Docker, automating the deployment process with tools like Ansible or Chef, and version-controlling the configuration files, you can successfully transfer and save the site to another provider without relying on external dependencies. This approach will help maintain the integrity of the site setup and ensure a smooth transition to the new hosting provider.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...