diff --git a/.drone.yml b/.drone.yml index 75cdd0c..499a2c3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,6 +25,14 @@ steps: commands: - /root/.cargo/bin/cargo fmt -- --check + - name: cargo clippy + image: rust:1.66-buster + environment: + CARGO_HOME: .cargo + commands: + - cargo check + - cargo check --features embed-lemmy + - name: cargo clippy image: rust:1.66-buster environment: diff --git a/README.md b/README.md index b577320..017dc6e 100644 --- a/README.md +++ b/README.md @@ -74,23 +74,39 @@ Add these lines to daily cronjob (sudo crontab -e) to renew tls certificates ### Alongside existing Lemmy instance (native) -Follow the [Lemmy installation instructions](https://join-lemmy.org/docs/en/administration/administration.html) to install Lemmy backend and lemmy-ui first. You will need one (sub)domain for LemmyBB, and another for lemmy-ui. +Install and configure dependencies: +``` +apt install pkg-config libssl-dev libpq-dev cargo postgresql +sudo -iu postgres psql -c "CREATE USER lemmy WITH PASSWORD 'db-passwd';" +sudo -iu postgres psql -c "CREATE DATABASE lemmy WITH OWNER lemmy;" +adduser lemmy --system --disabled-login --no-create-home --group +``` -Then install lemmyBB itself. First, ssh into your server and prepare by cloning the code repository. +Then install lemmyBB itself. First, prepare by cloning the code repository and compiling the code. This will take a while depending on your server CPU. Alternatively you can compile on a faster computer and copy the binary from `target/release/lemmy_bb` to the server. ``` cd /opt git clone https://github.com/LemmyNet/lemmyBB.git --recursive +cd lemmyBB +LEMMYBB_VERSION=$(git describe --tag --always) cargo build --release --features embed-lemmy ``` -Change to the folder and compile Lemmy. -``` -cd lemmyBB -LEMMYBB_VERSION=$(git describe --tag --always) cargo build --release +Edit the Lemmy config file in `config/config.hjson` with your domain and [other customizations](https://join-lemmy.org/docs/en/administration/configuration.html). A minimal example looks like this: +```json +{ + database: { + # put your db-passwd from above + password: "db-passwd" + } + # replace with your domain + hostname: example.com +} ``` -Copy the nginx config into the sites-enabled folder and edit it +Copy the nginx config into the sites-enabled folder and edit it with your actual domain. ``` cp docker/nginx.conf /etc/nginx/sites-enabled/lemmybb.conf +sed -i -e 's/$lemmybb_domain/lemmybb.com/g' /etc/nginx/sites-enabled/lemmybb.conf +sed -i -e 's/$lemmyui_domain/lemmyui.com/g' /etc/nginx/sites-enabled/lemmybb.conf ``` create systemd service file @@ -128,7 +144,7 @@ Run the following commands to update lemmyBB to the latest development version. ``` cd /opt/lemmyBB git pull -LEMMYBB_VERSION=$(git describe --tag --always) cargo build --release +LEMMYBB_VERSION=$(git describe --tag --always) cargo build --release --features embed-lemmy systemctl restart lemmy_bb.service ``` @@ -169,17 +185,18 @@ Note, you must subscribe manually to remote communities, so that new activities ## Development -Execute the following command, with a Lemmy instance of your choice: -``` +You need to install git and Rust. The easiest way is to develop with an embedded Lemmy instance: +```bash git clone https://github.com/LemmyNet/lemmyBB.git --recursive cd lemmyBB -LEMMYBB_BACKEND=https://lemmy.ml cargo run +cargo run --features embed-lemmy ``` -You can also run a local development instance of Lemmy, either [native](https://join-lemmy.org/docs/en/contributing/local_development.html) or in [Docker](https://join-lemmy.org/docs/en/contributing/docker_development.html), and connect to it with: +Then open http://127.0.0.1:1244 in your browser. +It can also be useful to use a production instance as backend, for example if you notice a bug on a specific instance but don't know what causes it. To do this, run the following command with an instance of your choice. ``` -LEMMYBB_BACKEND=http://localhost:8536 cargo run +LEMMYBB_BACKEND=https://lemmy.ml cargo run ``` ## License