Skip to content

Commit

Permalink
Make docker image work for manual use
Browse files Browse the repository at this point in the history
  • Loading branch information
mmgoodnow committed Oct 11, 2020
1 parent a6c1967 commit 4030414
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 47 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ COPY package*.json ./
RUN npm ci --only=production
VOLUME /config /torrents /output
ENV CONFIG_DIR=/config
COPY . .
ENV DOCKER_ENV=true
COPY src src
RUN npm link
EXPOSE 2468
CMD cross-seed gen-config --docker; cross-seed daemon
ENTRYPOINT ["cross-seed"]
93 changes: 49 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ delivery into your client.
- [Node 10+](https://nodejs.org/en/download)
- [Jackett](https://github.com/Jackett/Jackett)

It will work on Mac and on Linux; I haven't tested it on Windows but it probably
works there too.
It will work on Mac and on Linux; I haven't tested it on Windows but it may work
there too.

## Usage

Expand All @@ -29,7 +29,11 @@ npx cross-seed
Here's an example invocation:

```shell script
npx cross-seed search -u http://localhost:9117/jackett -k JACKETT_API_KEY -d 10 -t all -i /home/rtorrent/.session -s /tmp/torrents
npx cross-seed search \
--jackett-server-url http://localhost:9117/jackett \
--jackett-api-key JACKETT_API_KEY \
--torrent-dir /home/rtorrent/.session \
--output-dir /tmp/torrents
```

You either need to give it a lot of command-line arguments or create a
Expand All @@ -56,6 +60,44 @@ Options:
-h, --help display help for command
```

## Standalone installation

You don't need to install this app, but if you really want to, or if your
version of `npm` doesn't support `npx`, you can install it globally:

```shell script
npm install -g cross-seed
```

Then you can run the app with:

```shell script
cross-seed
```

To update,

```shell script
npm update -g cross-seed
```

## Configuration

`cross-seed` will look for a configuration file at `~/.cross-seed/config.js`
(`AppData\Local\cross-seed\config.js` on Windows). In the configuration file ,
you can specify all of the same flags you specified on the command line, but
after that, you won't have to specify them on the command line any more. If you
would like to use a different directory than the default, you can set the
`CONFIG_DIR` environment variable.

To create a configuration file, run

```shell script
cross-seed gen-config
```

Then you can edit the file using your editor of choice.

## Daemon Mode (rtorrent only, Docker recommended)

`cross-seed` has a new feature called daemon mode. It starts an HTTP server,
Expand Down Expand Up @@ -83,10 +125,10 @@ services:
- /path/to/output/folder:/output
ports:
- 2468:2468
command: daemon
```
While the daemon is running, you can trigger a search with an HTTP
request:
While the daemon is running, you can trigger a search with an HTTP request:
```shell script
curl -XPOST http://localhost:2468/api/webhook --data '<torrent name here>'
Expand All @@ -100,49 +142,12 @@ to run the `curl` command on finished download.

If you don't want to use Docker, you can run the `cross-seed` daemon as a
systemd service, or inside a `screen` instance. If you choose to do this, you
will probably want to [fully install the app](#install).
will probably want to [fully install the app](#standalone-installation).

To start the daemon, issue the following command inside a `screen`:

```shell script
cross-seed daemon
```
Then detach from the screen.

## Install

You don't need to install this app, but if you really want to, or if your
version of `npm` doesn't support `npx`, you can install it globally:

```shell script
npm install -g cross-seed
```

Then you can run the app with:

```shell script
cross-seed
```

To update,

```shell script
npm update -g cross-seed
```

## Configuration

`cross-seed` will look for a configuration file at `~/.cross-seed/config.js`
(`AppData\Local\cross-seed\config.js` on Windows). In the configuration file ,
you can specify all of the same flags you specified on the command line, but
after that, you won't have to specify them on the command line any more. If you
would like to use a different directory than the default, you can set the
`CONFIG_DIR` environment variable.

To create a configuration file, run

```shell script
cross-seed gen-config
```

Then you can edit the file using your editor of choice.
Then detach from the screen.
6 changes: 5 additions & 1 deletion src/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { main } = require("./index");
const { CONFIG, generateConfig } = require("./configuration");
const { clear: clearCache } = require("./cache");
const { serve } = require("./server");
require("./signalHandlers");

function addSharedOptions() {
return this.requiredOption(
Expand All @@ -22,7 +23,7 @@ function addSharedOptions() {
.requiredOption(
"-t, --trackers <tracker>",
"Comma-separated list of Jackett tracker ids to search",
CONFIG.trackers && CONFIG.trackers.join(",")
CONFIG.trackers ? CONFIG.trackers.join(",") : ""
)
.requiredOption(
"-i, --torrent-dir <dir>",
Expand Down Expand Up @@ -71,6 +72,9 @@ program
const options = command.opts();
options.trackers = options.trackers.split(",").filter((e) => e !== "");
try {
if (process.env.DOCKER_ENV === "true") {
generateConfig({ docker: true });
}
await serve(options);
} catch (e) {
console.error(chalk.bold.red(e.message));
Expand Down
2 changes: 2 additions & 0 deletions src/signalHandlers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
process.on("SIGINT", process.exit);
process.on("SIGTERM", process.exit);

0 comments on commit 4030414

Please sign in to comment.