Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen ๐Ÿ“Œ Deploy SvelteKit with SSR on Coolify (Hetzner VPS)


๐Ÿ“š Deploy SvelteKit with SSR on Coolify (Hetzner VPS)


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

This is my first quick try deploying SvelteKit with the open source software Coolify by Andras Bacsai.

Specs:

Disclaimer I: On first try, I ran into "502 Bad Gateway" and 200% CPU load after hitting "Deploy". Had to restart the Hetzner VPS via console.hetzner.cloud. Maybe I didn't save the configuration properly beforehand. ๐Ÿค”

Disclaimer II: If you want to use this setup in production, please take measures to secure your VPS.

Install selfhosted Coolify on Hetzner VPS

Just create a new CPX11 cloud server on hetzner, connect via SSH (ssh root@your-server-ip) and run the command from https://coolify.io/self-hosted:

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

That's really it. After install, you can create your admin user via http://your-vps-server-ip:8000/. See slightly older YouTube video for full example: https://www.youtube.com/watch?v=Jg6SWqyvYys

Prepare the SvelteKit demo app

You can also use my demo repository: https://github.com/mandrasch/sveltekit-demo-app-adapter-node

Create a git repository, use the official SvelteKit installer, select demo app when asked: npm create svelte@latest . Install dependencies via npm i.

Important: Install adapter-node via npm i -D @sveltejs/adapter-node and switch from adapter-auto to adapter-node in svelte.config.js:

import adapter from '@sveltejs/adapter-node';

export default {
    kit: {
        adapter: adapter()
    }
};

This is needed for SSR support on Coolify. See SvelteKit docs for more information on adapter-node: https://kit.svelte.dev/docs/adapter-node

Commit and push all your changes to your GitHub repository.

Create a new project in Coolify

Let's get the party started by creating a new project:

Image description

Select production:

Image description

Add a new resource:

Image description

Select "public repository":

Image description

Select localhost and destination, there is only one option to select anyway ;-)

Image description

Image description

Paste your repository URL, I used my repository https://github.com/mandrasch/sveltekit-demo-app-adapter-node:

Image description

Click "check" and continue with these default settings:

Image description

Now we configure the install, build and start command. Use the following commands:

  • Install: npm ci --omit dev
  • Build: npm run build
  • Start: node build

Image description

Important: Don't forget to hit "Save" (!)

Image description

See SvelteKit docs for more information about these commands: https://kit.svelte.dev/docs/adapter-node

Switch to https and set ORIGIN

The deployment with http:// would be okay, but two important things are missing:

  • https support, otherwise cookies won't work
  • setting the ORIGIN (via environment variables)

For https, just switch the temporary sslip.io domain to https:// and hit 'Save'(!):

Image description

Now we need to set the ORIGIN, otherwise SvelteKit can't really detect its own domain - this will likely cause Cross-site POST form submissions are forbidden errors.

Important: The node-adapter docs state that you can use ORIGIN=... node build as start command, but this did not work on Coolify (guess because of Docker).

Instead add a new env variable here (!):

Image description

Image description

Now it's time for the first deployment, just hit the "Deploy" button and use "Show debug logs" for all information:

Image description

Don't get confused by red error messages, I guess these are false positives:

Image description

After this is finished, the status in Coolify should switch to "Running" and you should able to play Sverdle on your newly created site ๐ŸŽ‰

Image description

Have fun with selfhosting!

Official docs:

...



๐Ÿ“Œ Deploy SvelteKit with SSR on Coolify (Hetzner VPS)


๐Ÿ“ˆ 116.83 Punkte

๐Ÿ“Œ Deploy Node.js applications on a VPS using Coolify


๐Ÿ“ˆ 58.77 Punkte

๐Ÿ“Œ Host SvelteKit apps with SSR-support via ploi.io (on Hetzner Cloud)


๐Ÿ“ˆ 58.05 Punkte

๐Ÿ“Œ Cluster API Hetzner released - k8s 1.25, full sponsorship of e2e test provided by Hetzner


๐Ÿ“ˆ 37.54 Punkte

๐Ÿ“Œ Setup a VPS on Hetzner Cloud


๐Ÿ“ˆ 36.25 Punkte

๐Ÿ“Œ Using VPS for Bug Bounty, comparing VPS providers


๐Ÿ“ˆ 34.95 Punkte

๐Ÿ“Œ Linux VPS vs. Windows VPS: Which One Should You Choose?


๐Ÿ“ˆ 34.95 Punkte

๐Ÿ“Œ VPS-Docker-For-Pentest - Create A VPS On Google Cloud Platform Or Digital Ocean Easily With The Docker For Pentest


๐Ÿ“ˆ 34.95 Punkte

๐Ÿ“Œ Gรผnstige VPS - was ist ein Virtual Private Server (VPS)? - Windowspower.de


๐Ÿ“ˆ 34.95 Punkte

๐Ÿ“Œ The Best Alternative to Vercel, Netilfy, GitHub Pages and many more : Coolify


๐Ÿ“ˆ 31.02 Punkte

๐Ÿ“Œ Self-Hosted Coolify on EcoStack Cloud: Your Own PaaS with Effortless App Deployment


๐Ÿ“ˆ 31.02 Punkte

๐Ÿ“Œ SvelteKit & TailwindCSS Tutorial โ€“ Build & Deploy a Web Portfolio


๐Ÿ“ˆ 30.13 Punkte

๐Ÿ“Œ Serverless Sucks: How to Deploy your Next.js App to a VPS and Setup a CI/CD Pipeline


๐Ÿ“ˆ 27.75 Punkte

๐Ÿ“Œ Deploy Next.js to Contabo VPS


๐Ÿ“ˆ 27.75 Punkte

๐Ÿ“Œ How to Deploy a Next.js Application to a VPS Using NGINX and PM2


๐Ÿ“ˆ 27.75 Punkte

๐Ÿ“Œ Deploy Laravel on VPS using ChatGPT #chatgpt


๐Ÿ“ˆ 27.75 Punkte

๐Ÿ“Œ Deploy Django Web App with SSL on VPS using Nginx & Gunicorn


๐Ÿ“ˆ 27.75 Punkte

๐Ÿ“Œ CVE-2024-22359 | IBM UrbanCode Deploy/DevOps Deploy Web UI cross site scripting (XFDB-280897)


๐Ÿ“ˆ 20.56 Punkte

๐Ÿ“Œ CVE-2024-22334 | IBM UrbanCode Deploy/DevOps Deploy permission assignment (XFDB-279974)


๐Ÿ“ˆ 20.56 Punkte

๐Ÿ“Œ CVE-2024-22331 | IBM UrbanCode Deploy/DevOps Deploy Windows Agent Installation information disclosure (XFDB-279971)


๐Ÿ“ˆ 20.56 Punkte

๐Ÿ“Œ CVE-2024-22358 | IBM UrbanCode Deploy/DevOps Deploy session expiration (XFDB-280896)


๐Ÿ“ˆ 20.56 Punkte

๐Ÿ“Œ CVE-2024-22339 | IBM UrbanCode Deploy/DevOps Deploy log file (XFDB-279979)


๐Ÿ“ˆ 20.56 Punkte

๐Ÿ“Œ heise+ | Web-Apps mit SvelteKit erstellen


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ How to make declarative/code-based router instead of file-based router in SvelteKit 2


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ SvelteKit 1.0 Has Been Released! ๐Ÿฅณ


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ SvelteKit 1.0 released


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ JavaScript-Framework: SvelteKit 1.0 stellt kompletten Stack fรผr Svelte bereit


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ The Best SvelteKit 1.0 YouTube Tutorials โ€“ January 2023 ๐Ÿค“ ๐ŸŽ“


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ Stylify CSS: Code your SvelteKit website faster with CSS-like utilities


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ Mix static & client-side rendering on same page with SvelteKit


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ Building a clone of dev.to's editor with SvelteKit and TypeScript


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ SvelteKit 1.0 - Build an blog, fetching posts from your DEV profile


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ Introducing the BFF (Backend for Frontend) Concept by simple application with SvelteKit, Supabase, and GraphQL Code Generator


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ How to Build and Test a Blog with Svelte and SvelteKit


๐Ÿ“ˆ 19.85 Punkte

๐Ÿ“Œ Building a SvelteKit Demo Page with Web Component and Passkey Login for passkeys.eu


๐Ÿ“ˆ 19.85 Punkte











matomo