Commit 5becf646 authored by happyriver's avatar happyriver

Merge branch 'nix-support' into 'master'

Minor changes to Nix support docs

See merge request !137
parents 0a526397 9031f8b6
Pipeline #113097839 passed with stage
in 8 minutes and 18 seconds
web: env PORT=3000 puma -C config/puma.rb
sidekiq: env PORT=3000 sidekiq
stream: env PORT=4000 DB_HOST=/run/postgresql DB_PORT=5432 yarn run start
stream: env PORT=4000 yarn run start
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
......@@ -26,7 +26,7 @@ so let me know what you find there.
## To contain or not to contain
The typical way to develop software with Nix is to use the command
'nix-shell' to create a shell environment within which the software's
`nix-shell` to create a shell environment within which the software's
dependencies are present. This is analogous to Ruby's `rbenv` or
Python's `virtualenv` except that it can pull in dependencies from
multiple other package managers with a single command, and can make
......@@ -123,7 +123,7 @@ container specification which can be added to your `configuration.nix`
and built with `nixos-rebuild switch`. Edit it to add your own ssh
key.
This container uses a bind mount to access your Soapbox git repo.
This container uses a bind mount to access your Soapbox source tree.
Edit the `hostPath` below to contain the directory that you cloned the
project into. Bind mounting allows you to edit code from outside the
container and run it inside the container. In order for this to work,
......@@ -230,7 +230,7 @@ In order to use Nix to fetch Ruby and Node dependencies, two external
tools called `bundix` and `yarn2nix` are used to convert the
`Gemfile`, `Gemfile.lock`, `package.json` and `yarn.lock` into Nix
format. The shell script `update.sh` can do this for you, from the
root of the `soapbox` git repo, inside or outside of a container:
root of the `soapbox` source tree, inside or outside of a container:
```
[~/soapbox]$ nix run -f develop.nix updateScript -c update.sh
......@@ -264,7 +264,7 @@ git revision with different dependencies, exit from this shell, run
### `bundle exec` problem
I don't know why, but the `bundle` executable created by `nix-shell`
fails with infinite recursion. By bisecting the Gemfile, I found that
fails with infinite recursion. By bisecting the `Gemfile`, I found that
the problem is associated with `http_parser.rb` and goes away if you
revert it to 0.6 from the git revision given in the
`Gemfile`. However, that git revision is there to fix a bug
......@@ -282,21 +282,31 @@ This problem also affects `foreman` but there is a Go clone of it in
`nixpkgs` called `goreman` which does not have that problem. It is
included in the Nix shell created by `develop.nix`.
## Load the database schema
## Loading the database schema
If you are using an operating system other than NixOS, set up the
development database with:
### On non-NixOS systems
Set up the development database with:
```
[nix-shell:~/soapbox]$ rails db:setup
```
On NixOS or in a NixOS container, since the database was already
created by `configuration.nix` or the container configuration, you
can't use `rails db:setup`. Use these commands instead to load the
database schema and seed the username and password for the
`[email protected]:3000` account (`localhost` in that address will be
replaced by `$LOCAL_DOMAIN` if you have set it).
### On NixOS systems or in NixOS containers
Include these settings in `.env` at the root of the Soapbox source
tree to make local peer authentication work:
```
DB_HOST=/run/postgresql
DB_PORT=5432
```
Since the database was already created by `configuration.nix` or the
container configuration, you can't use `rails db:setup`. Use these
commands instead to load the database schema and seed the username and
password for the `[email protected]:3000` account (`localhost` in that
address will be replaced by `$LOCAL_DOMAIN` if you have set it).
```
[nix-shell:~/soapbox]$ rails db:schema:load
......@@ -306,12 +316,8 @@ replaced by `$LOCAL_DOMAIN` if you have set it).
## Starting the development server
Because of the `bundle exec` bug, Soapbox's `Procfile.dev` won't work
as is, so use `Procfile-nix.dev` instead, which omits `bundle exec`
and sets the PostgreSQL socket name for the streaming server, which
makes the peer authentication in NixOS PostgreSQL configuration given
above work.
From inside your `nix-shell` at the root of the soapbox git repo,
as is, so use `Procfile-nix.dev` instead, which omits `bundle exec`.
From inside your `nix-shell` at the root of the soapbox source tree,
start the development server with:
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment