Instructions for Railway.app simple deployment!

A quick update on how it is deployed and comments on the immediate future!

I don’t need a database, so I use Hugo, and theme is called PaperMod. I would like a slightly different layout, but this will have to do for now since I need to work on other things than CSS. I will add some more graphics as soon as possible and update the About and Links page. I am happy that the theme looks pretty good on mobile.

I am grateful for the excellent service that is https://railway.app for making me able to deploy this blog fast, conveniently, and for free! Below is a step by step guide for how to deploy a simple static website like Hugo using Railway.

Deploying a state website using Railway

  1. Install the Railway.app CLI on your machine.

  2. Build the website, e.g. for Hugo in project root folder:

$ hugo

This will generate the HTML etc. in the /public directory.

  1. Login in to your Railway account:

$ railway login

Do not close the tab that opens, instead, click on Dashboard.

  1. Click on + New Project > Deploy a starter

  2. Type in nginx, select NGINX

  3. Type in a repo name, e.g. nginx, click Deploy

  4. Go back to the terminal and go the /public directory that you want to deploy.

  5. Add this directory to your GitHub:

$ touch README.md

$ git init

$ git add .

$ git remote add origin https://github.com/YOUR_USER_NAME/CHOOSE_REPO_NAME_THAT_YOU_WANT

$ git branch -M main

$ git push -u origin main

  1. Go back to your web browser and your Railway Dashboard. The NGINX sever you created before will have a URL and a randomly generated double-name, click on it.

  2. Click on Settings and copy the Project ID.

  3. You are now ready to connect your local directory to your Railway NGINX server using the power of the Railway CLI! Make sure you are still in the /project directory that you have already added to GitHub and input:

$ railway link PASTE_THE_PROJECT_ID

You should see this:

> ✔ Environment: production
  1. Deploy your website to the webserver:

$ railway up

  1. That’s it! Your website is now accessible from the URL of the NGINX webserver that you can find on your dashboard and you should also the the URL in the message “☁️ Deployment live at httpsx//nginx-production-xxxx.up.rail” after the Railway deployment magic is completed.

In my next update, I will be going over how to update the site and the tweaks that I am doing to the theme (I am aware that it does not look much wow at the moment).