Commit graph

46 commits

Author SHA1 Message Date
Peter Jones
81e1aba674
backups: no need to recursively apply ownership/mode changes
Also, once the backup grows too large, the systemd service will
timeout in the startup phase while applying the ownership changes.
2019-11-04 11:01:46 -07:00
Peter Jones
374abe15ca
rsync: Correctly support using a non-default local user account
Prior to this commit if the local user name was changed but the group
was left at the default then neither the user nor group was created.
This resulted in a failed `chown'.
2019-10-04 10:01:24 -07:00
Peter Jones
899b1db967
Add the services option to the backup.scripts module 2019-10-02 14:20:21 -07:00
Peter Jones
1c1ede78a6
Add more options to the rsync backup method
New options:

  * `localdir`: Override the local directory

  * `services`: Depend on other services.
2019-10-02 14:05:11 -07:00
Peter Jones
755cc2a84b
New `phoebe.backup.scripts' module for scheduling backup scripts 2019-10-02 08:39:34 -07:00
Peter Jones
e8d0f9cb0a
backups: Update to the latest version of the backup scripts 2019-08-30 10:49:27 -07:00
Peter Jones
1b62b52dfa
backups: Add rsync backups using hard links for efficiency 2019-08-28 16:31:30 -07:00
Peter Jones
a96b46c4d9
Add documentation for the web tunnels feature 2019-08-23 13:19:23 -07:00
Peter Jones
96ac477d36
rails: Add options for database pool size and connection timeout
Improvements:

  * Added new database options

  * Added first test file
2019-08-01 13:56:02 -07:00
Peter Jones
4043563dbc
Add support for configuring an entire WireGuard network 2019-07-08 12:55:20 -07:00
Peter Jones
2f89d37b29
monitoring: Switch to Prometheus, add client vs. server 2019-07-05 15:20:55 -07:00
Peter Jones
ea9e99d760
tunnels: Respect `phoebe.security.enable' like other services
This allows one to deploy to a virtual machine for testing.
2019-06-25 16:49:12 -07:00
Peter Jones
3399464b17
Rails: Rework service execution so `nix-copy-closure' deployments work better
These changes allow service restarts to pick up a new
environment (including the correct gemset) when restarted.

Also, make migrations its own service that other services need to wait
for.
2019-06-20 12:04:51 -07:00
Peter Jones
66525b8df1
Account managers services should be "oneshot"
Making these services "oneshot" services means that other services
will wait for them to finish.
2019-06-20 12:02:49 -07:00
Peter Jones
dacaa53e48
Rails: put Ruby environment into propagatedBuildInputs so it shows up in a nix-shell
This is the first step to getting nix-copy-closure deployments to pick
up a new gemset (if one exists).
2019-06-19 11:32:51 -07:00
Peter Jones
9547da5974
PostgreSQL: Correctly set database owner and schema object owner
Also, grant permission to create schema objects when given "rw"
abilities.
2019-06-18 12:54:16 -07:00
Peter Jones
b2fd566c36
Breaking Change: Completely Change PostgreSQL Account Management
This is a breaking change that will require you to change your Phoebe
settings for PostgreSQL.

  * New database configuration options

  * Accounts no longer automatically create databases

  * Databases have `owners' that tie them back to an account

  * Databases have `users' that grant accounts full access

  * Databases have `readers' that grant read-only access to accounts

  * Accounts can use `ident' authentication for local connections if
    you enable the `allowIdent' option.

  * Existing accounts that are not configured via Phoebe will be
    locked so they cannot be used.  That way if you delete a user from
    Phoebe the account will continue to exist, but won't have access
    to anything.
2019-04-30 08:12:06 -07:00
Peter Jones
3a322a114a
rails: Decouple helper functions from the config variable 2019-04-08 12:45:31 -07:00
Peter Jones
bd9408849d
Remove custom netdata plugin
It didn't really work anyways.
2019-04-08 09:45:54 -07:00
Peter Jones
4846f4ccfa
New module: phoebe.services.monitoring
Basic monitoring and alerting with netdata.
2019-04-05 14:33:15 -07:00
Peter Jones
3129ab3fa7
Include the scripts directory in the distribution 2019-04-05 14:32:39 -07:00
Peter Jones
5fcb3fb482
Slight permission change so that nginx and serve Rails assets
Now that we point nginx at /var/lib/rails instead of /nix/store we
need to change the permissions on the app home to allow nginx to read
files from the Rails' public directory.
2019-04-05 13:46:49 -07:00
Peter Jones
94d6158f04
New way to deploy Ruby on Rails applications
If you set the `deployedExternally' option to true you can use the
nix-copy-closure command to deploy updates to the application.

See `scripts/deploy-rails-app.sh' for more details.
2019-04-05 13:22:03 -07:00
Peter Jones
7cc5c27782
New module: phoebe.backup.postgresql 2019-03-06 14:48:44 -07:00
Peter Jones
41475bbde5
Add the ability for Rails apps to depend on configured services
The new `afterServices' setting allows a Rails app to depend on
arbitrary systemd services.
2019-03-04 13:20:28 -07:00
Peter Jones
c45f05c96c
New service: InfluxDB 2019-02-20 11:26:32 -07:00
Peter Jones
b1ed1aff0f
Add web tunnels (aimed at web developers) 2019-02-13 13:45:29 -07:00
Peter Jones
2218deea5e
secrets: Use /dev/shm if available, then fallback to tmpfs 2019-02-01 09:02:56 -07:00
Peter Jones
88a7a614ef
New `builder' service for configuring a remote build machine 2019-02-01 08:33:26 -07:00
Peter Jones
b537635028
rails: New script `railsdo' and rename home symlink to the app
* New script `railsdo' to help run commands as a rails user

  * The symlink in the home directory is now always called `app'.  It
    was previously named after the application itself.
2019-01-28 16:21:37 -07:00
Peter Jones
6c7065945c
New module for nginx 2019-01-28 14:10:57 -07:00
Peter Jones
e742614c30
rails: New systemd target for each Rails application
* Each now has a systemd target so you can start and stop all
    services together.

  * New `enable' option so you can prevent services from
    starting (e.g., on development machines)
2019-01-24 12:16:19 -07:00
Peter Jones
eaa5c89f6b
Linode: Don't reboot after installing NixOS so we have a chance to set the root password
Apparently the nixos-install tool locks the root account of stdin
isn't a terminal.  This change makes it so the root user doesn't have
a password and then blasts out a warning with instructions on how to
set the root password.
2019-01-14 10:52:24 -07:00
Peter Jones
ab5021ec99
rails: Make nginx location unique, proxy to puma over IPv4
* Replace the @app location with a unique ID generated from the
    Rails application name

  * Puma is currently only listening on IPv4 so having nginx proxy to
    localhost wasted a connection to ::1.  The proxy address is now to
    127.0.0.1 to keep that from happening.
2019-01-08 16:52:18 -07:00
Peter Jones
14d701b388
rails: Add the ability to schedule services with a systemd timer 2019-01-07 14:05:12 -07:00
Peter Jones
48e5035383
scripts: Add a script to bootstrap NixOS on Linode.com 2019-01-04 17:09:22 -07:00
Peter Jones
72d3974626
rails: Automatically rotate log files 2019-01-04 17:08:10 -07:00
Peter Jones
c5dc7d83be
secrets: Try to improve size estimates for the tmpfs
When creating the tmpfs we need to specify a size.  Calculate the size
based on the size of the tarball of the encrypted files, multiplied by
10.
2019-01-04 11:19:15 -07:00
Peter Jones
4964d95974
rails: Support background workers and other Rails services/workers
The new `services' option is used to request additional processes be
run in the background with the same environment as the main Rails
process.
2019-01-04 11:17:40 -07:00
Peter Jones
193b82189e
Automatically depending on NixOps key services, new Rails sourcedFile option
* Services that need password files will automatically depend on the
    appropriate NixOps key service as necessary.

  * New `sourcedFile` option for Rails applications to load a Bash
    script just before starting the Rails service.  Useful for setting
    secret environment variables.
2019-01-03 14:33:38 -07:00
Peter Jones
accdc1bf54
When decrypting secrets, pass unencrypted files straight through 2019-01-03 14:32:11 -07:00
Peter Jones
b2571a8c30
Add a script to help manage secrets
Current features:

  * Mount a directory of encrypted secrets into a memory file system

  * Unmount the file system created by the mount command
2019-01-02 16:09:31 -07:00
Peter Jones
b5c6563d5b
rails: Create a state directory where stateful files can live
This is necessary for files like the state file that tells the
migration script whether or not the schema needs to be loaded.

Fixes a bug where the migration script would try to load the schema on
a second deployment (since touching a file in the db directory fails
because it's in the nix store).
2018-12-21 13:10:54 -07:00
Peter Jones
b9061e43a4
security: Some settings should always be enabled
Even if Phoebe security is off, force some settings to be on.  These
are settings that are appropriate even for developer testing VMs.
2018-12-20 16:54:36 -07:00
Peter Jones
9745341307
postgresql: Add option to give a user the SUPERUSER permission
This is necessary for databases used to test Ruby on Rails
applications :(
2018-12-20 16:53:34 -07:00
Peter Jones
3980c37fa0
security, rails, postgresql: Import files from original repo 2018-12-19 16:08:03 -07:00