changed 5 years ago
Published Linked with GitHub

Moving a service from Glitch to own server

tags: sketchdance

Note: We are using nginx as the webserver and reverse proxy. If you are using, for example, Apache, then some of these steps will be quite different.

  1. In Glitch, get the git repo information
  2. On your own server, cd to where the project files will be located. For us this is /var/www/html/[project] but your mileage may vary.
  3. git clone [git url from Glitch]
  4. [Optional] Change the name of the resulting folder, if desired. For our moat project, it is sd-moat on Glitch, but just /moat on our own server.
  5. If this service is client-side only and has no server code, congratulations! Your'e done. Check that all URLs resolve properly and fix up, for instance, links to stylesheets or JavaScript files that may have been absolute /css/style.csw and need to be either relative or fully specified, i.e., css/style.css or https://mysite.com/myproject/css/style.css. You will have to determine the best way to switch these between Glitch and your site if you continue to use Glitch as the development and staging service, as I do.
  6. If you integrate with other services, such as Moat, you will need to update the integration points as well.

For backend-based services

  1. You will need to add an entry for SystemD to be able to bring up your service. Make sure to change to the correct directory, if needed.
  2. Like #5 above, you will have to check all your paths and make sure they are still valid.
  3. You will need to make sure your custom .env is added for the server. You can optionally set the environment within Node in several ways, but the easiest is to use a library to read the .env file on startup, or to put the environment variables into the SystemD config.
  4. Ensure that database and filesystem connections are working and that permissions are a low as possible while still allowing the service to function.

Managing after setup

Starting the service

sudo systemctl start moat

Stopping the service

sudo systemctl stop moat

Reloading the service after updating code

sudo systemctl restart moat

Select a repo