70 lines
1.8 KiB
Markdown
70 lines
1.8 KiB
Markdown
# Getting started with developing
|
|
1. Clone the repository.
|
|
2. Install and configure Postgresql. Create a new database for brass: `createdb brass`.
|
|
3. TODO: Configure DB name, DB user & pass, DB connection string, ...
|
|
4. Install sqlx-cli: `cargo install sqlx-cli`
|
|
5. Migrate the database: `sqlx database setup`
|
|
6. Create superuse: `cargo r -- createadmin`
|
|
|
|
## Useful stuff
|
|
- cargo-watch, cargo-add
|
|
- mailtutan
|
|
|
|
|
|
## Example Deployment OpenBSD
|
|
```
|
|
#!/bin/ksh
|
|
|
|
DATABASE_URL=postgresql://brass:pw@localhost/brass
|
|
SECRET_KEY=""
|
|
HOSTNAME="brass.tfld.de"
|
|
SERVER_ADDRESS="127.0.0.1"
|
|
SERVER_PORT="8081"
|
|
SMTP_SERVER="localhost"
|
|
SMTP_PORT="25"
|
|
SMTP_TLSTYPE="none"
|
|
ENVLIST="DATABASE_URL=$DATABASE_URL SECRET_KEY=$SECRET_KEY HOSTNAME=$HOSTNAME SERVER_ADDRESS=$SERVER_ADDRESS SERVER_PORT=$SERVER_PORT SMTP_SERVER=$SMTP_SERVER SMTP_PORT=$SMTP_PORT SMTP_TLSTYPE=$SMTP_TLSTYPE"
|
|
RUST_LOG="info,actix_server=error"
|
|
|
|
ENVLIST="DATABASE_URL=$DATABASE_URL SECRET_KEY=$SECRET_KEY HOSTNAME=$HOSTNAME SERVER_ADDRESS=$SERVER_ADDRESS SERVER_PORT=$SERVER_PORT SMTP_SERVER=$SMTP_SERVER SMTP_LOGIN=$SMTP_LOGIN SMTP_PASSWORD=$SMTP_PASSWORD SMTP_PORT=$SMTP_PORT SMTP_TLSTYPE=$SMTP_TLSTYPE RUST_LOG=$RUST_LOG"
|
|
|
|
daemon="$ENVLIST /usr/local/bin/brass"
|
|
daemon_user="www"
|
|
daemon_logger="daemon.info"
|
|
|
|
. /etc/rc.d/rc.subr
|
|
|
|
pexp=".*/usr/local/bin/brass.*"
|
|
|
|
rc_bg=YES
|
|
|
|
rc_cmd $1
|
|
```
|
|
|
|
|
|
```ini
|
|
# Postgres
|
|
# DATABASE_URL=postgres://postgres@localhost/my_database
|
|
# SQLite
|
|
DATABASE_URL=postgresql://brass:password@localhost/brass
|
|
# 64 byte long
|
|
SECRET_KEY="secret key"
|
|
HOSTNAME="brass.tfld.de"
|
|
ADDRESS="127.0.0.1"
|
|
PORT="8081"
|
|
|
|
SMTP_SERVER="localhost"
|
|
SMTP_PORT="25"
|
|
# SMTP_LOGIN=""
|
|
# SMTP_PASSWORD=""
|
|
SMTP_TLSTYPE="none"
|
|
```
|
|
|
|
## drop test databases
|
|
```bash
|
|
for dbname in $(psql -c "copy (select datname from pg_database where datname like 'brass_test_%') to stdout") ; do
|
|
echo "$dbname"
|
|
#dropdb -i "$dbname"
|
|
done
|
|
```
|