Sveltekit Systemd screenshot

Sveltekit Systemd

Author Avatar Theme by Karimfromjordan
Updated: 15 Feb 2024
34 Stars

Categories

Overview

The SvelteKit systemd Guide is a repository that provides a guide and resources for building and deploying a SvelteKit app as a systemd portable service on a server. The repository contains a GitHub workflow with build and deploy jobs, resulting in a lightweight image containing the SvelteKit app, a Node.js executable, and glibc++. The final image size is approximately 37 MB.

Features

  • Build SvelteKit app into a systemd portable service
  • Deploy the created image to a server
  • Dynamically allocate and restrict user for the application
  • Pass environment variables to the application
  • Provide a directory for the application to write data
  • Backup the state of all applications by copying the specified directory

Installation

To use the SvelteKit systemd Guide repository, you have two options:

  1. Use it as a template:
    • Start from scratch and create a new SvelteKit project using pnpm create svelte@latest myapp.
    • Install @sveltejs/adapter-node and add it to your svelte.config.js.
    • Copy and paste the .github directory from the repository into the root directory of your project.
    • Configure the necessary secrets in the Settings tab of your repository on GitHub.
    • After making changes to the main branch, the build and deploy jobs will be triggered automatically.
  2. Start from scratch:
    • Create a new SvelteKit project using pnpm create svelte@latest myapp.
    • Install @sveltejs/adapter-node and add it to your svelte.config.js.
    • Copy and paste the .github directory from the repository into the root directory of your project.
    • Configure the necessary secrets in the Settings tab of your repository on GitHub.
    • After making changes to the main branch, the build and deploy jobs will be triggered automatically.

Summary

The SvelteKit systemd Guide provides a convenient way to build and deploy SvelteKit apps as systemd portable services. By following the provided instructions and utilizing the GitHub workflow, developers can easily package their SvelteKit app into a lightweight image and deploy it to a server. The guide also covers important topics such as environment variables, user allocation, and state directory management. Overall, this repository simplifies the deployment process of SvelteKit apps and ensures smooth integration with systemd.