Hosting
Hosting Your LightNet site
Section titled “Hosting Your LightNet site”Your LightNet site can be hosted on any file server of your choice. To create a folder that can be deployed, run the following command from your project folder:
npm run build
This command creates a folder named dist
. This folder contains static HTML, CSS, JS, and assets. Upload it to your file server.
If you do not have preferences on hosting, we recommend using GitLab & Cloudflare Pages.
Setup Hosting on GitLab and Cloudflare Pages
Section titled “Setup Hosting on GitLab and Cloudflare Pages”Cloudflare Pages delivers your website to your audience. It takes care of building your website on Cloudflare’s servers, caching, distributing your page around the globe (using Cloudflare’s CDN), and more.
Using GitLab enables you to collaborate with others. Also Cloudflare uses GitLab to read your source code and automatically update your site when there are new commits.
Both GitLab and Cloudflare Pages should be free of charge as long as your website does not turn into the next YouTube:
- Cloudflare’s free plan includes unlimited requests to static pages.
- GitLab’s free plan allows you to collaborate with up to 5 people inside a group.
Setup GitLab
Section titled “Setup GitLab”- Create a GitLab Account: If you don’t have one, sign up at GitLab. Do not create an enterprise account.
- Create a new group: For easier permission control, when working together with others, create a private group.
- Create a new project: In your new GitLab group, create a new blank private project without a README. This is the git repository where you upload your project folder.
- Push repository to GitLab: Push your project folder to the newly created GitLab project by running the following commands from your project folder.
Replace
Terminal window git remote add origin https://gitlab.com/your-group/your-project.gitgit push --set-upstream origin --allyour-group
andyour-project
.
Setup Cloudflare Pages
Section titled “Setup Cloudflare Pages”- Create a Cloudflare Account: Sign up at Cloudflare if you don’t have an account.
- Create Cloudflare Application: In the Cloudflare menu open Workers & Pages. Press the CREATE button to start the initialization.
- Select Pages Application: Choose to create a Pages Application.
- Import from Git: Choose the option to connect to a git repository to start importing your project.
- Grant Access to GitLab Project: Choose GitLab and add your account. Begin the setup for your project.
- Configure Pages Settings: Set up the build and deployment settings for your Cloudflare Pages project. After choosing the Astro framework preset, you are ready to deploy.
- View your site: Cloudflare Pages provides you with a
.pages.dev
domain to view your site online.
Configure a Cloudflare Domain
Section titled “Configure a Cloudflare Domain”You can use Cloudflare Domains to purchase a domain registration.
To configure a custom domain:
- Purchase a domain from Cloudflare Domains.
- Follow the instructions in the Cloudflare dashboard to link your new domain to your Cloudflare Pages project.