skip to Main Content

I have a server with an IP address, username, and password provided by my manager. My website is built using React.js, with a MySQL database, and version control managed through GitLab. How can I deploy my website on the physical server assigned to me? I’ve searched extensively, but I couldn’t find any specific tutorials for this. Please help.

I tried searching on YouTube, but all the tutorials I found were for hosting services, and I need guidance for deploying on a dedicated server.

2

Answers


  1. A ReactJS app becomes a set of "static web files" that you deploy to your web server. To get those static web files, you need to do a "build". Depending on the system you used to create the React project, the command to do a build might be npm run build. You can check your package.json‘s script section to see if there is a build command defined.

    Once the build happens, its output typically goes into a directory named dist or build. It is the contents of that directory that you would copy to your web server.

    If you let us know which system you used to build the React project (Create-React-App/CRA? Vite? Remix? NX?), then we can provide more specific steps.

    Login or Signup to reply.
  2. Context

    It actually depends on how you are planning to serve your application. You have mentioned MySQL, but it is unclear which backend platform you are using to process requests from your client react application.

    Simplified & Generalized Approach

    Here is simplified and generalized approach to deploy application to server:

    1. Generate pair of SSH keys.
    2. Put public SSH key on server.
    3. Put private SSH key into GitLab repository secrets.
    4. Create CI/CD pipeline on production branch with next steps:
      1. Build application.
      2. Put build artifacts into archive.
      3. Connect to server via SSH using secret key.
      4. Shutdown currently running application or put it into maintenance mode, if it is necessary.
      5. Copy archive to server via SSH.
      6. Unzip archive into desired application directory.
      7. Start your application or get it out of the maintenance mode, if it is necessary.

    Summary

    By having IP address, username and password generally you can interact with provided server via console or special tool using SSH protocol.

    The deployment workflow in this case mostly depends on project requirements and environment limitations.

    You can specify more details about your application & capabilities, so anybody then can suggest specific approach.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search