Merge pull request #251 from aral/mac-development-environment-instructions

Mac development environment instructions
This commit is contained in:
Eugen Rochko 2017-05-16 16:56:15 +02:00 committed by GitHub
commit afaa3feda1
1 changed files with 74 additions and 0 deletions

View File

@ -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,78 @@ 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 youve cloned your fork of Mastodon to a local working directory and that you are in Terminal and in that directory.
### Prerequisites
- Get [Xcode](https://developer.apple.com/xcode/) Command Line 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:
```
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
```
### Running
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.
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.