nixos/peertube: use redis.servers
This commit is contained in:
parent
cc2ead5d96
commit
0b1340f57b
@ -1925,6 +1925,28 @@
|
|||||||
<programlisting language="bash">
|
<programlisting language="bash">
|
||||||
redis-cli save
|
redis-cli save
|
||||||
cp /var/lib/redis/dump.rdb "/var/lib/redis-mastodon/dump.rdb"
|
cp /var/lib/redis/dump.rdb "/var/lib/redis-mastodon/dump.rdb"
|
||||||
|
</programlisting>
|
||||||
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Peertube now uses services.redis.servers to start a new redis
|
||||||
|
server, instead of using a global redis server. This improves
|
||||||
|
compatibility with other services that use redis.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Redis database is used for storage only cache and job queue.
|
||||||
|
More information can be found here -
|
||||||
|
<link xlink:href="https://docs.joinpeertube.org/contribute-architecture">Peertube
|
||||||
|
architecture</link>.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
If you do want to save the redis database, you can use the
|
||||||
|
following commands before upgrade OS:
|
||||||
|
</para>
|
||||||
|
<programlisting language="bash">
|
||||||
|
redis-cli save
|
||||||
|
sudo mkdir /var/lib/redis-peertube
|
||||||
|
sudo cp /var/lib/redis/dump.rdb /var/lib/redis-peertube/dump.rdb
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</listitem>
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -718,6 +718,17 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||||||
redis-cli save
|
redis-cli save
|
||||||
cp /var/lib/redis/dump.rdb "/var/lib/redis-mastodon/dump.rdb"
|
cp /var/lib/redis/dump.rdb "/var/lib/redis-mastodon/dump.rdb"
|
||||||
```
|
```
|
||||||
|
- Peertube now uses services.redis.servers to start a new redis server, instead of using a global redis server.
|
||||||
|
This improves compatibility with other services that use redis.
|
||||||
|
|
||||||
|
Redis database is used for storage only cache and job queue. More information can be found here - [Peertube architecture](https://docs.joinpeertube.org/contribute-architecture).
|
||||||
|
|
||||||
|
If you do want to save the redis database, you can use the following commands before upgrade OS:
|
||||||
|
```bash
|
||||||
|
redis-cli save
|
||||||
|
sudo mkdir /var/lib/redis-peertube
|
||||||
|
sudo cp /var/lib/redis/dump.rdb /var/lib/redis-peertube/dump.rdb
|
||||||
|
```
|
||||||
|
|
||||||
- If you are using Wayland you can choose to use the Ozone Wayland support
|
- If you are using Wayland you can choose to use the Ozone Wayland support
|
||||||
in Chrome and several Electron apps by setting the environment variable
|
in Chrome and several Electron apps by setting the environment variable
|
||||||
|
@ -209,7 +209,7 @@ in {
|
|||||||
|
|
||||||
port = lib.mkOption {
|
port = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.port;
|
type = lib.types.nullOr lib.types.port;
|
||||||
default = if cfg.redis.createLocally && cfg.redis.enableUnixSocket then null else 6379;
|
default = if cfg.redis.createLocally && cfg.redis.enableUnixSocket then null else 31638;
|
||||||
defaultText = lib.literalExpression ''
|
defaultText = lib.literalExpression ''
|
||||||
if config.${opt.redis.createLocally} && config.${opt.redis.enableUnixSocket}
|
if config.${opt.redis.createLocally} && config.${opt.redis.enableUnixSocket}
|
||||||
then null
|
then null
|
||||||
@ -344,7 +344,7 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.redis.enableUnixSocket { redis = { socket = "/run/redis/redis.sock"; }; })
|
(lib.mkIf cfg.redis.enableUnixSocket { redis = { socket = "/run/redis-peertube/redis.sock"; }; })
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
@ -441,13 +441,17 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.redis = lib.mkMerge [
|
services.redis.servers.peertube = lib.mkMerge [
|
||||||
(lib.mkIf cfg.redis.createLocally {
|
(lib.mkIf cfg.redis.createLocally {
|
||||||
enable = true;
|
enable = true;
|
||||||
})
|
})
|
||||||
|
(lib.mkIf (cfg.redis.createLocally && !cfg.redis.enableUnixSocket) {
|
||||||
|
bind = "127.0.0.1";
|
||||||
|
port = cfg.redis.port;
|
||||||
|
})
|
||||||
(lib.mkIf (cfg.redis.createLocally && cfg.redis.enableUnixSocket) {
|
(lib.mkIf (cfg.redis.createLocally && cfg.redis.enableUnixSocket) {
|
||||||
unixSocket = "/run/redis/redis.sock";
|
unixSocket = "/run/redis-peertube/redis.sock";
|
||||||
unixSocketPerm = 770;
|
unixSocketPerm = 660;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -465,7 +469,7 @@ in {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
(lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ cfg.package peertubeEnv peertubeCli pkgs.ffmpeg pkgs.nodejs-16_x pkgs.yarn ])
|
(lib.attrsets.setAttrByPath [ cfg.user "packages" ] [ cfg.package peertubeEnv peertubeCli pkgs.ffmpeg pkgs.nodejs-16_x pkgs.yarn ])
|
||||||
(lib.mkIf cfg.redis.enableUnixSocket {${config.services.peertube.user}.extraGroups = [ "redis" ];})
|
(lib.mkIf cfg.redis.enableUnixSocket {${config.services.peertube.user}.extraGroups = [ "redis-peertube" ];})
|
||||||
];
|
];
|
||||||
|
|
||||||
users.groups = lib.optionalAttrs (cfg.group == "peertube") {
|
users.groups = lib.optionalAttrs (cfg.group == "peertube") {
|
||||||
|
@ -11,7 +11,7 @@ import ../make-test-python.nix ({pkgs, ...}:
|
|||||||
{ address = "192.168.2.10"; prefixLength = 24; }
|
{ address = "192.168.2.10"; prefixLength = 24; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
firewall.allowedTCPPorts = [ 5432 6379 ];
|
firewall.allowedTCPPorts = [ 5432 31638 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
@ -34,7 +34,7 @@ import ../make-test-python.nix ({pkgs, ...}:
|
|||||||
enable = true;
|
enable = true;
|
||||||
bind = "0.0.0.0";
|
bind = "0.0.0.0";
|
||||||
requirePass = "turrQfaQwnanGbcsdhxy";
|
requirePass = "turrQfaQwnanGbcsdhxy";
|
||||||
port = 6379;
|
port = 31638;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,6 +76,7 @@ import ../make-test-python.nix ({pkgs, ...}:
|
|||||||
|
|
||||||
redis = {
|
redis = {
|
||||||
host = "192.168.2.10";
|
host = "192.168.2.10";
|
||||||
|
port = 31638;
|
||||||
passwordFile = "/etc/peertube/password-redis-db";
|
passwordFile = "/etc/peertube/password-redis-db";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ import ../make-test-python.nix ({pkgs, ...}:
|
|||||||
database.wait_for_unit("redis-peertube.service")
|
database.wait_for_unit("redis-peertube.service")
|
||||||
|
|
||||||
database.wait_for_open_port(5432)
|
database.wait_for_open_port(5432)
|
||||||
database.wait_for_open_port(6379)
|
database.wait_for_open_port(31638)
|
||||||
|
|
||||||
server.wait_for_unit("peertube.service")
|
server.wait_for_unit("peertube.service")
|
||||||
server.wait_for_open_port(9000)
|
server.wait_for_open_port(9000)
|
||||||
|
Loading…
Reference in New Issue
Block a user