postgres_config
This commit is contained in:
parent
86d41ac5c1
commit
14555ff7d5
2 changed files with 32 additions and 0 deletions
|
@ -1 +1,6 @@
|
|||
mt_version="5.3.0"
|
||||
first_install=Y
|
||||
|
||||
#This settings are applied only when first_install is set to Y
|
||||
psql_postgres_user_password="ExamplePassword"
|
||||
psql_minetest_user_password="ExamplePassword"
|
||||
|
|
27
setup-mt
27
setup-mt
|
@ -68,5 +68,32 @@ echo "RestartSec=3" >> /etc/systemd/system/minetestsrv.service
|
|||
echo "[Install]" >> /etc/systemd/system/minetestsrv.service
|
||||
echo "WantedBy=multi-user.target" >> /etc/systemd/system/minetestsrv.service
|
||||
systemctl daemon-reload
|
||||
|
||||
if [ $first_install = "Y" ]; then
|
||||
echo "Configuring firstinstall config"
|
||||
apt install postgresql postgresql-contrib -y
|
||||
pg_ctlcluster 12 main start
|
||||
|
||||
sudo -u postgres createuser minetest
|
||||
sudo -u postgres createdb minetest
|
||||
sudo -u postgres createdb minetest_players
|
||||
sudo -u postgres createdb minetest_auth
|
||||
sudo -u postgres psql -U postgres -d postgres -c "alter user postgres with password '$psql_postgres_user_password';"
|
||||
sudo -u postgres psql -U postgres -d postgres -c "alter user minetest with password '$psql_minetest_user_password';"
|
||||
|
||||
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database 'minetest' to minetest;"
|
||||
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database 'minetest_players' to minetest;"
|
||||
sudo -u postgres psql -U postgres -d postgres -c "grant all privileges on database 'minetest_auth' to minetest;"
|
||||
|
||||
echo "gameid = minetest" > /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "creative_mode = false" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "enable_damage = true" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "player_backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "auth_backend = postgresql" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "pgsql_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "pgsql_player_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest_players" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
echo "pgsql_auth_connection = host=127.0.0.1 user=minetest password=$psql_minetest_user_password dbname=minetest_auth" >> /home/minetest/.minetest/worlds/world/world.mt
|
||||
fi
|
||||
systemctl start minetestsrv
|
||||
systemctl enable minetestsrv
|
||||
|
|
Loading…
Reference in a new issue