From c84f141e2201a9796c5917ed10cf8059db6373e0 Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Tue, 16 May 2017 16:04:50 +0200 Subject: [PATCH 1/5] Add Mac development environment setup instructions. Closes #250 --- Running-Mastodon/Development-guide.md | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/Running-Mastodon/Development-guide.md b/Running-Mastodon/Development-guide.md index 4b2431e5..59ea4427 100644 --- a/Running-Mastodon/Development-guide.md +++ b/Running-Mastodon/Development-guide.md @@ -3,6 +3,8 @@ Development guide **Don't use Docker to do development**. It's a quick way to get Mastodon running in production, it's **really really inconvenient for development**. Normally in Rails development environment you get hot reloading of backend code and on-the-fly compilation of assets like JS and CSS, but you lose those benefits by compiling a Docker image. If you want to contribute to Mastodon, it is worth it to simply set up a proper development environment. +## Linux + In fact, all you need is described in the [production guide](Production-guide.md), **with the following exceptions**. You **don't** need: - Nginx @@ -45,6 +47,77 @@ You can check code quality with: rubocop +## Mac + +These are self-contained instructions for setting up a development environment on a macOS system. It is assumed that you’ve cloned your fork of Mastodon to a local working directory and that you are in Terminal and in that directory. + +### Prerequisites + +- Get [Homebrew](https://brew.sh) and use it to install the other dependencies: + + ``` + brew install imagemagick ffmpeg yarn postgresql redis rbenv nodejs + ``` + +- Get [Xcode](https://developer.apple.com/xcode/) Commandline tools + + ``` + xcode-select install + ``` + +- Configure Rbenv: + + ``` + rbenv init + rbenv install 2.4.1 + + ``` + +- Install/configure bundler to use your local rbenv: + + ``` + gem update --system + gem install bundler + rbenv rehash + ``` + +- Configure [PostgreSQL](https://www.postgresql.org): + + ``` + initdb /usr/local/var/postgres -E utf8 + createdb + export PGDATA=/usr/local/var/postgres + /usr/local/bin/postgres + /usr/local/bin/psql + ``` + + In the prompt: + + ``` + CREATE USER mastodon CREATEDB; + \q + ``` + +### Installation + +``` +bundle install --with development +yarn install --pure-lockfile +gem install foreman --no-ri --no-rdoc +bundle exec rails db:setup +bin/rails assets:precompile +``` + +### Start the server + +``` +foreman start +``` + +Go to http://localhost:3000 to see your development instance. + +Admin account is `admin@localhost:3000`. Password is `mastodonadmin`. + ## Development tips You can use a localhost->world tunneling service like [ngrok](https://ngrok.com) if you want to test federation, **however** that should not be your primary mode of operation. If you want to have a permanently federating server, set up a proper instance on a VPS with a domain name, and simply keep it up to date with your own fork of the project while doing development on localhost. From 34071d26d05a531979ec21984d041f239a503fc3 Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Tue, 16 May 2017 16:09:37 +0200 Subject: [PATCH 2/5] Improve running instructions in Mac development guide (#250) --- Running-Mastodon/Development-guide.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Running-Mastodon/Development-guide.md b/Running-Mastodon/Development-guide.md index 59ea4427..4f2f5363 100644 --- a/Running-Mastodon/Development-guide.md +++ b/Running-Mastodon/Development-guide.md @@ -108,11 +108,13 @@ bundle exec rails db:setup bin/rails assets:precompile ``` -### Start the server +### Running -``` -foreman start -``` +In separate Terminal windows/tabs: + +1. Start PostgreSQL: `/usr/local/bin/postgres` +2. Start Redis: `redis-server` +3. Start Mastodon (from the Mastodon folder): `foreman start` Go to http://localhost:3000 to see your development instance. From 9de932c427cf768b239fd885c6bbad619eb61fca Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Tue, 16 May 2017 16:20:03 +0200 Subject: [PATCH 3/5] Change order of prerequisites in Mac development guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Xcode commandline tools need to be installed before ffmpeg is as they’re used to compile it. --- Running-Mastodon/Development-guide.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Running-Mastodon/Development-guide.md b/Running-Mastodon/Development-guide.md index 4f2f5363..fac390e6 100644 --- a/Running-Mastodon/Development-guide.md +++ b/Running-Mastodon/Development-guide.md @@ -53,18 +53,18 @@ These are self-contained instructions for setting up a development environment o ### Prerequisites -- Get [Homebrew](https://brew.sh) and use it to install the other dependencies: - - ``` - brew install imagemagick ffmpeg yarn postgresql redis rbenv nodejs - ``` - - Get [Xcode](https://developer.apple.com/xcode/) Commandline tools ``` xcode-select install ``` +- Get [Homebrew](https://brew.sh) and use it to install the other dependencies: + + ``` + brew install imagemagick ffmpeg yarn postgresql redis rbenv nodejs + ``` + - Configure Rbenv: ``` From 0f26e2962a076de89170dabafc419f8dab598eba Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Tue, 16 May 2017 16:31:44 +0200 Subject: [PATCH 4/5] Cosmetic: removed trailing line in code on Mac dev guide --- Running-Mastodon/Development-guide.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Running-Mastodon/Development-guide.md b/Running-Mastodon/Development-guide.md index fac390e6..0d7637ac 100644 --- a/Running-Mastodon/Development-guide.md +++ b/Running-Mastodon/Development-guide.md @@ -70,7 +70,6 @@ These are self-contained instructions for setting up a development environment o ``` rbenv init rbenv install 2.4.1 - ``` - Install/configure bundler to use your local rbenv: From ab538eeb51310cb03ffbb8c296040ceafb8f4fcc Mon Sep 17 00:00:00 2001 From: Aral Balkan Date: Tue, 16 May 2017 16:45:40 +0200 Subject: [PATCH 5/5] Fix typo on Mac developer guide --- Running-Mastodon/Development-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Running-Mastodon/Development-guide.md b/Running-Mastodon/Development-guide.md index 0d7637ac..953029a3 100644 --- a/Running-Mastodon/Development-guide.md +++ b/Running-Mastodon/Development-guide.md @@ -53,7 +53,7 @@ These are self-contained instructions for setting up a development environment o ### Prerequisites -- Get [Xcode](https://developer.apple.com/xcode/) Commandline tools +- Get [Xcode](https://developer.apple.com/xcode/) Command Line Tools: ``` xcode-select install