Râu Cao raucao
  • Joined on 2018-11-24
raucao deleted branch feature/pg_encfs from kosmos/chef 2020-06-08 15:03:07 +00:00
raucao merged pull request kosmos/chef#166 2020-06-08 15:02:59 +00:00
Encrypt PostgreSQL data directory
raucao pushed to master at kosmos/chef 2020-06-08 15:02:58 +00:00
d88d3b07a5 Merge pull request 'Encrypt PostgreSQL data directory' (#166) from feature/pg_encfs into master
b662c04183 Finish initial encfs cookbook and postgres adaptations
379161eb1e Fix postgres installation
353f2c13f1 Improve encfs cookbook
8918452fc5 Use latest postgresql fork
Compare 12 commits »
raucao pushed to feature/pg_encfs at kosmos/chef 2020-06-08 15:02:04 +00:00
b662c04183 Finish initial encfs cookbook and postgres adaptations
raucao opened issue kosmos/chef#177 2020-06-08 13:44:56 +00:00
Rename all site cookbooks with underscore instead of hyphens
raucao opened issue kosmos/chef#176 2020-06-08 08:54:55 +00:00
Wiki needs a mobile layout/theme
raucao commented on issue kosmos/chef#175 2020-06-08 08:42:53 +00:00
Replace andromeda.kosmos.org

Cool. I like that one, too. Both short, and also is the name of a rocket, launching things into space. :)

raucao commented on pull request kosmos/chef#166 2020-06-07 10:48:39 +00:00
Encrypt PostgreSQL data directory

I have pushed everything. See new commits.

raucao pushed to feature/pg_encfs at kosmos/chef 2020-06-07 10:47:30 +00:00
379161eb1e Fix postgres installation
353f2c13f1 Improve encfs cookbook
8918452fc5 Use latest postgresql fork
501626de1f Add encfs to Vagrantfile
4fe0e913f8 Use our own fork of the postgresql cookbook
Compare 5 commits »
raucao commented on pull request kosmos/chef#166 2020-06-07 10:38:51 +00:00
Encrypt PostgreSQL data directory

... I had to fork the postgresql cookbook in order to add the possibility to correctly use custom data dirs on Debian-based systems👍

9389178e11

I have added the site cookbook as a git submodule. So when you pull the branch, just do a git submodule update --init.

raucao commented on pull request kosmos/chef#166 2020-06-07 10:27:15 +00:00
Encrypt PostgreSQL data directory

All solved! I have everything running correctly now, with the cluster created in the encrypted data dir, and the services started by path units.

@greg I'm not experienced with writing Chef resources, but I think a resource in the encfs cookbook would make most sense, so that you simply describe that you want to wait for the encrypted dir to start a certain systemd service in the recipe of the respective service.

That is, for Postgres e.g., we'd only do something along the lines of:

create_encfs_path_activation_unit_for 'postgresql@12-main'

I have added a template for this to the encfs site cookbook, which looks like this:

[Unit]
Description=Start <%= @service_unit %> when encrypted data directory is mounted

[Path]
PathExists=/tmp/data-dir-mounted.txt
Unit=<%= @service_unit %>

[Install]
WantedBy=multi-user.target
raucao commented on pull request kosmos/chef#166 2020-06-06 15:43:54 +00:00
Encrypt PostgreSQL data directory

I keep running into issues with the code here. There's actually no cluster created with the correct datadir, but all the files are created in the default directory. So starting the process later fails with it complaining that the datadir is not a valid cluster directory. However, trying pg_createcluster then correctly fails, stating that the cluster config already exists.

raucao pushed to feature/pg_encfs at kosmos/chef 2020-06-06 10:24:51 +00:00
bd99b76287 Use human-readable flag for encfs mount script
raucao commented on pull request kosmos/chef#166 2020-06-06 09:55:43 +00:00
Encrypt PostgreSQL data directory

... adding a postgres system user to the default recipe fixes the problem. However, when trying to unlock encfs, it does not accept the password from the data bag:

mount_encfs[2065]: Error decoding volume key, password incorrect

I think this code is probably too prone to errors:

  command <<-EOF
echo "y\\\n
y\\\n
p\\\n
#{encfs_password}\\\n
#{encfs_password}\\\n
" 
raucao commented on pull request kosmos/chef#166 2020-06-06 09:20:01 +00:00
Encrypt PostgreSQL data directory

I just tried this branch by adding the recipes for a postgres master and encfs to the Vagrant config's runlist. However, Chef runs fail, claiming there's no postgres user:

cannot determine user id for 'postgres', does the user exist on this system?

I cannot find this user being created in a site-cookbook, but it is the default user for the postgres cookbook's user resource.

raucao commented on pull request kosmos/chef#166 2020-06-06 08:48:57 +00:00
Encrypt PostgreSQL data directory

BTW, I just noticed that encfs and gitea are the only two cookbooks using an underscore as space, while all the others use a hyphen.

raucao commented on pull request kosmos/chef#166 2020-06-06 08:30:07 +00:00
Encrypt PostgreSQL data directory

I think it would be interesting to try path-based activation of units. This would basically map 1:1 to the human understanding of "start the postgres service as soon as path /mnt/data/postgres" becomes available.

raucao commented on pull request kosmos/chef#166 2020-06-06 08:20:38 +00:00
Encrypt PostgreSQL data directory

I think using a service unit for encfs may not be the right approach for this. It is not a running service, like e.g. postgres, but only mounts a directory once.

https://www.computernetworkingnotes.com/linux-tutorials/systemd-units-explained-with-types-and-states.html

raucao commented on issue kosmos/chef#175 2020-06-06 08:04:20 +00:00
Replace andromeda.kosmos.org

Btw, here are the names of the nearest galaxies starting with the letter D:

  • Donatiello
  • Draco (Draco Dwarf + Draco II)
  • Dwingeloo (1 + 2)

@greg Any preference?

raucao commented on issue kosmos/chef#175 2020-06-05 09:44:54 +00:00
Replace andromeda.kosmos.org

I carefully read the text again, and if we want to keep the IPs, then they have to put the new machine in the same place as the old one. This means that Centaurus would be in a different DC (DC 11 vs 13).

I also asked around and @maxsan told me that when you change a Lightning Network node's external IP in the config, it would actually be communicated to other nodes and picked up by the network. So it looks like we could change the IP after all.

Considering these facts, I would propose to ditch the old IP eventually and move everything over to the new IP bit by bit, after the new server has been provisioned.

@greg WDYT?