Merge pull request #265 from Plume-org/sqlite-docs

Update docs for SQlite
This commit is contained in:
Baptiste Gelez 2018-10-06 18:25:23 +01:00 committed by GitHub
commit 7a64005ca9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 39 deletions

View File

@ -7,7 +7,7 @@ In order to be installed and to work correctly, Plume needs:
- *Git* (to get the code)
- *Curl* (for RustUp, the Rust installer)
- *GCC* and *make* (to compile C dependencies)
- *PostgreSQL* or *Sqlite3* (for the database)
- *PostgreSQL* or *SQlite 3 development files* (for the database)
- *GetText* (to manage translations)
- *Rust* and *Cargo* (to build the code)
- *OpenSSL* and *OpenSSL librairies* (for security)
@ -24,27 +24,66 @@ On **Debian**:
```bash
apt update
apt install gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev sqlite3 libsqlite3-dev
# If you want PostgreSQL
apt install gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev
# If you want SQlite
apt install gettext sqlite3 libsqlite3-dev git curl gcc make openssl libssl-dev
```
On **Fedora**, **CentOS** or **RHEL**:
```bash
dnf install postgresql-server postgresql-contrib mariadb-devel libsq3-devel libpqxx libpqxx-devel git curl gcc make openssl openssl-devel gettext sqlite3 libsqlite3-dev
# If you want PostgreSQL
dnf install postgresql-server postgresql-contrib libpqxx libpqxx-devel git curl gcc make openssl openssl-devel gettext
# If you want SQLite
dnf install libsq3-devel sqlite3 libsqlite3-dev git curl gcc make openssl openssl-devel gettext
```
On **Gentoo**:
```bash
emerge --sync
emerge -av postgresql eselect-postgresql gettext && emerge --ask dev-vcs/git && emerge -pv sqlite3 libsqlite3-dev
# If you want PostgreSQL
emerge -av postgresql eselect-postgresql gettext && emerge --ask dev-vcs/git
# If you want SQlite
emerge -av gettext && emerge --ask dev-vcs/git && emerge -pv sqlite3 libsqlite3-dev
```
On **Mac OS X**, with [Homebrew](https://brew.sh/):
```bash
brew update
# For PostgreSQL
brew install postgres gettext git
# For SQlite (already present, so only GetText and Git are needed)
brew install gettext git
```
## Configuring PostgreSQL
You can either run PostgreSQL from the machine that runs Plume, or from another server. We recommend you to use the first setup for development environments, or in production for small instances.
In the first case, just run this command after the PostgreSQL installation, to start it:
```
service postgresql start
```
If you want to have two separate machines, run these commands on the database server once you've installed the dependencies mentioned above on both servers:
```bash
service postgresql start
su - postgres
createuser -d -P plume
createdb -O plume plume
```
## Creating a new user (optional)
@ -79,64 +118,49 @@ export PATH="$PATH:/home/plume/.cargo/bin:/home/plume/.local/bin:/usr/local/sbin
On **Windows**, you'll need, if you don't already have them, to download and install the [Visual C++ 2015 Build Tools](https://www.microsoft.com/en-us/download/details.aspx?id=48159). Then, download the [rustup installer](https://www.rust-lang.org/en-US/install.html) and run it.
## Getting and compiling the Plume source code
## Getting Plume's source code
Plume needs to be compiled from source.
Plume needs to be compiled from source. To download the code, run:
```bash
git clone https://github.com/Plume-org/Plume.git
cd Plume
# This may take some time as RustUp will download all
# the required Rust components, and Cargo will download
# and compile all dependencies.
cargo build
# If you want PostgreSQL
export FEATURES=postgres
# If you want SQlite
export FEATURES=sqlite
```
We may provide precompiled packages and Docker images in the future; if you have experience in these fields and want to help, feel free to discuss this in issues and to propose pull-requests!
## Configuring PostgreSQL
You can either run PostgreSQL from the machine that runs Plume, or from another server. We recommend you to use the first setup for development environments, or in production for small instances.
In the first case, just run this command after the PostgreSQL installation, to start it:
```
service postgresql start
```
If you want to have two separate machines, run these commands on the database server once you've installed the dependencies mentioned above on both servers:
```bash
service postgresql start
su - postgres
createuser -d -P plume
createdb -O plume plume
```
## Running migrations
Migrations are scripts used to update the database. They are run by a tool called Diesel, which can be installed with:
```bash
cargo install diesel_cli --no-default-features --features postgres --version '=1.2.0'
cargo install diesel_cli --no-default-features --features $FEATURES --version '=1.3.0'
```
Plume should normally run migrations on your behalf as needed, but if you want to run them manually, use the following command:
To run the migrations, you can do:
```bash
# For a PostgreSQL database
diesel migration run --database-url postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME
# For a SQlite database
diesel migration run --database-url ./plume.sqlite3
```
This command may be useful if you decided to use a separate database server.
Migrations should be run before using Plume or the `plm` CLI tool, and after each update.
When in doubt, run them.
## Starting Plume
## Running Plume
First, you'll need to install Plume and the CLI tools to manage your instance.
Then, you'll need to install Plume and the CLI tools to manage your instance.
```
cargo install && cargo install --path plume-cli
cargo install --no-default-features --features $FEATURES
cargo install --no-default-features --features $FEATURES --path plume-cli
```
Before starting Plume, you'll need to create a configuration file, called `.env`. Here is a sample of what you should put inside.
@ -144,6 +168,8 @@ Before starting Plume, you'll need to create a configuration file, called `.env`
```bash
# The address of the database
# (replace USER, PASSWORD, PORT and DATABASE_NAME with your values)
#
# If you are using SQlite, use the path of the database file
DB_URL=postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME
# The domain on which your instance will be available
@ -177,6 +203,8 @@ Finally, you can start Plume with:
plume
```
We may provide precompiled packages in the future; if you have experience in these fields and want to help, feel free to discuss this in issues and to propose pull-requests!
## Docker install
You can use `docker` and `docker-compose` in order to manage your Plume instance and have it isolated from your host:

View File

@ -2,10 +2,13 @@
To update your instance, run these commands with `plume` user if you created it, or with your default user, in the Plume directory.
```
```bash
git pull origin master
cargo install --force && cargo install --path plume-cli --force
# Run the migrations
diesel migration run --database-url 'YOUR_DB_URL'
# If you are using sysvinit
sudo service plume restart