Ajout : letabli.cyclocoop.org.
[lhc/ateliers.git] / etc / nginx / site.d / cyclo-letabli / local.sh
diff --git a/etc/nginx/site.d/cyclo-letabli/local.sh b/etc/nginx/site.d/cyclo-letabli/local.sh
new file mode 100644 (file)
index 0000000..5b08cc6
--- /dev/null
@@ -0,0 +1,24 @@
+pool=cyclo_letabli
+sudo adduser php_"$pool" www-"$site"
+sudo adduser www-"$site" sftp
+
+sudo rmdir ~www-data/"$site" || true
+sudo install -d -m 2750 -o root -g www-"$site" \
+ ~www-data/"$site"
+sudo install -d -m 2750 -o www-"$site" -g www-"$site" \
+ ~www-data/"$site"/etc \
+ ~www-data/"$site"/etc/ssh
+sudo install -d -m 2770 -o www-"$site" -g www-"$site" \
+ ~www-data/"$site"/www
+
+"$tool"/local/runit-sv-configure postgres
+"$tool"/local/runit-sv-start     postgres
+while ! sudo -u postgres psql </dev/null
+do sleep 1; done
+
+"$tool"/local/postgresql-user-create     "$pool"
+"$tool"/local/postgresql-database-create "$pool"
+"$tool"/local/postgresql-schema-create   "$pool"
+sudo -u postgres psql -AqtX --set ON_ERROR_STOP=1 "$pool" <<-EOF
+       GRANT USAGE ON SCHEMA pg_catalog TO $pool;
+       EOF