Skip to content

Commit

Permalink
Add two torrent folders and two media folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Galushko committed Jan 17, 2024
1 parent 29085ad commit df025d6
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 103 deletions.
18 changes: 18 additions & 0 deletions config/examples/docker-compose/constants.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
RABBITMQ_DEFAULT_USER=rabbit_user
RABBITMQ_DEFAULT_PASS=rabbit_pswrd
RABBIT_PORT=5672
RABBIT_IP=<input>
TORRENT_IP="[{\"ip\": \"<input>\",\"port\": \"9093\"}, {\"name\": \"hdd\",\"ip\": \"<input>\",\"port\": \"9092\"}]"

BOT_TOKEN=<input>
BOT_NAME=<input>
BOT_TRUSTED_USERS=<input>

LONG_PAUSE_MILIS=10000
MEDIUM_PAUSE_MILIS=5000
SMALL_PAUSE_MILIS=500

PING=/ping
PONG=pong

LOGS_LEVEL=info
19 changes: 0 additions & 19 deletions config/examples/docker-compose/constants.yml

This file was deleted.

16 changes: 8 additions & 8 deletions config/examples/docker-compose/docker-compose-bot.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
version: '3.7'

x-common-variables: &common-variables
extends:
file: constants.yml
service: common-variables
services:
torrent:
image: halushko/cinema-torrent:alpha
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "torrent"
volumes:
Expand All @@ -17,7 +14,8 @@ services:
network_mode: host
bot:
image: halushko/cinema-bot:alpha
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "bot"
volumes:
Expand All @@ -26,7 +24,8 @@ services:
bot_network_local:
text:
image: halushko/cinema-text:alpha
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "text"
volumes:
Expand All @@ -35,7 +34,8 @@ services:
bot_network_local:
file:
image: halushko/cinema-file:alpha
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "file"
volumes:
Expand Down
38 changes: 19 additions & 19 deletions config/examples/docker-compose/docker-compose-bot_debug.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
version: '3.7'

x-common-variables: &common-variables
extends:
file: constants.yml
service: common-variables
services:
torrent_debug:
image: halushko/cinema-torrent:beta
environment: *common-variables
restart: always
container_name: "torrent_debug"
volumes:
- ./workdir/config/transmission:/home/app/transmission_config
- ./workdir/config/logs:/home/app/logs
network_mode: host
# torrent_debug:
# image: halushko/cinema-torrent:beta
# env_file:
# - constants.env
# restart: always
# container_name: "torrent_debug"
# volumes:
# - ./workdir/config/transmission:/home/app/transmission_config
# - ./workdir/config/logs:/home/app/logs
# network_mode: host
bot_debug:
image: halushko/cinema-bot:beta
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "bot_debug"
volumes:
- ./workdir/config/logs:/home/app/logs
networks:
at_private_network_debug:
bot_network_debug:
text_debug:
image: halushko/cinema-text:beta
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "text_debug"
volumes:
- ./workdir/config/logs:/home/app/logs
networks:
at_private_network_debug:
bot_network_debug:
file_debug:
image: halushko/cinema-file:beta
environment: *common-variables
env_file:
- constants.env
restart: always
container_name: "file_debug"
volumes:
- ./workdir/config/files_from_telegram:/home/torrent_files/
- ./workdir/config/logs:/home/app/logs
networks:
at_private_network_debug:
bot_network_debug:
networks:
bot_network_debug:
driver: bridge
4 changes: 2 additions & 2 deletions config/examples/docker-compose/docker-compose-media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- VERSION=docker
volumes:
- ./workdir/config/plex/config:/config
- ./workdir/mediadata:/movies/local
- ./workdir/mediadata_hdd:/movies/hdd
- ./workdir/mediadata:/movies
# - ./workdir/mediadata_hdd:/movies/hdd
restart: unless-stopped
network_mode: host
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Shut down Bot
Requires=docker.service
After=message_broker.service
After=message-broker.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Bot update
Requires=docker.service
After=bot_down.service
After=bot-down.service

[Service]
Type=oneshot
Expand Down
4 changes: 2 additions & 2 deletions config/examples/etc/systemd/services/bot.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Bot start
Requires=message_broker.service
After=bot_pull.service
Requires=docker.service
After=bot-pull.service

[Service]
Type=oneshot
Expand Down
66 changes: 33 additions & 33 deletions config/examples/etc/systemd/services/create_services.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
#!/bin/bash

systemctl stop bot.service
systemctl stop bot_debug_down.service
systemctl stop bot_down.service
systemctl stop bot_pull.service
systemctl stop media_server.service
systemctl stop media_server_down.service
systemctl stop media_server_pull.service
systemctl stop message_broker.service
systemctl stop message_broker_down.service
systemctl stop message_broker_pull.service
systemctl stop bot-debug-down.service
systemctl stop bot-down.service
systemctl stop bot-pull.service
systemctl stop media-server.service
systemctl stop media-server-down.service
systemctl stop media-server-pull.service
systemctl stop message-broker.service
systemctl stop message-broker-down.service
systemctl stop message-broker-pull.service
systemctl stop torrent.service
systemctl stop torrent_down.service
systemctl stop torrent_pull.service
systemctl stop torrent-down.service
systemctl stop torrent-pull.service
systemctl stop torrent-hdd.service
systemctl stop torrent-hdd-down.service
systemctl stop torrent-hdd-pull.service

systemctl disable bot.service
systemctl disable bot_debug_down.service
systemctl disable bot_down.service
systemctl disable bot_pull.service
systemctl disable media_server.service
systemctl disable media_server_down.service
systemctl disable media_server_pull.service
systemctl disable message_broker.service
systemctl disable message_broker_down.service
systemctl disable message_broker_pull.service
systemctl disable bot-debug-down.service
systemctl disable bot-down.service
systemctl disable bot-pull.service
systemctl disable media-server.service
systemctl disable media-server-down.service
systemctl disable media-server-pull.service
systemctl disable message-broker.service
systemctl disable message-broker-down.service
systemctl disable message-broker-pull.service
systemctl disable torrent.service
systemctl disable torrent_down.service
systemctl disable torrent_pull.service
systemctl disable torrent-down.service
systemctl disable torrent-pull.service
systemctl disable torrent-hdd.service
systemctl disable torrent-hdd-down.service
systemctl disable torrent-hdd-pull.service

cp -f *.service /etc/systemd/system

systemctl enable bot.service
systemctl enable bot_debug_down.service
systemctl enable bot_down.service
systemctl enable bot_pull.service
systemctl enable media_server.service
systemctl enable media_server_down.service
systemctl enable media_server_pull.service
systemctl enable message_broker.service
systemctl enable message_broker_down.service
systemctl enable message_broker_pull.service
systemctl enable bot-debug-down.service
systemctl enable bot-down.service
systemctl enable bot-pull.service
systemctl enable media-server.service
systemctl enable media-server-down.service
systemctl enable media-server-pull.service
systemctl enable message-broker.service
systemctl enable message-broker-down.service
systemctl enable message-broker-pull.service
systemctl enable torrent.service
systemctl enable torrent_down.service
systemctl enable torrent_pull.service
systemctl enable torrent-down.service
systemctl enable torrent-pull.service
systemctl enable torrent-hdd.service
systemctl enable torrent-hdd-down.service
systemctl enable torrent-hdd-pull.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Media server update
Requires=docker.service
After=media_server_down.service
After=media-server-down.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Media server start
Requires=docker.service
After=media_server_pull.service
After=media-server-pull.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Message brocker Service
Requires=docker.service
After=message_broker_down.service
After=message-broker-down.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Message broker start
Requires=docker.service
After=message_broker_pull.service
After=message-broker-pull.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Torrent update
Requires=docker.service
After=torrent_down.service
After=torrent-hdd-down.service

[Service]
Type=oneshot
Expand Down
2 changes: 1 addition & 1 deletion config/examples/etc/systemd/services/torrent-hdd.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Torrent start
Requires=docker.service
After=bot.service
After=torrent-hdd-pull.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Torrent update
Requires=docker.service
After=torrent_down.service
After=torrent-down.service

[Service]
Type=oneshot
Expand Down
2 changes: 1 addition & 1 deletion config/examples/etc/systemd/services/torrent.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=Torrent start
Requires=docker.service
After=bot.service
After=torrent-pull.service

[Service]
Type=oneshot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@SuppressWarnings("unused")
@Slf4j
public abstract class InputMessageHandlerApiRequest extends InputMessageHandler {
private final Map<String, String> serverUrls = new LinkedHashMap<>();
protected final Map<String, String> serverUrls = new LinkedHashMap<>();

public InputMessageHandlerApiRequest(String protocol, String ip, int port, String suffix) {
this.serverUrls.put("default", String.format("%s://%s:%s/%s", protocol, ip, port, suffix));
Expand All @@ -33,12 +33,12 @@ public InputMessageHandlerApiRequest(String urls) {
.map((x -> (Map<String, Object>) x))
.forEach(
x -> this.serverUrls.put(
String.valueOf(x.containsValue("name") ? x.get("name") : "default"),
String.valueOf(x.getOrDefault("name", "default")),
String.format("%s://%s:%s/%s",
x.containsValue("protocol") ? x.get("protocol") : "http",
x.get("ip"),
x.get("port"),
x.containsValue("suffix") ? x.get("suffix") : "transmission/rpc"
x.getOrDefault("protocol", "http"),
x.getOrDefault("ip", "localhost"),
x.getOrDefault("port", "9091"),
x.getOrDefault("suffix", "transmission/rpc")
)
)
);
Expand Down
Loading

0 comments on commit df025d6

Please sign in to comment.