mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-30 20:27:20 +00:00
Merge branch 'minor_changes' of https://github.com/StaticallyTypedRice/lemmy into StaticallyTypedRice-minor_changes
This commit is contained in:
commit
e900313f6e
9
docs/src/administration_configuration.md
vendored
9
docs/src/administration_configuration.md
vendored
|
@ -6,3 +6,12 @@ Additionally, you can override any config files with environment variables. Thes
|
|||
`LEMMY__DATABASE__POOL_SIZE=10`.
|
||||
|
||||
An additional option `LEMMY_DATABASE_URL` is available, which can be used with a PostgreSQL connection string like `postgres://lemmy:password@lemmy_db:5432/lemmy`, passing all connection details at once.
|
||||
|
||||
If the Docker container is not used, manually create the database specified above by running the following commands:
|
||||
|
||||
```bash
|
||||
# Start at the root of the Lemmy repository
|
||||
|
||||
cd server
|
||||
./db-init.sh
|
||||
```
|
||||
|
|
15
docs/src/contributing_local_development.md
vendored
15
docs/src/contributing_local_development.md
vendored
|
@ -7,9 +7,18 @@
|
|||
#### Set up Postgres DB
|
||||
|
||||
```bash
|
||||
psql -c "create user lemmy with password 'password' superuser;" -U postgres
|
||||
psql -c 'create database lemmy with owner lemmy;' -U postgres
|
||||
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
|
||||
# Start at the root of the Lemmy repository
|
||||
|
||||
cd server
|
||||
./db-init.sh
|
||||
```
|
||||
|
||||
Or run the commands manually:
|
||||
|
||||
```bash
|
||||
psql -c "create user lemmy with password 'password' superuser;" -U postgres
|
||||
psql -c 'create database lemmy with owner lemmy;' -U postgres
|
||||
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy
|
||||
```
|
||||
|
||||
#### Running
|
||||
|
|
43
server/db-init.sh
vendored
Normal file
43
server/db-init.sh
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/bash
|
||||
|
||||
username=lemmy
|
||||
dbname=lemmy
|
||||
port=5432
|
||||
|
||||
password=""
|
||||
password_confirm=""
|
||||
password_valid=0
|
||||
|
||||
while [ "$password_valid" == 0 ]
|
||||
do
|
||||
read -p "Enter database password: " -s password
|
||||
echo
|
||||
|
||||
read -p "Verify database password: " -s password_confirm
|
||||
echo
|
||||
echo
|
||||
|
||||
# Start the loop from the top if either check fails
|
||||
if [ -z "$password" ]
|
||||
then
|
||||
echo "Error: Password cannot be empty." 1>&2
|
||||
echo
|
||||
continue
|
||||
fi
|
||||
if [ "$password" != "$password_confirm" ]
|
||||
then
|
||||
echo "Error: Passwords don't match." 1>&2
|
||||
echo
|
||||
continue
|
||||
fi
|
||||
|
||||
# Set the password_valid variable to break out of the loop
|
||||
password_valid=1
|
||||
done
|
||||
|
||||
|
||||
psql -c "CREATE USER $username WITH PASSWORD '$password' SUPERUSER;" -U postgres
|
||||
psql -c 'CREATE DATABASE $dbname WITH OWNER $username;' -U postgres
|
||||
export LEMMY_DATABASE_URL=postgres://$username:$password@localhost:$port/$dbname
|
||||
|
||||
echo $LEMMY_DATABASE_URL
|
Loading…
Reference in a new issue