Add initial deployment process for nix#97
Conversation
|
I've removed all the elixir related things. The original idea was to use this as a backend for a kind of demo app, but we are going to use something much "rougher" at first, until we have a better idea of what is needed. (something like a postgres db with just a couple of tables, and a couple of endpoints). The idea being that hopefully once we manage to figure out a UI, we have a better idea of the requirements. Let me know if anything. |
|
Thanks for your efforts! I wanted to try it out (and making some tweaks at https://github.com/bonfire-networks/bonfire-app/tree/deploy/nix) but a bit more documentation would be helpful. Looking up docs elsewhere I assumed something like So if you could be more verbose with these steps please: |
|
@mayel thanks a lot for testing! |
|
Oh I realised the dependencies might have changed. Let me rebase actually and test again. |
92a1046 to
bb4b8fb
Compare
|
I finished updating the PR. There were a couple of tasks that changed name, hence the failure. Let me know if anything. |
|
Actually I spoke a bit too fast, I get the following error I'm couldn't find that dependency in the package.json, but perhaps it's one of those dependencies that is fetched dynamically. |
|
make js.deps.get takes care of that
|
|
(note that it used to be mix js.deps.get but the command was moved to the makefile so it can be run without first compiling the app) |
|
Got it, thank you for the update! Let me have a look. |
|
@mayel should be good to go now. Let me know. |
|
I'm not really doing much on bonfire v1 recently (focusing on v2), but here's some feedback anyway
Should be fine.
Should be fine.
postgis isn't required if you use one of the flavours that doesn't pull in the postgis stuff.
This is sort of similar to RDS, where you have to create the extension manually before running the migrations. In a case like that, it's exactly what i'd do. |
|
Well I've merged so that it's easier for others to test, as personally still getting the same error as above, which I guess could be an issue with my nix setup. |
|
Thank again @happysalada |
|
One thing I've noticed is that there's 3 different files where the flavour is defined (I changed the default to |
|
Thank you for reporting your error is still happening. |
|
same version: install nixUnstable in your environment: $ nix-env -iA nixpkgs.nixUnstable Edit either ~/.config/nix/nix.conf or /etc/nix/nix.conf and add: experimental-features = nix-command flakes |
|
Ok, I think it might be the sandbox. |
|
I recently had an issue (nothing to do with nix) that was due to ipv6 not being handled correctly, so long shot but maybe something to look into... |
Thanks, will try in a bit |
|
Oh interesting, I hope that it's not the error, otherwise it might take a while to debug. also @jjl thank you for the review! |
|
That was it! I've now gotten this far: Could you add docs about setting it up with direnv and/or how to configure the env (are you using the dotenv files we have in Also I still haven't understood these instructions:
|
|
On a side note, can we upgrade that to OTP 24? |
|
The error you are getting is legitimate, I still have to re-include my environment changes from before. Let me try to do that in a separate PR. In order to update erlang, you just need to update the reference to a newer nixpkgs. nixpkgs is using erlang 24 as the main erlang so nothing to change in the code. You will need to run Regarding the sandbox thing. The reason this does not work is that I'm not pinning the dependencies, I'm just saying 'fetch everything from the internet'. You can fix that by defining exactly which dependencies you need, but since that is less flexible, I would say it's better to start without the sandbox. Regarding the 3 instructions, they are a little bit condensed. Those are the instructions for actual deployment. I was hoping the nix expressions that follow give more clue as to what to do. Basically if you have a nixos running from a flake, the quoted nix expressions should get you there relatively quickly. If you want to try out the deployment from a server running nixos, happy to help there, we can go through it step by step and amend the documentation as you see fit. |
|
Thanks. The update ran OK and I've pushed the lockfile. |
|
Yes the instructions in HACKING.md are just for trying on local and don't need to be changed. |
This PR adds the initial deployment process for nixos.
the result can be checked at https://bonfire.union.rocks/
The following tradeoffs where chosen
The following contestable choice where made
I ran into a tiny hiccup for which I still don't have a solution I'm satisfied with.
This is missing the caddy config used to deploy. (even in my example deploment I didn't add the upload route reverse proxy).
I tried to put all the files into a
nixdirectory to not make the base dir too crowded.I needed to add 2 environment variable in runtime.exs.
The postgres_socket_dir socket. This is to enable a connection to postgres via unix sockets. The default authentication configuration of postgres only checks the username for local unix sockets, this makes one less secret configuration variable to use (POSTGRES_PASSWORD). Also a connection over a socket is 30% more efficient than one over TCP/IP
The TZDATA_DIR is the directory that TZDATA will write to when doing updates. It needs to be a directory where the user has write priviledge. It will default to the priv directory, but in unix it's idiomatic to have the writable directory of an application be under /var/lib
I have a bit more work to do on this, it's 90% of the way ready.