title |
description |
Server Installation for Debian-based systems |
Welcome to our official documentation! |
Huge thanks to @airtag for creating this tutorial (Modified by @xbubbo)
Last updated: March 22nd, 2024.
Learn how to host the site on your server and and deploy it to the public.
Although this tutorial works on a homeserver, it's not recommended to give out Interstellar links hosted on your home network. Doing so will reveal your IP address to others.
Please ensure you have all prerequisites installed.
Ensure that git has been installed
```bash curl
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\ apt-get install -y nodejs
```
If the command fails run the following:
```bash apt
apt-get install nodejs -y
```
sudo apt install nodejs npm
Ensure that npm has been installed
Installing pnpm
Verifying pnpm has been installed
```bash pnpm
pnpm -v
```
```bash apt
sudo apt-get install curl
```
Verifying curl has been installed
```bash curl
curl -v
```
```bash npm
npm i -g pm2
```
```bash pm2
pm2 -v
```
```bash apt
apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
```
```bash curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
```
```bash curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
```
```bash apt
apt update
```
```bash apt
apt install caddy
```
### Installation
git clone https://github.com/InterstellarNetwork/Interstellar && cd Interstellar
```bash npm
npm install
```
```bash pnpm
pnpm install
```
If you want to start the site scaled across all available cores then run the following:
```bash pm2
pm2 start index.js -i max
```
If you want to start a select number of processes, replace the number with your choice.
```bash pm2
pm2 start index.js -i number
```
If you don't do this and your VPS shuts down, you'll have to start Interstellar manually using the steps above.
```bash pm2
pm2 startup
```
```bash pm2
pm2 save
```
## Configuring Caddy
This is how you add your domains to the server.
This is a very simple way to add domains to your caddyfile.
```bash nano
nano /etc/caddy/Caddyfile
```
Hold down Ctrl+K until the file is empty.
Create an A record on your domain pointing to your VPS's IP address. Usually, the name on the A record will be your subdomain. Make sure to add this into the Caddyfile below.
Make sure your domains are pointed at your server.
Your Caddyfile should look something like this, of course replacing the domains in the first line with actual domains/subdomains.
```bash nano
your-domain-here.com, 2nd-domain.com, 3rd.domain.com {
reverse_proxy localhost:8080
}
Save your Caddyfile by pressing Ctrl + X, then enter.
Then run
```bash systemctl
systemctl restart caddy
## Firewall & Updating
```bash apt-get
apt-get install ufw
```
Run
```bash ufw
ufw allow 22
```
If SSH is on another port, replace 22 with that port instead. This is mandatory, or you might lock yourself out of your VPS.
```bash ufw
ufw allow 443
```
If you have any other ports you need to allow, run
```bash ufw
ufw allow port-number
```
```bash ufw
ufw enable
```
```bash ufw
ufw reload
```
Make sure you are in the Interstellar directory
```bash git
git pull
```
```bash pm2
pm2 restart all
```
If you have multiple services running on pm2 and just want to restart Interstellar, find Interstellar's process ID and run
```bash pm2
pm2 restart process-id
```