Hosting static website comes with some options. One of the option is using GitLab + Render to publish your static websites. I've already written a post on using GitHub + Netlify to host & publish your static website. You can also check it for another option. So, let's get started.
Pre-requisites
- Valid accounts in GitLab & Render website
- Project ready preferably with README file
Steps to cover
- Login to Gitlab
- Upload the files necessary(Need to upload files one-by-one) or use CLI to push files via VS Code
- Let it complete uploading
- Login to Render
- Connect with Gitlab
- Select the project
- Do necessary configurations
- Click publish
- Check website live
Detailed steps
- Login to GitLab portal
- Click on New Repository
- Select from below. If your project is already in your local, select Create blank Project, else chose suitable option. I've my project ready in local, so choosing Create blank Project.
- Give suitable name. Can chose a deployment target. Learn more about this here. Chose other options as per the convenience. I'm letting other options as default.
- Click on Create Project button for creating the repo successfully.
- Upload the project files using the + button as per the image below and selecting Upload file.
- Carefully upload all the files one-by-one. Check how to upload multiple files via CLI here. Moreover, uploading multiple files in GitLab web interface is not supported anymore.
- Check all the files are uploaded as in file-tree
- Login to render portal now
- Click on New button & select Static Site from dropdown options
- Connect your GitLab account with render account. You'll get steps how to do that in render's documentation. Mine is already connected, so I'll continue with selecting the repository step. Check the repository just created.
- Click on Connect button
- Give a unique name to your specific project in render.
- Put the following text(./) in the Publish Directory textbox as the files are uploaded in master directory.
- Let render complete the scanning and deploy your site using the files of GitLab repo.
- Once you get the following message in console, your website will be published & live now.
- Check the site deployed just now by clicking in the link in top.
- Check my site below.
[Happy Hacking] [Render your Career] [Upgrade to new version of you]
Follow me on Linkedin.
Top comments (0)