Commit Graph

193 Commits

Author SHA1 Message Date
Girish Ramakrishnan f4f24e7347 Make installer run across reboots
The installer is run in provision-mode in the init script

The installer is run as update-mode by supervisor by postinstall

Previously, we used to run the *same* installer code, which was
part of the base image, in both modes. However, after a reboot,
the old installer code is 'gone' and thus we start running the
newer installer code. This distinction is very subtle and this change
makes it more obvious.

If we want the same installer code to run in both modes, then we
really need to split out installer into a separate repository. This
can be done if required later.

This also makes it clear that announce is a feature of the provision
mode.
2014-11-21 14:18:59 -08:00
Girish Ramakrishnan d4ee1c59f1 Use connect-lastmile in installer 2014-11-12 13:15:29 -08:00
Girish Ramakrishnan 0525ccc4a4 Disable metadata API access to non-root users
The only reason not to use the metadata completely for provisioning
is because many VPS providers do not provide it.

If we rely on a metadata API, we can pretty much remove the installer
server
2014-11-10 16:26:56 -08:00
Girish Ramakrishnan 9309c89a1a Appstore name is not part of image anymore 2014-11-09 10:06:23 -08:00
Girish Ramakrishnan bea71b35f6 Move to v2 api 2014-11-09 10:04:29 -08:00
Girish Ramakrishnan b039123daa Make updates to use the installer code 2014-10-31 17:50:32 -07:00
Girish Ramakrishnan cf3e98a3f6 Start supervisor by default in the base image
This is nice to have for the update case where we can just stop
all the apps
2014-10-31 16:59:02 -07:00
Girish Ramakrishnan bb646c3c89 APPSTORE_URL is not part of image anymore
The installer now gets the appStoreUrl from the droplet metadata
2014-10-30 14:02:12 -07:00
Girish Ramakrishnan 779c9c1392 Rework provisioning
The previous provisioning scheme had issues with updates. Because,
configuration was already part of the base bootstrap, providing an
update meant creating a new image.

The key insight in this new provisioning scheme is to treat config
files used by our code as something that can always be regenerated
on demand. Every update kills the config and recreates it all over.

Current flow is thus:
1. bootstrap init code starts up install/server.js. This server merely
   listens for provision and restore calls.

2. The installer calls install.sh. This script simply checks out the
   requested revision. Note that the installer is from what is in the
   base image. Changing the installer requires a new base image. If a
   restore url is provided, this downloads the restore data.

3. The install.sh calls postinstall.sh of the requested revision.
   It setups the code calling npm install, migrates any data and creates
   configs - collectd, graphite, nginx etc. This also creates cloudron.conf.

   Because postinstall.sh is from requested revision, all the data, configs
   are all based on the requested revision.

Note that installation of new packages should be done at base image creation
time.

The changes also provide separation of announce and hearbeat calls:
    - announce is for cloudron coming up and installer running
    - heartbeat is for box server running

TODO:
    appstore url is only part of image becase installer needs to announce.
    This can be fixed by moving to user metadata

Fixes #110
2014-10-29 15:01:40 -07:00
Girish Ramakrishnan c625e7ca76 Rename bootstrap init script to cloudron-bootstrap 2014-10-26 14:38:43 -07:00
Girish Ramakrishnan 884e88d736 Remove verbose logs for npm install 2014-10-24 23:17:24 -07:00
Girish Ramakrishnan fe17cbce50 data dir is now a btrfs subvolume
This makes it snapshottable
2014-10-24 23:01:23 -07:00
Girish Ramakrishnan b589a26991 Rename postinstall script to migrate_data
postinstall script is run automatically after npm install ends.
This create unnecessary confusion and we want to have more
control over when exactly the migration happens
2014-10-24 22:56:28 -07:00
Girish Ramakrishnan fae156366c Move to btrfs
The docker data as well as user (yellowtent) home is now btrfs.
This will greatly help us in backups. We simply take a btrfs
snapshot and back that up. This way we don't need to stop all
containers and simulates the same thing as a power outage.

Part of #108
2014-10-24 22:17:46 -07:00
Girish Ramakrishnan 80f82883cd Query snapshot id before destroying droplet
Allows us to work in parallel as the droplet is being destroyed
2014-10-24 19:57:28 -07:00
Girish Ramakrishnan 15df364c91 Move all configs to configs/
This makes it easy to delete them in a single shot
2014-10-24 17:45:55 -07:00
Girish Ramakrishnan 049912c096 Sleep a couple of minutes before retrying again 2014-10-24 17:26:14 -07:00
Girish Ramakrishnan bc24596d22 Fix typo 2014-10-22 00:27:12 -07:00
Girish Ramakrishnan 66e4a417d1 Fix scripts for new dir structure 2014-10-22 00:02:23 -07:00
Girish Ramakrishnan f11adb5e85 Run postinstall script on startup 2014-10-21 20:30:15 -07:00
Girish Ramakrishnan 772cefbfc6 Quote values in supervisor configs 2014-10-20 18:20:46 -07:00
Girish Ramakrishnan 9da9312086 Cleanup scripts 2014-10-20 16:52:33 -07:00
Girish Ramakrishnan 9f34ecdfa0 Store all data in data/ instead of .yellowtent/ in cloudrons
When run locally, it's still .yellowtent/
2014-10-20 16:44:14 -07:00
Girish Ramakrishnan 439107e6cb Remove unused script 2014-10-20 16:32:22 -07:00
Girish Ramakrishnan 665b9c6e06 Do not backup the certs
These are our certs!
2014-10-16 14:08:03 -07:00
Girish Ramakrishnan 0de57a01ab Just use docker exec instead of nsenter
New in docker 1.3

Fixes #109
2014-10-16 13:52:49 -07:00
Girish Ramakrishnan a8e86bbf90 Fix indentation of heredoc 2014-10-16 13:06:45 -07:00
Girish Ramakrishnan 8155a7d0b2 Retry git and npm command till it succeeds
It's fine to run them forever since after 30m the appstore
will recreate it anyway
2014-10-16 12:40:40 -07:00
Girish Ramakrishnan e8a123b439 Improve log messages in initialization script 2014-10-16 12:26:01 -07:00
Girish Ramakrishnan 4c8fa56175 Just use heroku for the moment since heroku keeps dying on me
Heroku has to be the most unstable service ever
2014-10-15 23:56:17 -07:00
Girish Ramakrishnan e72d2e1e4f Move to cloudron.io domain 2014-10-15 19:27:04 -07:00
Girish Ramakrishnan 4ea1bc65c9 Fix appstore url 2014-10-14 13:28:09 -07:00
Girish Ramakrishnan b8b72ffea4 I like dots 2014-10-10 13:16:19 -07:00
Johannes Zellner bf570f6f23 Add 2gb swapfile to the base image 2014-10-09 10:59:10 -07:00
Johannes Zellner cf05cd4c19 Create images only with 512mb droplets 2014-10-09 10:35:12 -07:00
Girish Ramakrishnan 76b3a7f3df Use . as progress indicator 2014-10-08 22:48:55 -07:00
Girish Ramakrishnan 11997a4adc Logging rules must be at the very end 2014-10-08 22:03:20 -07:00
Girish Ramakrishnan 112e77dc20 Log dropped incoming packages 2014-10-08 19:35:35 -07:00
Girish Ramakrishnan 99952e5bab Firewall the box
This change firewalls everything except the internal bridge. An upcoming
change should disable icc as well but that requires us to link all the
apps with the mail container.

Part of #59
2014-10-08 19:23:15 -07:00
Girish Ramakrishnan 324011d04f Remove debugging code
Not sure how this got committed
2014-10-06 11:02:36 -07:00
Girish Ramakrishnan a2baf856ae Add NET_ADMIN caps so that haraka can configure interface 2014-10-03 17:13:48 -07:00
Girish Ramakrishnan 1e02b9e8f4 Set the mail server static IP in haraka container instead
This makes it work across starts (like after a backup)
2014-10-03 16:05:18 -07:00
Girish Ramakrishnan f6697d4e4c Fix typo 2014-10-03 10:45:35 -07:00
Girish Ramakrishnan 4f615a1249 Give mail server a static IP
Docker containers get a new IP on every restart. This causes a problem
since we export the MAIL_SERVER as an env variable in apps.
2014-10-03 09:53:02 -07:00
Girish Ramakrishnan 84c917e438 Fix typo 2014-10-03 02:54:52 -07:00
Girish Ramakrishnan d30f4c44c2 Better email notifications 2014-10-03 02:32:01 -07:00
Girish Ramakrishnan e2342fc653 Send welcome email 2014-10-01 06:05:17 -07:00
Girish Ramakrishnan 480d7b9bfd Set loglevel to verbose 2014-09-29 17:21:20 -07:00
Girish Ramakrishnan dbbc6d1881 run node script as yellowtent user 2014-09-28 14:47:35 -07:00
Girish Ramakrishnan e15d516374 Save mailServer IP in cloudron config 2014-09-28 13:16:23 -07:00