diff --git a/firefish.apache.conf b/docs/examples/iceshrimp.apache.conf similarity index 78% rename from firefish.apache.conf rename to docs/examples/iceshrimp.apache.conf index b0c69d51d..c0b901df7 100644 --- a/firefish.apache.conf +++ b/docs/examples/iceshrimp.apache.conf @@ -1,7 +1,7 @@ -# Replace example.tld with your domain +# Replace example.com with your domain - ServerName example.tld + ServerName example.com # For WebSocket ProxyPass "/streaming" "ws://127.0.0.1:3000/streaming/" # Proxy to Node @@ -10,4 +10,4 @@ ProxyPreserveHost On # For files proxy AllowEncodedSlashes On - \ No newline at end of file + diff --git a/firefish.nginx.conf b/docs/examples/iceshrimp.nginx.conf similarity index 95% rename from firefish.nginx.conf rename to docs/examples/iceshrimp.nginx.conf index def7fe3a5..ff7b0b09d 100644 --- a/firefish.nginx.conf +++ b/docs/examples/iceshrimp.nginx.conf @@ -1,4 +1,4 @@ -# Replace example.tld with your domain +# Replace example.com with your domain # For WebSocket map $http_upgrade $connection_upgrade { @@ -11,7 +11,7 @@ proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache1:16m max_size=1g in server { listen 80; listen [::]:80; - server_name example.tld; + server_name example.com; # For SSL domain validation root /var/www/html; @@ -23,7 +23,7 @@ server { server { listen 443 ssl http2; listen [::]:443 ssl http2; - server_name example.tld; + server_name example.com; ssl_session_timeout 1d; ssl_session_cache shared:ssl_session_cache:10m; diff --git a/docs/examples/iceshrimp.service b/docs/examples/iceshrimp.service new file mode 100644 index 000000000..00ea358ee --- /dev/null +++ b/docs/examples/iceshrimp.service @@ -0,0 +1,15 @@ +[Unit] +Description=Iceshrimp daemon + +[Service] +Type=simple +User=iceshrimp +ExecStart=/usr/bin/yarn start +WorkingDirectory=/home/iceshrimp/iceshrimp +Environment="NODE_ENV=production" +TimeoutSec=60 +SyslogIdentifier=iceshrimp +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 000000000..f30bc6425 --- /dev/null +++ b/docs/install.md @@ -0,0 +1,126 @@ +# Installing Iceshrimp +This document will guide you through manual installation of Iceshrimp on dev branch, for main branch, use Firefish's installation guide. + +## Dependencies + +### Build +- **Rust** 1.68+ +- C/C++ compiler like **GCC** or **Clang** +- Build tools like **make** +- **Python 3** + +### Required +- [**Node.js**](https://nodejs.org) v18.16.0+ (v20 recommended) +- [**PostgreSQL**](https://www.postgresql.org/) 12+ (14 recommended) +- [**Redis**](https://redis.io/) 6+ (7 recommended) +- [**libvips**](https://www.libvips.org/) +- **Web proxy** + - nginx + - Caddy + +### Optional +- [**FFmpeg**](https://ffmpeg.org/) for video transcoding +- Full text search (Choose one) + Iceshrimp has full text search powered by Postgres by default, however it's very slow, and these are alternatives for that + - [**Meilisearch**](https://www.meilisearch.com/) | [Installation guide](https://www.meilisearch.com/docs/learn/getting_started/quick_start) + - [**Sonic**](https://crates.io/crates/sonic-server) (More lightweight, but less features) | [Installation guide](https://github.com/valeriansaliou/sonic#installation) +- Caching server (Choose one) + This will be used for storing stuff like antennas. If you won't install any, mandatory Redis instance will be used instead + - [**DragonflyDB**](https://www.dragonflydb.io/) | [Installation guide](https://www.dragonflydb.io/docs/getting-started) + - [**KeyDB**](https://docs.keydb.dev/) | [Installation guide](https://docs.keydb.dev/docs/open-source-getting-started) + - Another **Redis** server + +## Preparations + +### Download repository +```sh +git clone https://iceshrimp.dev/iceshrimp/iceshrimp +``` + +### Creating a new user +In case you want to run Iceshrimp as a different user, run `adduser --disabled-password --disabled-login iceshrimp` +Following steps will require you to run them as the user you have made, so use `su - iceshrimp`, or `sudo -iu iceshrimp`, or whatever else method in order to temporarily log in as that user. + +### Configuration +- Copy `.config/example.yml` to `.config/default.yml` +- Edit `.config/default.yml` with text editor + - Make sure to set PostgreSQL and Redis section correctly + - Make sure to set/uncomment caching server and/or text search sections if you happen to set up these too + +## Installing project dependencies +```sh +corepack enable +corepack prepare yarn@stable --activate +yarn +``` + + +## Building Iceshrimp +```sh +yarn build +``` +## Database +### Creating database +This will create a postgres user with your password and database, while also granting that user all privileges on database. +Using `psql` prompt: +```sh +sudo -u postgres psql +``` +```postgresql +create database iceshrimp with encoding = 'UTF8'; +create user iceshrimp with encrypted password '{YOUR_PASSWORD}'; +grant all privileges on database iceshrimp to iceshrimp; +\q +``` + +### First migration +In order for Iceshrimp to work properly, you need to initialise the database using +```bash +yarn run init +``` + +## Setting up Webproxy +### Nginx +- Run `sudo cp docs/examples/iceshrimp.nginx.conf /etc/nginx/sites-available/ && cd /etc/nginx/sites-available/` +- Edit `iceshrimp.nginx.conf` to reflect your server properly +- Run `sudo ln -s ./iceshrimp.nginx.conf ../sites-enabled/iceshrimp.nginx.conf` +- Run `sudo nginx -t` to check that the config is valid, then restart the nginx service. + +### Caddy +- Add the following to your Caddyfile, and replace `example.com` with your domain +``` +example.com { + reverse_proxy localhost:3000 +} +``` + +## Running Iceshrimp + +### Running manually +- Start Iceshrimp by running `yarn run start`. +If this is your first run, after Iceshrimp has started successfully, you'll be able to go to the URL you have specified in `.config/default.yml` and create first user. +- To stop the server, use `Ctrl-C`. + +### Running using systemd +- Run `sudo cp docs/examples/iceshrimp.service /etc/systemd/system/` +- Edit `/etc/systemd/system/iceshrimp.service` with text editor, and change `User`, `WorkingDir`, `ExecStart` if necessary. +- Run `sudo systemctl daemon-reload` +- Run `sudo systemctl enable --now iceshrimp` in order to enable and start Iceshrimp. +- (Optional) Check if instance is running using `sudo systemctl status iceshrimp` + +### Updating Iceshrimp +Shut down Iceshrimp and then run these commands + +```sh +## Do git stash commands only if you had made changes to the repo +git stash +git pull +git stash pop +yarn +NODE_ENV=production yarn build && yarn migrate +``` + +Start Iceshrimp back up + +## Post-install +See [post-install](post-install.md). diff --git a/docs/post-install.md b/docs/post-install.md new file mode 100644 index 000000000..243128f45 --- /dev/null +++ b/docs/post-install.md @@ -0,0 +1,30 @@ +# Post-install +This document describes things you can do after successfully installing Iceshrimp. + +## Automatic translation +### DeepL +- Create a Free or Pro API account on [DeepL's website](https://www.deepl.com/pro#developer) +- Copy the API key to Control Panel > General > DeepL Translation + - Check the "Pro account" switch if you registered for paid account + +### LibreTranslate +- Install [LibreTranslate](https://libretranslate.com/) +- Get an API URL and API key, copy and paste them into Control Panel > General > Libre Translate + +## Enabling push notifications +- Run `npx web-push generate-vapid-keys` + - `docker compose exec web npx web-push generate-vapid-keys` if using Docker Compose +- Put public and private keys into Control Panel > General > Service Worker + +## Object Storage (S3) +Recommended if using Docker +- Set up a bucket on provider's website (for example: AWS, Backblaze B2, Wasabi, minio or Google Cloud) +- Go to Control Panel > Object Storage and follow instructions + +## Customising assets, locale +- To add custom CSS for all users, edit ./custom/assets/instance.css. +- To add static assets (such as images for the splash screen), place them in the ./custom/assets/ directory. They'll then be available on https://example.com/static-assets/filename.ext. +- To add custom locales, place them in the ./custom/locales/ directory. If you name your custom locale the same as an existing locale, it will overwrite it. If you give it a unique name, it will be added to the list. Also make sure that the first part of the filename matches the locale you're basing it on. (Example: en-FOO.yml) +- To add custom error images, place them in the ./custom/assets/badges directory, replacing the files already there. +- To add custom sounds, place only mp3 files in the ./custom/assets/sounds directory. +- To update custom assets without rebuilding, just run pnpm run gulp.