Build from Source (Advanced)
This method is not recommended for most users. It is intended for advanced users who are familiar with managing their own server infrastructure.
Refer to Configuring Databases for details on how to configure your database.
Prerequisites
Unix (Linux, macOS)
Installation
- Assuming you want the working directory to be
/opt/foreseerr, create the directory and navigate to it:
sudo mkdir -p /opt/foreseerr && cd /opt/foreseerr
- Clone the Foreseerr repository. Use a release tag for production, or
developfor the latest unreleased work:
git clone https://github.com/selmant/foreseerr.git .
git checkout v0.8.1
- Install the dependencies:
CYPRESS_INSTALL_BINARY=0 bun install --frozen-lockfile
- Build the project:
bun run build
- Start Foreseerr:
bun run start
You can now access Foreseerr by visiting http://localhost:5055 in your web browser.
Extending the installation
- Linux
- macOS
- PM2
To run Foreseerr as a systemd service:
- create the environment file at
/etc/foreseerr/foreseerr.conf:
## Foreseerr's default port is 5055, if you want to use both, change this.
## specify on which port to listen
PORT=5055
## specify on which interface to listen, by default Foreseerr listens on all interfaces
#HOST=127.0.0.1
## Uncomment if you want to force Node.js to resolve IPv4 before IPv6 (advanced users only)
# FORCE_IPV4_FIRST=true
- Then run the following commands:
which bun
Copy the path to bun, it should be something like /usr/bin/bun.
- Create the systemd service file at
/etc/systemd/system/foreseerr.service, using eithersudo systemctl edit --force --full foreseerrorsudo nano /etc/systemd/system/foreseerr.service:
[Unit]
Description=Foreseerr Service
Wants=network-online.target
After=network-online.target
[Service]
EnvironmentFile=/etc/foreseerr/foreseerr.conf
Environment=NODE_ENV=production
Type=exec
Restart=on-failure
WorkingDirectory=/opt/foreseerr
ExecStart=/usr/bin/bun dist/launcher.js
[Install]
WantedBy=multi-user.target
If you are using a different path to bun, replace /usr/bin/bun with the path to bun.
- Enable and start the service:
sudo systemctl enable foreseerr
sudo systemctl start foreseerr
To run Foreseerr as a launchd service:
- Find the path to bun:
which bun
Copy the path to bun, it should be something like /usr/local/bin/bun.
- Create a launchd plist file at
~/Library/LaunchAgents/com.foreseerr.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.foreseerr</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/bun</string>
<string>/opt/foreseerr/dist/launcher.js</string>
</array>
<key>WorkingDirectory</key>
<string>/opt/foreseerr</string>
<key>EnvironmentVariables</key>
<dict>
<key>NODE_ENV</key>
<string>production</string>
<key>PORT</key>
<string>5055</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>
If you are using a different path to bun, replace /usr/local/bin/bun with the path to bun.
- Load the service:
launchctl load ~/Library/LaunchAgents/com.foreseerr.plist
- Start the service:
launchctl start com.foreseerr
To run Foreseerr as a PM2 service:
- Install PM2:
npm install -g pm2
- Start Foreseerr with PM2:
NODE_ENV=production pm2 start dist/launcher.js --name foreseerr
- Save the process list:
pm2 save
- Ensure PM2 starts on boot:
pm2 startup
Managing the service
- To start the service:
pm2 start foreseerr
- To stop the service:
pm2 stop foreseerr
- To restart the service:
pm2 restart foreseerr
- To view the logs:
pm2 logs foreseerr
- To view the status:
pm2 status foreseerr
Windows
Installation
- Assuming you want the working directory to be
C:\foreseerr, create the directory and navigate to it:
mkdir C:\foreseerr
cd C:\foreseerr
- Clone the Foreseerr repository. Use a release tag for production, or
developfor the latest unreleased work:
git clone https://github.com/selmant/foreseerr.git .
git checkout v0.8.1
- Install the dependencies:
$env:CYPRESS_INSTALL_BINARY = 0; bun install --frozen-lockfile
- Build the project:
bun run build
- Start Foreseerr:
bun run start
You can add the environment variables to a .env file in the Foreseerr directory.
You can now access Foreseerr by visiting http://localhost:5055 in your web browser.
Extending the installation
- Task Scheduler
- NSSM
- PM2
To run Foreseerr as a bat script:
- Create a file named
start-foreseerr.batin the Foreseerr directory:
@echo off
set PORT=5055
set NODE_ENV=production
bun dist/launcher.js
- Create a task in Task Scheduler:
- Open Task Scheduler
- Click on "Create Basic Task"
- Name the task "Foreseerr"
- Set the trigger to "When the computer starts"
- Set the action to "Start a program"
- Set the program/script to the path of the
start-foreseerr.batfile - Set the "Start in" to the Foreseerr directory.
- Click "Finish"
Now, Foreseerr will start when the computer boots up in the background.
To run Foreseerr as a service:
- Download the Non-Sucking Service Manager
- Install NSSM:
nssm install Foreseerr "C:\Users\%USERNAME%\.bun\bin\bun.exe" "C:\foreseerr\dist\launcher.js"
nssm set Foreseerr AppDirectory "C:\foreseerr"
nssm set Foreseerr AppEnvironmentExtra NODE_ENV=production
- Start the service:
nssm start Foreseerr
- To ensure the service starts on boot, run the following command:
nssm set Foreseerr Start SERVICE_AUTO_START
To run Foreseerr as a PM2 service:
- Install PM2:
npm install -g pm2
- Start Foreseerr with PM2:
$env:NODE_ENV = "production"; pm2 start dist/launcher.js --name foreseerr
- Save the process list:
pm2 save
- Ensure PM2 starts on boot:
pm2 startup
Managing the service
- To start the service:
pm2 start foreseerr
- To stop the service:
pm2 stop foreseerr
- To restart the service:
pm2 restart foreseerr
- To view the logs:
pm2 logs foreseerr
- To view the status:
pm2 status foreseerr
Updating
To update Foreseerr, navigate to the Foreseerr directory, fetch the tag or branch you want, then rebuild and restart:
git fetch --tags
git checkout v0.8.1
bun install --frozen-lockfile
bun run build
Then restart the process or service you configured above.