integration-garage/peertube/shell.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

2021-11-08 15:01:24 +00:00
{
pkgs ? import <nixpkgs> {}
}:
with pkgs; mkShell {
shellHook = ''
PEERTUBE=${peertube}
function deploy {
2022-01-21 15:31:43 +00:00
rm -rf /tmp/{psql,peertube}
2021-11-08 15:01:24 +00:00
mkdir -p /tmp/peertube/{config,storage}
cp -r $PEERTUBE /tmp/peertube/code
mkdir /tmp/psql
initdb -D /tmp/psql/ --no-locale --encoding=UTF8
pg_ctl -D /tmp/psql -l logfile -o "--unix_socket_directories='$PWD'" start
createdb -h $PWD peertube
psql -h $PWD peertube -c "CREATE EXTENSION pg_trgm;"
psql -h $PWD peertube -c "CREATE EXTENSION unaccent;"
cp $PEERTUBE/config/default.yaml /tmp/peertube/config/default.yaml
cp production.yaml /tmp/peertube/config/production.yaml
2022-01-21 15:31:43 +00:00
echo "you must set aws keys in the peertube's config. opening vim in 3 seconds."
sleep 3
vim "/tmp/peertube/config/production.yaml"
echo "Launch redis-server"
redis-server &
sleep 3
2021-11-08 15:01:24 +00:00
cd /tmp/peertube/code
export NODE_ENV=production
export NODE_CONFIG_DIR=/tmp/peertube/config
node dist/server.js
2022-01-21 15:31:43 +00:00
# npm run reset-password -- -u root # to set/change root password
2021-11-08 15:01:24 +00:00
# pg_ctl -D /tmp/psql stop
# stop redis
}
'';
nativeBuildInputs = [
peertube
postgresql_14
curl
unzip
nodejs-16_x
yarn
ffmpeg
openssl
redis
gcc
nginx
];
}