From 1a421e96d7f1610ac142c6b5f752754fd87043e1 Mon Sep 17 00:00:00 2001 From: jcfrancisco Date: Mon, 20 Jul 2020 10:03:15 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20macOS-specific=20instructi?= =?UTF-8?q?ons=20for=20local=20development.=20(#996)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📝 Add macOS-specific instructions for local development. * 📝 Remove extra 'git' package installation instruction --- docs/src/contributing_local_development.md | 49 ++++++++++++++++------ 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/docs/src/contributing_local_development.md b/docs/src/contributing_local_development.md index 066386f50..9bdeff9ad 100644 --- a/docs/src/contributing_local_development.md +++ b/docs/src/contributing_local_development.md @@ -1,16 +1,26 @@ -### Ubuntu - - -#### Build requirements: +### Install build requirements +#### Ubuntu ``` -sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 git +sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 # install yarn curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt update && sudo apt install yarn ``` -#### Get the source code +#### macOS + +Install Rust using [the recommended option on rust-lang.org](https://www.rust-lang.org/tools/install) (rustup). + +Then, install [Homebrew](https://brew.sh/) if you don't already have it installed. + +Finally, install Node and Yarn. + +``` +brew install node yarn +``` + +### Get the source code ``` git clone https://github.com/LemmyNet/lemmy.git # or alternatively from gitea @@ -20,36 +30,49 @@ git clone https://github.com/LemmyNet/lemmy.git All the following commands need to be run either in `lemmy/server` or `lemmy/ui`, as indicated by the `cd` command. -#### Build the backend (Rust) +### Build the backend (Rust) ``` cd server cargo build # for development, use `cargo check` instead) ``` -#### Build the frontend (Typescript) +### Build the frontend (Typescript) ``` cd ui yarn yarn build ``` -#### Setup postgresql +### Setup postgresql +#### Ubuntu ``` sudo apt install postgresql sudo systemctl start postgresql -# initialize postgres database + +# Either execute server/db-init.sh, or manually initialize the postgres database: sudo -u postgres psql -c "create user lemmy with password 'password' superuser;" -U postgres sudo -u postgres psql -c 'create database lemmy with owner lemmy;' -U postgres export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy -# or execute server/db-init.sh ``` -#### Run a local development instance +#### macOS +``` +brew install postgresql +brew services start postgresql +/usr/local/opt/postgres/bin/createuser -s postgres + +# Either execute server/db-init.sh, or manually initialize the postgres database: +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 +``` + +### Run a local development instance ``` # run each of these in a seperate terminal cd server && cargo run -ui & yarn start +cd ui && yarn start ``` Then open [localhost:4444](http://localhost:4444) in your browser. It will auto-refresh if you edit