Provide reference Systemd unit file. Resolves #72

This commit is contained in:
ngosang 2021-05-30 12:16:34 +02:00
parent 2f9fe05a76
commit 805a34c9d6
3 changed files with 28 additions and 2 deletions

View File

@ -67,13 +67,17 @@ This is the recommended way for Windows users.
### From source code
This is the recommended way for MacOS users and for developers.
This is the recommended way for macOS users and for developers.
* Install [NodeJS](https://nodejs.org/)
* Clone this repository and open a shell in that path
* Run `npm install` command to install FlareSolverr dependencies
* Run `npm run build` command to compile TypeScript code
* Run `npm start` command to start FlareSolverr
### Systemd service
We provide an example Systemd unit file `flaresolverr.service` as reference. You have to modify the file to suit your needs: paths, user and environment variables.
## Usage
Example request:

View File

@ -40,7 +40,7 @@ const version = 'v' + require('./package.json').version;
// generate executables
console.log('Generating executables...')
if (fs.existsSync('bin')) {
fs.rmdirSync('bin', { recursive: true })
fs.rmSync('bin', { recursive: true })
}
execSync('pkg -t node14-win-x64,node14-linux-x64 --out-path bin .')
// execSync('pkg -t node14-win-x64,node14-mac-x64,node14-linux-x64 --out-path bin .')
@ -76,6 +76,9 @@ const version = 'v' + require('./package.json').version;
archive.file('LICENSE', { name: 'flaresolverr/' + os.fsLicenseName })
archive.file('bin/' + os.fsExec, { name: 'flaresolverr/' + os.fsZipExec })
archive.directory('bin/puppeteer/' + os.platform + '-' + os.version + '/' + os.chromeFolder, 'flaresolverr/chrome')
if (os.platform === 'linux') {
archive.file('flaresolverr.service', { name: 'flaresolverr/flaresolverr.service' })
}
await archive.finalize()
}

19
flaresolverr.service Normal file
View File

@ -0,0 +1,19 @@
[Unit]
Description=FlareSolverr
After=network.target
[Service]
SyslogIdentifier=flaresolverr
Restart=always
RestartSec=5
Type=simple
User=flaresolverr
Group=flaresolverr
Environment="LOG_LEVEL=info"
Environment="CAPTCHA_SOLVER=none"
WorkingDirectory=/opt/flaresolverr
ExecStart=/opt/flaresolverr/flaresolverr
TimeoutStopSec=30
[Install]
WantedBy=multi-user.target