Compare commits

..

524 Commits

Author SHA1 Message Date
Girish Ramakrishnan 53fed09a5d copy/paste error 2018-09-26 22:21:50 -07:00
Girish Ramakrishnan 4e2d1bd26e Set default cert provider to wildcard
Change it to non-wildcard for manual/noop/wildcard dns

(cherry picked from commit dfa4e20a8f)
2018-09-26 19:54:56 -07:00
Girish Ramakrishnan 477128c586 Change the cert provider selection box text
(cherry picked from commit ee1a194305)
2018-09-26 19:54:48 -07:00
Girish Ramakrishnan 4dec09f639 Move information text out of advanced view
(cherry picked from commit 0fa88855e5)
2018-09-26 19:54:42 -07:00
Girish Ramakrishnan eda3d5c143 Remove invalid dns config notification
The issue is that this value is never really updated unless the box
code is restarted.

Instead, we will fix it to check all domains periodically and send
some email notification.

Fixes cloudron/box#586
2018-09-26 15:13:44 -07:00
Girish Ramakrishnan b450efe5c2 Add SFO2 region in restore UI 2018-09-26 12:02:03 -07:00
Girish Ramakrishnan ca76626d55 Add checkbox UI for mailbox location
part of cloudron/box#587
2018-09-25 11:27:43 -07:00
Girish Ramakrishnan ed887953b6 typo 2018-09-12 20:19:40 -07:00
Girish Ramakrishnan 04debe3ea3 port80 requirement is more complex 2018-09-12 15:57:01 -07:00
Girish Ramakrishnan 4312096dd2 Add a wildcard provider option 2018-09-12 13:12:40 -07:00
Girish Ramakrishnan 94b079fa7b Show the title in port bindings instead of the long description 2018-09-12 11:22:02 -07:00
Girish Ramakrishnan 0373d86349 Fix error code 2018-09-10 11:22:29 -07:00
Girish Ramakrishnan 0f5c290785 we now return 424 2018-09-10 10:37:15 -07:00
Girish Ramakrishnan c79f43bb27 do spaces: sfo2 is now available 2018-09-10 09:27:08 -07:00
Girish Ramakrishnan 184ad3bc4e wildcard dns is now a provider 2018-09-06 20:12:25 -07:00
Girish Ramakrishnan aa0a4ae3e9 Handle locked domains 2018-09-05 23:23:27 -07:00
Girish Ramakrishnan ff9c4b407f Add help text 2018-09-05 21:46:26 -07:00
Girish Ramakrishnan c3b01d477e Typo 2018-09-05 21:31:44 -07:00
Girish Ramakrishnan 3c0641745b backups: Hide prefix for noop 2018-09-05 17:32:53 -07:00
Girish Ramakrishnan 7186a0c41b information text for hyphenated subdomain 2018-09-05 17:20:17 -07:00
Girish Ramakrishnan 4c3bc7450e domain: hide del button for admin domain 2018-09-05 17:15:30 -07:00
Girish Ramakrishnan 02f04e2d33 Disable various views for non-operators 2018-09-05 15:35:30 -07:00
Johannes Zellner 97b6e4c672 Just display subscription error message in the ui 2018-09-05 17:14:01 +02:00
Girish Ramakrishnan 2fd1caa2aa caas: Fix display of alternateDomain 2018-09-04 12:10:21 -07:00
Girish Ramakrishnan cb25217c48 Fix the edition name 2018-08-31 08:06:04 -07:00
Johannes Zellner ab70bc663d No need to show button to setup billing
Either it has a subscription or not, no trials anymore
This will not show any cc setup button now for other plans like
education
2018-08-29 23:24:24 +02:00
Johannes Zellner 0cfe931cd1 We do not have trials anymore 2018-08-29 23:22:47 +02:00
Girish Ramakrishnan 29bddb5fcb Fix derivation of adminFqdn 2018-08-28 22:35:02 -07:00
Girish Ramakrishnan cb7d160346 Add more backup interval secs 2018-08-28 22:10:17 -07:00
Girish Ramakrishnan 507c8b8786 Add hyphenatedSubdomains checkbox to setup page 2018-08-28 21:59:03 -07:00
Girish Ramakrishnan 60107147c2 derive features from edition 2018-08-28 21:58:59 -07:00
Girish Ramakrishnan be2afec86b spaces: Fix text 2018-08-28 20:32:07 -07:00
Girish Ramakrishnan d316d216db spaces: use edition instead of setting 2018-08-28 19:36:26 -07:00
Girish Ramakrishnan dd53d0d575 caas+spaces: location suffix fix 2018-08-28 14:22:40 -07:00
Girish Ramakrishnan 0f6c0a2ccd Use spaces suffix that replaces dots in username
This assumes usernames only have . or - but not both
2018-08-28 12:23:14 -07:00
Girish Ramakrishnan 937a165711 spaces: Strip the trailing username when configuring 2018-08-28 10:38:53 -07:00
Girish Ramakrishnan 22c402ca3d clone: subdomain hyphenation 2018-08-27 21:40:49 -07:00
Girish Ramakrishnan eddbd4fddc Do the filter later 2018-08-27 21:06:07 -07:00
Girish Ramakrishnan 0e43ca31a3 spaces: add username suffix when installing apps 2018-08-27 20:45:09 -07:00
Girish Ramakrishnan 9c90a20b4d Get token name as input 2018-08-27 16:04:16 -07:00
Girish Ramakrishnan 764e7e7d1f Fix indent 2018-08-27 15:40:23 -07:00
Girish Ramakrishnan 0e8cb00233 Display token name 2018-08-27 15:34:46 -07:00
Girish Ramakrishnan 0a1a011338 Move the API token to account page
The OAuth page is less and less useful. Moreover, the tokens are
actually tied to the user and not for the system.
2018-08-27 15:26:52 -07:00
Girish Ramakrishnan 3dfcd9324d invite -> setup link 2018-08-27 15:08:09 -07:00
Girish Ramakrishnan 3e4ac4a0ca Keep it short (and abstract) 2018-08-27 13:50:13 -07:00
Girish Ramakrishnan be1795d50d domains: make the certs setup more descriptive 2018-08-27 13:19:57 -07:00
Girish Ramakrishnan 0b0b06baa9 certs: Rename Self-Signed to custom 2018-08-27 12:04:55 -07:00
Girish Ramakrishnan b789cd2af0 Fix incorrect title of invitation dialog 2018-08-27 11:43:24 -07:00
Johannes Zellner 0871403c0a Support hyphenated subdomains in install and configure dialogs 2018-08-22 17:25:27 +02:00
Johannes Zellner 53a34d9352 Support hyphenatedSubdomains property in domains view 2018-08-22 11:54:37 +02:00
Girish Ramakrishnan fe23551b04 Show the doc link in the post install confirm body 2018-08-21 19:21:03 -07:00
Girish Ramakrishnan 484b6477d3 Fix duplicate id in app configure form 2018-08-20 09:44:30 -07:00
Girish Ramakrishnan 8ebe04c2ff Do not send invite email when invite button is pressed 2018-08-17 16:26:16 -07:00
Girish Ramakrishnan 672d6b0856 Add backup interval
Part of cloudron/box#568
2018-08-13 22:40:05 -07:00
Girish Ramakrishnan 0c066fafa2 remove backup default comment 2018-08-13 22:22:46 -07:00
Girish Ramakrishnan 6c574ead94 Make UDP ports configurable
Part of cloudron/box#504
2018-08-13 09:15:21 -07:00
Girish Ramakrishnan 31a62313bb Reconfigure email apps when email is enabled/disabled 2018-08-12 13:21:17 -07:00
Johannes Zellner 4dacf7064f Apps already use singular document tag 2018-08-06 22:22:49 +02:00
Johannes Zellner e900e4de77 Add Documents category 2018-08-06 21:46:24 +02:00
Girish Ramakrishnan 4ce6939b79 spaces: show based on plan id 2018-08-06 10:53:16 -07:00
Girish Ramakrishnan 8430fd1473 Fix more errors in clone UI 2018-08-06 00:46:10 -07:00
Girish Ramakrishnan ac7c54e273 Fix errors in the clone form 2018-08-06 00:34:40 -07:00
Girish Ramakrishnan 6c9a3b530d Display restore error on page load 2018-08-05 23:30:22 -07:00
Girish Ramakrishnan 2f2c70d1df Set the users when creating group 2018-08-05 22:19:54 -07:00
Girish Ramakrishnan a78c991330 Give some fixed width to the columns 2018-08-05 22:10:45 -07:00
Girish Ramakrishnan 8f9349ec53 Remove double "this" 2018-08-05 21:43:34 -07:00
Girish Ramakrishnan bc6be6a9ad Fix indent 2018-08-05 21:40:18 -07:00
Girish Ramakrishnan a9b7c2795a Fix styling 2018-08-05 21:34:47 -07:00
Girish Ramakrishnan cd81cc8cb8 Refine the text 2018-08-05 21:09:16 -07:00
Girish Ramakrishnan 473b35d807 Query backup config only for admins 2018-08-03 23:35:37 -07:00
Girish Ramakrishnan 0c04d5bfc8 spaces: fetch users/groups/domains 2018-08-03 23:27:21 -07:00
Girish Ramakrishnan eed460f435 Fetch complete app object for owner 2018-08-03 23:00:25 -07:00
Girish Ramakrishnan d742982973 spaces: default the access restriction to just the user 2018-08-03 22:51:53 -07:00
Girish Ramakrishnan c8263077a2 appstore app object has no location or accessRestriction 2018-08-03 22:29:52 -07:00
Girish Ramakrishnan eae01bdbd9 appId is not needed in configure route 2018-08-03 18:44:30 -07:00
Girish Ramakrishnan 1ebafbbc20 spaces: fixup user interface 2018-08-03 18:38:00 -07:00
Girish Ramakrishnan a525bb0257 Missed this 2018-08-03 17:47:02 -07:00
Girish Ramakrishnan cf5cf9e42f Remove usage of tokenScopes and caps 2018-08-03 10:13:57 -07:00
Girish Ramakrishnan 7969dff043 Add UI for enabling spaces 2018-08-03 09:44:56 -07:00
Girish Ramakrishnan d73f7304b3 Copy admin flag 2018-08-03 09:34:58 -07:00
Johannes Zellner 4400b0117a Fix linter issues 2018-08-02 22:17:27 +02:00
Johannes Zellner 739c91b1c6 Do not throw errors if a group has a uid which is not yet known
This can happen if the users have not yet loaded fully
2018-08-02 22:16:57 +02:00
Girish Ramakrishnan 510115ade9 Show danger color if update fails 2018-08-01 17:02:09 -07:00
Girish Ramakrishnan 8c2d79b75e Show app id in info dialog 2018-08-01 12:37:17 -07:00
Johannes Zellner 1a31fb78e5 Add homescreen icons for mobile 2018-07-30 22:05:20 +02:00
Girish Ramakrishnan 97f4d5e3ac Show busy indicator when toggling email 2018-07-30 11:30:49 -07:00
Girish Ramakrishnan d0b17f7e7b Delete any endpoint configuration when using s3 2018-07-30 07:29:22 -07:00
Girish Ramakrishnan eb74aaff3b Display restore errors
Part of cloudron/box#505
2018-07-29 20:48:37 -07:00
Girish Ramakrishnan 9108b665a8 restore: show encrytion field for rsync format 2018-07-29 19:51:44 -07:00
Girish Ramakrishnan e449147ed4 setup: Make it wider 2018-07-29 19:46:52 -07:00
Girish Ramakrishnan 53e82876dd setup: add link to hide advanced settings 2018-07-29 19:43:36 -07:00
Girish Ramakrishnan dd4a4518b3 Allow backup key to be set for rsync format
Part of #440
2018-07-28 09:13:42 -07:00
Girish Ramakrishnan a9e46c64b1 Show group members 2018-07-26 23:58:25 -07:00
Girish Ramakrishnan fb85770fd3 admin group is now gone 2018-07-26 23:42:38 -07:00
Girish Ramakrishnan 9e9e651714 admin is now simply a flag 2018-07-26 15:54:21 -07:00
Girish Ramakrishnan 314da7ace8 Fix API of Client.createUser 2018-07-26 15:52:10 -07:00
Girish Ramakrishnan 54103ca120 Revert role support 2018-07-26 11:38:20 -07:00
Girish Ramakrishnan be86a3022f Call the new setDnsRecords route 2018-07-25 10:52:06 -07:00
Girish Ramakrishnan 91ecab08da Fix typo 2018-07-24 22:40:27 -07:00
Girish Ramakrishnan cae445556e Allow groups to be set during user add 2018-07-24 22:38:53 -07:00
Girish Ramakrishnan 8c2af87857 Fix coding style 2018-07-24 22:31:22 -07:00
Girish Ramakrishnan 2d44e356d3 Add user multi-select to group edit dialog 2018-07-24 22:25:44 -07:00
Girish Ramakrishnan dec1931f07 Make groups a multiselect
With many groups, it overflows and very cluttered
2018-07-24 21:36:52 -07:00
Girish Ramakrishnan 46473c3756 Show displayName in user listing 2018-07-24 15:20:25 -07:00
Girish Ramakrishnan cd893edfcf Add display name to user edit 2018-07-24 15:17:51 -07:00
Girish Ramakrishnan 84302c1739 Fix the text 2018-07-24 14:38:47 -07:00
Girish Ramakrishnan d6f6b4bfe5 Display hostname in mail status
Many are copy/pasting the domain directly into the DNS UI and it fails.
2018-07-24 14:34:26 -07:00
Girish Ramakrishnan 8c6531b6fb Add Mailjet 2018-07-23 16:47:24 -07:00
Girish Ramakrishnan f4993a7e58 Change redirection text 2018-07-16 18:39:22 -07:00
Girish Ramakrishnan cc812c2177 Add user transfer event 2018-07-05 13:54:05 -07:00
Girish Ramakrishnan e11dc028d1 Transfer deleted user's resources 2018-07-05 13:44:00 -07:00
Johannes Zellner e314910a76 Ensure we uri encode the email query param for setup links 2018-07-04 11:10:13 +02:00
Johannes Zellner ee9140c365 Use the correct object to reset alternateDomains 2018-07-03 18:04:25 +02:00
Johannes Zellner ce4ccc21dd Set better defaults and placeholder text for alternate domains 2018-07-03 18:04:03 +02:00
Johannes Zellner 6108fcf17b Put the alternate domain settings behind a checkbox 2018-07-03 18:00:22 +02:00
Johannes Zellner cd3fb77033 Add support for one alternate domain which redirects 2018-06-29 23:42:13 +02:00
Johannes Zellner 0697274311 Remove very odd unused line 2018-06-29 23:42:13 +02:00
Girish Ramakrishnan 11f5aaaf3b Pass on the tokenScopes 2018-06-29 09:09:25 -07:00
Girish Ramakrishnan 8f0b66bd98 Rework config routes
The config route now returns non-sensitive information under the
profile scope.

Caas config is a separate route

Update config is a separate route
2018-06-28 17:50:33 -07:00
Girish Ramakrishnan 3be660dcd9 If user has no appstore scope, we cannot get subscription info 2018-06-27 18:15:48 -07:00
Girish Ramakrishnan 3bb82d5e68 Use app ts to determine whether to refetch app 2018-06-26 19:54:18 -07:00
Girish Ramakrishnan 3f9f1480d3 The uninstall id gets cleared 2018-06-26 19:47:48 -07:00
Girish Ramakrishnan 948c446362 typo 2018-06-26 19:47:48 -07:00
Girish Ramakrishnan 25f888e0d8 Get detailed app information if user can manage apps 2018-06-26 17:56:23 -07:00
Girish Ramakrishnan 98661de24e Fix error message display in configure dialog 2018-06-26 17:35:48 -07:00
Girish Ramakrishnan a833ceb737 Insert the app sorted into the cache 2018-06-26 17:12:55 -07:00
Girish Ramakrishnan b41d0379f0 Only refresh the individual app that is being managed 2018-06-26 10:22:38 -07:00
Girish Ramakrishnan df6da7dd1c logs: installedApps is not used 2018-06-26 10:21:43 -07:00
Girish Ramakrishnan 24ca5bc990 Refactor logic into _updateAppCache 2018-06-26 10:21:36 -07:00
Girish Ramakrishnan e3e62b8407 refresh immediately 2018-06-26 10:19:50 -07:00
Girish Ramakrishnan 0c98e6f4ca Mark it as internal function 2018-06-26 08:34:05 -07:00
Girish Ramakrishnan 6034121695 Make clone return data 2018-06-26 08:33:04 -07:00
Girish Ramakrishnan afe837e30a Remove used of Client.onApps 2018-06-25 20:15:24 -07:00
Girish Ramakrishnan f3cf640e21 terminal: use Client.getApp instead of refreshInstalledApps 2018-06-25 19:19:56 -07:00
Girish Ramakrishnan 8d98cefcca terminal: Remove unused dropdown logic 2018-06-25 19:10:26 -07:00
Girish Ramakrishnan bdf57a5c0a remove dead code 2018-06-25 19:10:00 -07:00
Girish Ramakrishnan 37f108d9f7 logs: remove dep on refreshInstalledApps 2018-06-25 18:58:11 -07:00
Girish Ramakrishnan 091663afe0 Add Client.getApp that uses REST API 2018-06-25 18:55:07 -07:00
Girish Ramakrishnan a77918bef9 Client.onReady has already loaded the app list 2018-06-25 18:27:40 -07:00
Girish Ramakrishnan f167714ea1 add note 2018-06-25 18:27:05 -07:00
Girish Ramakrishnan 1cab172169 Adapt UI logic to get user/group configuration for each user/group 2018-06-25 16:23:28 -07:00
Girish Ramakrishnan 35c3df5a18 Adapt UI logic to get domain configuration for each domain 2018-06-25 15:33:21 -07:00
Girish Ramakrishnan b9a6f46543 Check for 403 for incorrect password 2018-06-18 18:57:00 -07:00
Girish Ramakrishnan 12b1909c7a Add roles UI creating and editing a group 2018-06-18 18:48:54 -07:00
Girish Ramakrishnan 5bd57b6dbd lint 2018-06-18 18:34:19 -07:00
Girish Ramakrishnan 961220be3f tokenScope -> tokenScopes 2018-06-18 15:09:16 -07:00
Girish Ramakrishnan 4db703aeb1 Make the UI capability based 2018-06-17 18:24:45 -07:00
Girish Ramakrishnan cec1cc7086 scope -> tokenScope 2018-06-17 15:29:10 -07:00
Girish Ramakrishnan 2bacbe6701 caas: disable enable email button instead of hiding it 2018-06-16 11:28:13 -07:00
Girish Ramakrishnan 3c65d88c65 caas: disable editing managed domain 2018-06-16 11:22:41 -07:00
Girish Ramakrishnan 726a1c37cc caas: show the backups view, just not the configure button 2018-06-16 11:14:45 -07:00
Girish Ramakrishnan 63f2bbb253 wrong password is 401 2018-06-15 20:54:15 -07:00
Girish Ramakrishnan 7f11cc0daf add note 2018-06-15 17:16:50 -07:00
Girish Ramakrishnan f32884b3b2 Add button for backup logs 2018-06-15 09:55:19 -07:00
Johannes Zellner 97465c1bd8 Last one to open the terminal in a new tab from within the logs view 2018-06-15 17:03:00 +02:00
Johannes Zellner ce0a1ce38a Also open platform and email logs in a new tab instead of a window 2018-06-15 16:45:34 +02:00
Johannes Zellner f5060a0d4f Open logs and terminal in a new tab instead of a window 2018-06-15 16:42:04 +02:00
Johannes Zellner bb34c8a242 Ignore button clicks when post install is not yet confirmed
Angular does not remove the click handler on ng-disabled :-/
2018-06-15 13:39:33 +02:00
Johannes Zellner 34fd733bb7 Fix mouse cursor state in app grid 2018-06-15 13:39:07 +02:00
Johannes Zellner 19b65460ff Do not show postinstall if the app is not ready yet 2018-06-15 13:35:46 +02:00
Girish Ramakrishnan edf277fcaf Feedback API has moved to cloudron scope 2018-06-14 20:04:38 -07:00
Girish Ramakrishnan 9db334c2a4 Show backup notification in main.js instead 2018-06-14 12:59:25 -07:00
Johannes Zellner 1039d9c95e Remove postinstall message from the appstore view
This is now shown on first click
2018-06-14 16:07:29 +02:00
Johannes Zellner 37c8b2b57f Make the user confirm the post install message on first time clicking the app icon 2018-06-14 15:46:55 +02:00
Girish Ramakrishnan 461fb0144e Fix wording 2018-06-13 12:25:29 -07:00
Girish Ramakrishnan 60a9c60f40 Fix typo preventing email from getting enabled 2018-06-12 19:18:47 -07:00
Girish Ramakrishnan 869a6b5a51 Add email to setupLink 2018-06-12 17:59:04 -07:00
Girish Ramakrishnan 133e101f83 Fix download logs button 2018-06-12 14:50:18 -07:00
Girish Ramakrishnan 6ecadb2308 Remove unused readFileLocally 2018-06-12 14:33:19 -07:00
Girish Ramakrishnan 0d3ff81d6c Fix UI jumpiness 2018-06-12 14:24:17 -07:00
Girish Ramakrishnan e938886629 Add box logs to support view 2018-06-12 14:05:58 -07:00
Girish Ramakrishnan aa32055aa8 lint 2018-06-12 13:37:31 -07:00
Girish Ramakrishnan 59481c37bc Remove redundant user.admin check 2018-06-12 13:31:23 -07:00
Girish Ramakrishnan 0b868dad2d remove the thanks (it is a bug report) 2018-06-12 13:20:08 -07:00
Girish Ramakrishnan 3c063a2263 Remove one section since I want to add the logs section 2018-06-12 12:55:44 -07:00
Johannes Zellner f9750e237a We always allow app updates now 2018-06-12 17:46:07 +02:00
Johannes Zellner 908bb75fdc Only update the appstore profile if the root controller is still present 2018-06-12 17:31:52 +02:00
Girish Ramakrishnan a273827166 Make the name of the user non-optional 2018-06-11 14:22:02 -07:00
Girish Ramakrishnan 0cb96f4b03 Change password requirements text 2018-06-11 13:54:17 -07:00
Girish Ramakrishnan af7764253d Fix text 2018-06-11 11:29:31 -07:00
Girish Ramakrishnan af9652f7c8 Remove the email subscription requirement 2018-06-11 11:24:25 -07:00
Johannes Zellner e741ca9216 Support new platform log routes 2018-06-11 20:10:57 +02:00
Girish Ramakrishnan e3950c2fb0 Give user notification about how to resize 2018-06-08 12:22:45 -07:00
Girish Ramakrishnan 3eae49139c Create the terminal ws after fit()
part of cloudron/box#549
2018-06-08 12:04:12 -07:00
Girish Ramakrishnan 97f17916f9 mail: hide the status tab entirely for caas 2018-06-08 09:54:58 -07:00
Johannes Zellner ee0a25962b Show only featured apps first on appstore listing 2018-06-08 09:48:34 +02:00
Girish Ramakrishnan 55fb3b3b55 Fix various text 2018-06-07 19:42:13 -07:00
Johannes Zellner a58d9d1497 Have a better fallback for eventlog source 2018-06-07 23:04:26 +02:00
Johannes Zellner 801dbc9705 Only show terminal button in logs view for apps 2018-06-07 22:44:31 +02:00
Girish Ramakrishnan e3897c4c34 Make user confirm that they use an external disk 2018-06-07 11:36:55 -07:00
Girish Ramakrishnan 04dd8914cd Move logs button to separate section 2018-06-07 10:48:18 -07:00
Johannes Zellner c2651fd8f8 Remove backup related bits from the settings view 2018-06-07 16:30:40 +02:00
Johannes Zellner 27f760fdbf Add separate backups page 2018-06-07 14:22:48 +02:00
Johannes Zellner a74cf0b064 add logs viewer for email server 2018-06-07 11:40:50 +02:00
Girish Ramakrishnan e09d2db7e6 Fix layout on larger screen 2018-06-05 22:46:06 -07:00
Girish Ramakrishnan 28f183f450 Explicitly mark zone name as optional 2018-06-05 21:14:10 -07:00
Girish Ramakrishnan 5126b605f2 Remove redundant "This domain must be hosted" text
If anything we can add them as <sup> info links
2018-06-04 21:47:23 -07:00
Girish Ramakrishnan aaebdda9d6 Remove bizzare color 2018-06-04 21:46:29 -07:00
Girish Ramakrishnan af29a3f498 Remove redundant "This domain must be hosted" text 2018-06-04 21:44:15 -07:00
Girish Ramakrishnan 55b6773d88 Add labels to setup page as well 2018-06-04 21:39:09 -07:00
Girish Ramakrishnan 239ec86c4a Fix setupdns layout 2018-06-04 20:59:23 -07:00
Girish Ramakrishnan 13adca00d6 do not center restore page labels 2018-06-04 20:46:40 -07:00
Girish Ramakrishnan a76631ee3d Add labels
Poeple seem to forget wat those fields are for mid-way through filling
the form. The place holder stuff is not overly obvious apparently.

This makes it consistent with all our other UI nevertheless
2018-06-04 20:30:22 -07:00
Girish Ramakrishnan 7ac99f16cd Fallback -> Self-signed 2018-06-04 16:52:17 -07:00
Girish Ramakrishnan 3b6ca1c59d Fix spacing 2018-06-04 15:51:29 -07:00
Girish Ramakrishnan 3f55064c47 Fix name.com links 2018-06-04 10:13:47 -07:00
Girish Ramakrishnan 917bc2a88c Reduce the padding (like in configure dialog) 2018-05-30 10:08:36 -07:00
Johannes Zellner 85dfa1ccad Always show the restore and clone tabs 2018-05-30 15:13:05 +02:00
Johannes Zellner 606828da1d Show backup create button next to the tabs 2018-05-30 15:07:16 +02:00
Johannes Zellner a182d78566 Give busy feedback when the app clone is initiated 2018-05-29 22:53:51 +02:00
Johannes Zellner 0f294531d3 Do not show backup creation button if we still fetch backups 2018-05-29 22:48:42 +02:00
Johannes Zellner 9189532b83 Fix error reporting of restore form
angular does not attach form elements to the $scope when the DOM
elements are created dynamically!
2018-05-29 22:46:06 +02:00
Johannes Zellner c031253bd4 Use tabs instead of accordion for restore/clone ui 2018-05-29 22:05:18 +02:00
Johannes Zellner 11ae5d4832 Allow the user to setup a subscription when enabling email 2018-05-29 17:17:53 +02:00
Johannes Zellner 3251dc3d73 Show hint to setup subscription if more than allowed apps are installed 2018-05-28 20:26:24 +02:00
Girish Ramakrishnan a671e6acf7 Move the buttons to dialog footer 2018-05-28 10:05:57 -07:00
Girish Ramakrishnan 5ce658125c Make the text less verbose 2018-05-28 10:05:52 -07:00
Girish Ramakrishnan 1d88a935a5 Add clone UI
part of #248
2018-05-28 10:05:47 -07:00
Girish Ramakrishnan 8da07a16b9 dnsConfig is used incorrectly 2018-05-28 10:05:42 -07:00
Girish Ramakrishnan 7ce045ae51 Make it an accordion 2018-05-28 10:05:36 -07:00
Girish Ramakrishnan a3e253436e Allow setting app visibility for non-SSO apps
Fixes #532
2018-05-25 13:59:53 -07:00
Johannes Zellner 08955ce5a4 Do not show cryptic UTC timestamp format for backups 2018-05-25 13:56:15 +02:00
Johannes Zellner 57a4fa2d38 fix the restore dropdown and change some labels 2018-05-25 13:49:38 +02:00
Johannes Zellner 548e652ba2 Update the setup subscription dialog text 2018-05-25 13:39:04 +02:00
Girish Ramakrishnan e92cfae4d9 Fix error handling 2018-05-24 20:15:08 -07:00
Girish Ramakrishnan ed1320c937 Only send mailboxName if it changed 2018-05-24 16:29:36 -07:00
Girish Ramakrishnan abccffd05f Put domain in the mailbox name
part of cloudron/box#558
2018-05-24 16:05:27 -07:00
Girish Ramakrishnan c1106aa32e Save -> Configure 2018-05-24 15:54:50 -07:00
Girish Ramakrishnan a94f5daac9 Allow mailbox name to be configured
part of cloudron/box#558
2018-05-24 15:42:40 -07:00
Girish Ramakrishnan 9d9f16e948 Re-work the configure dialog 2018-05-24 14:13:00 -07:00
Girish Ramakrishnan 0b5bd0b4cd Another take on this layout 2018-05-24 13:43:25 -07:00
Girish Ramakrishnan caa59dd9a9 Better layout 2018-05-24 09:55:33 -07:00
Girish Ramakrishnan 423958dd0e Add links to appstore 2018-05-24 09:45:08 -07:00
Girish Ramakrishnan 6a90cf5102 Fix incoming email section a bit 2018-05-24 09:26:41 -07:00
Johannes Zellner 2d820a3005 Remove label about free trial 2018-05-24 15:23:33 +02:00
Johannes Zellner 7fff55a1ed Style the tab widget to fit our style 2018-05-24 15:17:44 +02:00
Girish Ramakrishnan 52d1d47030 Add setting for mail from validation
Fixes #454
2018-05-23 23:34:11 -07:00
Girish Ramakrishnan 7df1d388f0 ManageSieve is now STARTTLS 2018-05-23 23:15:17 -07:00
Girish Ramakrishnan a34f5f13da Remove panel headers since they appear very heavy 2018-05-23 22:12:09 -07:00
Girish Ramakrishnan bcc1e5f79c Make the email UI tabbed 2018-05-23 22:00:48 -07:00
Girish Ramakrishnan 44d32ea281 add app backup button
Fixes cloudron/box#497
2018-05-23 21:17:12 -07:00
Johannes Zellner 63e16c9bb8 Minor rewording to better fit the free tier 2018-05-22 19:17:14 +02:00
Girish Ramakrishnan 528be0e4c0 Remove redundant auto-update check button 2018-05-21 09:28:30 -07:00
Girish Ramakrishnan 0660a924b7 Add some spacing 2018-05-19 18:11:20 -07:00
Girish Ramakrishnan 6f29d5f3f6 explicitZone is gone 2018-05-19 17:28:43 -07:00
Girish Ramakrishnan 9903004af5 Remove trial expiry display 2018-05-18 22:30:39 -07:00
Girish Ramakrishnan 0c2b250901 Fix article 2018-05-18 12:08:19 -07:00
Girish Ramakrishnan 00f8e96dd2 Remove spurious > 2018-05-17 09:06:27 -07:00
Girish Ramakrishnan 267fa79164 Add advanced settings to setupdns 2018-05-15 16:24:09 -07:00
Girish Ramakrishnan 1528aa9d0c domain: add advanced view for zone name and cert provider 2018-05-15 15:39:43 -07:00
Girish Ramakrishnan 0cd6f7f2e7 Set text based on debugMode
Fixes cloudron/box#553
2018-05-15 12:13:31 -07:00
Johannes Zellner f05967d871 Fix terminal resize on window resize
This still does not update the terminal COLUMNS and ROWS
2018-05-15 18:31:54 +02:00
Girish Ramakrishnan 26087e1580 remove user/ from profile route 2018-05-13 21:51:13 -07:00
Girish Ramakrishnan 9275c4fbfd Fix display of error message in mailbox add 2018-05-11 11:16:38 -07:00
Johannes Zellner a2e03ccf7a Fix the dns check notification link 2018-05-11 11:05:28 +02:00
Johannes Zellner 6605a38eab Add scheduler addon dropdown to webterminal 2018-05-11 10:40:11 +02:00
Johannes Zellner 0a09d89684 Add name.com to setup dns 2018-05-09 18:44:03 +02:00
Johannes Zellner c0d4100dd1 Add name.com DNS provider 2018-05-09 12:24:46 +02:00
Girish Ramakrishnan 791f5af3e0 Fix scope use in logs.js and terminal.js 2018-05-07 14:48:52 -07:00
Girish Ramakrishnan ed57e701bc Revert "route53: set listHostedZonesByName property"
This reverts commit 07b428f051.

We can just do this in the backend entirely
2018-05-07 13:41:36 -07:00
Girish Ramakrishnan c678a9b6d7 lint 2018-05-07 13:18:51 -07:00
Girish Ramakrishnan 07b428f051 route53: set listHostedZonesByName property 2018-05-07 11:27:24 -07:00
Girish Ramakrishnan a1ab8b6aa8 reset the expect dns records on refresh 2018-05-06 23:47:38 -07:00
Girish Ramakrishnan a07848164c Show dialog when disabling email 2018-05-06 23:41:39 -07:00
Girish Ramakrishnan 1b1d4ee431 Add GoDaddy 2018-05-06 22:36:33 -07:00
Girish Ramakrishnan f8e5668c5c typo 2018-05-06 21:51:58 -07:00
Girish Ramakrishnan d8719626d9 Add UI for Gandi LiveDNS
Part of cloudron/box#235
2018-05-06 19:38:30 -07:00
Girish Ramakrishnan 3a06797de0 AppStore now returns 401 2018-05-06 19:38:30 -07:00
Girish Ramakrishnan b9d7149dbb Remove email domain logic from users view 2018-05-01 15:25:43 -07:00
Girish Ramakrishnan 72bbb4ec68 Use the scope to determine what the user has access to 2018-05-01 14:40:59 -07:00
Girish Ramakrishnan d9ec1be9b6 Get the user profile first to determine the scope 2018-05-01 14:19:05 -07:00
Girish Ramakrishnan ecddb6977a Use the version in the status API instead
This is because we want to get the user's profile as the first
thing to know the scopes
2018-05-01 14:15:12 -07:00
Girish Ramakrishnan 77220038a1 clients API has moved up a level 2018-05-01 11:08:34 -07:00
Girish Ramakrishnan 016f194271 typo 2018-04-29 18:02:48 -07:00
Girish Ramakrishnan e34fecee5e Pass scope and expiresAt as body params 2018-04-28 22:02:46 -07:00
Girish Ramakrishnan 7448dc5ec5 Capitalize 2018-04-28 10:19:21 -07:00
Girish Ramakrishnan bfd25a08c2 Use new route to query user apps 2018-04-26 20:07:53 -07:00
Girish Ramakrishnan 8861e61bdf profile routes have moved under /api/v1/user 2018-04-26 19:58:38 -07:00
Girish Ramakrishnan 049c2fca8a Make it a button 2018-04-26 09:58:45 -07:00
Girish Ramakrishnan 63df9df913 Add links to TOTP apps 2018-04-26 09:32:56 -07:00
Johannes Zellner 05b6740e07 Refresh the user profile on 2fa status change 2018-04-26 16:54:03 +02:00
Johannes Zellner 46aac0288c Add 2fa disable flow 2018-04-26 16:38:26 +02:00
Johannes Zellner 4ec0fbd33c Show 2fa status in accounts view 2018-04-26 16:32:43 +02:00
Johannes Zellner 7a24d5fdfa Add 2fa enabling flow to accounts view 2018-04-26 16:30:07 +02:00
Johannes Zellner 3f082ccace Fix typo 2018-04-26 14:49:14 +02:00
Girish Ramakrishnan a37fc3093a Add note to setup subscription 2018-04-26 01:19:48 -07:00
Johannes Zellner 4541940a76 Make the setup billing button more descriptive 2018-04-24 11:49:03 +02:00
Johannes Zellner 3017fe0c95 Remove (in trial) label 2018-04-24 11:47:47 +02:00
Johannes Zellner d3bf9a2478 Avoid further flickering of the subscription buttons 2018-04-24 11:47:00 +02:00
Johannes Zellner 7107672358 Fix trial badge flickering 2018-04-23 20:55:03 +02:00
Johannes Zellner 8519d6665e Add support for appstore 2fa setup 2018-04-22 18:52:37 +02:00
Girish Ramakrishnan 774c9e435e Make it 1.5 since we have some swap to work with 2018-04-19 19:20:45 -07:00
Girish Ramakrishnan e1f35a8d9f Fix wording 2018-04-18 12:40:30 -07:00
Johannes Zellner 67136e418c Encode the email query argument
This is required to correctly transfer characters like +
2018-04-18 21:29:40 +02:00
Johannes Zellner 924cc997aa Hide cloudron.io account section in settings if it is not yet registered 2018-04-18 21:18:31 +02:00
Johannes Zellner 12eda5f507 Improve subscription indicator
We now don't show anything when the cloudron is still in trial period
but the user already has setup billing
2018-04-18 17:56:04 +02:00
Girish Ramakrishnan 96bb979abf Add CRM category 2018-04-17 16:28:31 -07:00
Girish Ramakrishnan f74ad0323c Fix README title 2018-04-17 09:39:32 -07:00
Girish Ramakrishnan 62fd73f1b1 Fix link 2018-04-17 09:39:02 -07:00
Johannes Zellner 44f027eb04 remove unused require 2018-04-15 11:00:25 +02:00
Johannes Zellner c9cf6d610b Revision is not part of OAuth credentials 2018-04-15 11:00:01 +02:00
Johannes Zellner 16d4d28046 Be consistent and make domain list entries edit on click 2018-04-13 21:50:21 +02:00
Johannes Zellner 2280008029 Give a lot more backlog for the app logs 2018-04-13 13:13:51 +02:00
Johannes Zellner a36439314d Fix logviewer autoscroll for chrome
Chrome does not support the scrollTopMax property
2018-04-13 13:12:32 +02:00
Johannes Zellner 290b44fbb7 Fixup catchall to use mailboxes instead of users 2018-04-12 13:02:32 +02:00
Johannes Zellner 404c280595 Catchall property is now addresses 2018-04-12 12:37:32 +02:00
Johannes Zellner b0f8370a31 Make copies of mailbox properties to work with in edit dialog
This avoids local data model updates in the UI on dialog cancel
2018-04-12 12:26:54 +02:00
Johannes Zellner 6abcf4ec3c Remove left over artifacts from inline edit mode 2018-04-12 12:15:23 +02:00
Johannes Zellner db6d7bcefb Refresh the mailinglists on edit 2018-04-12 12:12:22 +02:00
Johannes Zellner 0e1913b0b4 Handle corner case, where mailbox referenced in mailinglist got removed 2018-04-12 12:12:11 +02:00
Johannes Zellner cc6b097dc5 Use a copy of the mailinglist properties on edit 2018-04-12 12:02:20 +02:00
Johannes Zellner c4f7a0c857 Ensure new mailboxes appear in maillinglist options 2018-04-12 11:57:15 +02:00
Johannes Zellner 34187d76b6 Update Chart.js to new version and show full fqdn for apps 2018-04-12 11:45:18 +02:00
Girish Ramakrishnan 87e7e9fa07 Add header to mailing list delete dialog 2018-04-11 19:04:26 -07:00
Girish Ramakrishnan 8643fbb65c Fix typo in mailbox delete dialog 2018-04-11 18:49:41 -07:00
Johannes Zellner 6a2846afeb Show full fqdn for apps in graphs 2018-04-11 19:19:05 +02:00
Johannes Zellner 7bfa23e2b1 Prevent email hash change listener to kick-in on view change 2018-04-11 12:16:44 +02:00
Girish Ramakrishnan bcd55972cd Remove many breaks
When email is disabled, there is just lots of empty space
2018-04-10 14:23:10 -07:00
Johannes Zellner d75e1d04b3 Do not use the same DOM element id twice 2018-04-10 18:05:35 +02:00
Johannes Zellner 02ef77398a Remove now unused apiOriginHostname variable from gulpfile 2018-04-10 18:00:18 +02:00
Johannes Zellner b0b19053a7 We now set the csp headers from nginx
This makes it easier to also support local development on non https
2018-04-10 17:59:46 +02:00
Johannes Zellner 5cc298555a Ensure assets have proper tag attributes and always source from / 2018-04-10 14:49:49 +02:00
Johannes Zellner f2a0dcca31 Cleanup some linter errors and usused classes 2018-04-10 14:49:20 +02:00
Johannes Zellner c274e60868 Remove unused noapp.html 2018-04-10 14:31:37 +02:00
Johannes Zellner bde6ef8797 Make new mailbox/list buttons large but give some space on the bottom 2018-04-10 14:11:16 +02:00
Johannes Zellner df15f63424 Remove unneccessary dashboard/ subfolder 2018-04-10 13:28:55 +02:00
Johannes Zellner 1bd4a0aa8e git ignore node_modules/ 2018-04-10 13:12:46 +02:00
Johannes Zellner f068ce4e85 Add package.json for gulp dependencies to build assets 2018-04-10 13:12:46 +02:00
Girish Ramakrishnan 20093c581c Make the button small instead 2018-04-09 15:37:05 -07:00
Girish Ramakrishnan 814d7bafa8 Remove the content-large to keep all views same size 2018-04-09 14:55:35 -07:00
Girish Ramakrishnan e07fac0335 Fix wording 2018-04-09 12:59:38 -07:00
Girish Ramakrishnan 39730c71ce Move buttons to top right 2018-04-09 12:29:00 -07:00
Johannes Zellner 8565130166 Allow deeplinking of domains into email view 2018-04-09 18:00:08 +02:00
Johannes Zellner 9acde7fe86 Add error feedback when mailbox name is already taken 2018-04-09 16:21:32 +02:00
Johannes Zellner 63e43e8d20 Move new mailinglist form to a dialog 2018-04-09 16:12:18 +02:00
Johannes Zellner 10a3af8e5e Ensure autofocus on dialog open 2018-04-09 15:58:25 +02:00
Johannes Zellner 14536febaf Move mailbox add form to dialog 2018-04-09 15:56:20 +02:00
Johannes Zellner 75b597418c Do not list app mailboxes 2018-04-09 15:45:54 +02:00
Johannes Zellner 435730470b Fix indentation 2018-04-09 15:08:05 +02:00
Johannes Zellner 689ddf6875 edit mailinglists with a dialog instead of inline 2018-04-09 15:01:12 +02:00
Johannes Zellner fa550f57b3 Style the alias input and fix some typos 2018-04-09 12:54:25 +02:00
Johannes Zellner b9b84b661a Remove unused css classes and make all mailbox lines edit on click 2018-04-09 12:49:25 +02:00
Johannes Zellner b7573f449f Remove mailbox inline editing 2018-04-09 12:45:00 +02:00
Johannes Zellner 69f6895bd6 Move mailbox edit to dialog 2018-04-09 12:42:14 +02:00
Johannes Zellner 72a1e0d5ca No need to console.error() if we show the error in the ui already 2018-04-06 16:58:46 +02:00
Johannes Zellner 4eb80eedc0 Avoid reflow of the ui when buttons are shown/hidden 2018-04-06 16:58:27 +02:00
Johannes Zellner 32e6931b46 Remove console.log()s 2018-04-06 16:56:19 +02:00
Johannes Zellner f60258ed71 Add mailbox add error handling 2018-04-06 16:51:57 +02:00
Johannes Zellner 32454ba64a Give the mailbox listing more space 2018-04-06 16:48:04 +02:00
Johannes Zellner de212f49c2 Fixup the mailinglist crud ui 2018-04-06 16:43:43 +02:00
Johannes Zellner c308bd90cb Ensure at least the index application assets are versioned for proper refresh 2018-04-06 00:11:08 +02:00
Johannes Zellner 593bde9d92 Ensure the main controller is aware of the newly setup subscription 2018-04-05 23:27:39 +02:00
Johannes Zellner a16bd7030a Fix the configure/select plan button in the settings 2018-04-05 23:27:14 +02:00
Johannes Zellner 4d248bce39 Give appstore login form more space on the bottom 2018-04-05 22:03:40 +02:00
Johannes Zellner e236264848 Fetch subscription directly after the cloudron was registered to update the ui 2018-04-05 21:49:15 +02:00
Johannes Zellner 20e9877fe9 Give mail view more horizontal space 2018-04-05 21:24:29 +02:00
Johannes Zellner b0c4021d17 Add mailbox delete ui 2018-04-05 21:22:07 +02:00
Johannes Zellner 01bfd84853 Fixup the mailbox edit logic 2018-04-05 21:15:02 +02:00
Johannes Zellner a0dbcc9bb3 Add ui bits to add mailboxes 2018-04-05 21:00:33 +02:00
Johannes Zellner bbe351161f Adjust mailbox wrapper functions 2018-04-05 14:02:56 +02:00
Girish Ramakrishnan 968f515679 Enter works (no need for comma) 2018-04-02 09:27:17 -07:00
Girish Ramakrishnan cbb5cb3702 your -> this 2018-04-02 09:24:24 -07:00
Girish Ramakrishnan 82ed1881ea Remove the mailboxes text 2018-04-02 09:23:29 -07:00
Johannes Zellner 4d13d309d3 Handle reserved alias errors 2018-04-02 15:01:01 +02:00
Johannes Zellner 75eae0d8ec Make asyncForEach available globally to reduce code duplication 2018-04-02 11:35:02 +02:00
Johannes Zellner c329541708 Remove mailinglist handling in users/groups view 2018-04-01 23:10:47 +02:00
Johannes Zellner 10b8e93713 Add mailinglist ui in the mail view 2018-04-01 22:42:21 +02:00
Johannes Zellner 963b1d60b5 Remove mailbox settings from user edit dialog 2018-04-01 20:53:49 +02:00
Johannes Zellner 158271de14 Add alias error reporting 2018-04-01 20:31:16 +02:00
Johannes Zellner baba63889d Add logic to set mailbox aliases 2018-04-01 19:12:06 +02:00
Johannes Zellner d52273a516 move mailbox and catchall sections above relay 2018-04-01 19:11:46 +02:00
Johannes Zellner 1b7556443f Add user table to manage mailboxes per domain
This does not yet handle the aliases
2018-03-30 18:34:00 +02:00
Johannes Zellner 9575a1158a Add user listing to mail view to manage per user mailboxes 2018-03-30 18:06:40 +02:00
Johannes Zellner 8ebcc2f8af Immediately check for new configuration after we check for updates 2018-03-30 15:29:45 +02:00
Johannes Zellner 8d6de76fa0 Show update button and dialog in settings view 2018-03-30 15:12:34 +02:00
Johannes Zellner 0ad813cc8d Move update button into notification instead of pill 2018-03-30 15:12:14 +02:00
Johannes Zellner 63ae9a90cf ensure we call the callback 2018-03-28 14:32:21 +02:00
Johannes Zellner 551912145e Refetch the subscription also on the main controller 2018-03-28 14:19:34 +02:00
Johannes Zellner 611f54c237 LICENSE EXPIRED looks quite harsh 2018-03-28 14:18:58 +02:00
Johannes Zellner 60c9f49b44 Show distinct setup billing button in settings 2018-03-28 12:41:20 +02:00
Johannes Zellner 9f66003755 Show trial state in settings view next to plan name 2018-03-28 12:29:37 +02:00
Johannes Zellner 862e1d94be Remove dead notification code 2018-03-28 12:26:53 +02:00
Johannes Zellner 8196f76847 Show different subscription bubbles based on the billing and subscription status 2018-03-28 12:26:24 +02:00
Johannes Zellner 09f1bb4653 Add alias error reporting 2018-03-27 20:19:17 +02:00
Johannes Zellner f626a1f0b7 Fixup all other async occurances 2018-03-27 19:40:20 +02:00
Johannes Zellner fd609d3e19 Fix poor man's async to break on and report errors 2018-03-27 19:38:09 +02:00
Johannes Zellner 977e83cc22 Do not send empty aliases 2018-03-27 18:34:41 +02:00
Johannes Zellner 59b3cabf7e parent.getSubscription() does not exist anymore 2018-03-26 15:22:39 +02:00
Johannes Zellner 4d85c36c16 Show app message if any on status label hover 2018-03-26 11:08:57 +02:00
Girish Ramakrishnan b762f80812 typo 2018-03-22 12:16:16 -07:00
Girish Ramakrishnan 4e0791eb22 Fix gulpfile to handle rename 2018-03-15 14:32:48 -07:00
Girish Ramakrishnan 392e6d1c98 fix gitignore 2018-03-15 14:25:08 -07:00
Girish Ramakrishnan 5a49a555ad we use the package files from the box repo 2018-03-15 14:24:21 -07:00
Girish Ramakrishnan d59cb63188 move files to dashboard/ 2018-03-15 14:23:51 -07:00
Johannes Zellner 1d0f87f408 Avoid reflow on settings page while fetching current subscription 2018-03-14 23:30:42 +01:00
Johannes Zellner a26264e8ce Remove usage of obsolete undecided subscription plan 2018-03-14 23:28:36 +01:00
Johannes Zellner ed716d7569 Sync the text what a subsription offers 2018-03-14 22:34:57 +01:00
Johannes Zellner f85fca1720 An update is actually a positive action 2018-03-14 20:38:17 +01:00
Johannes Zellner ed2539cbfc Change update dialog title and include version 2018-03-14 20:37:39 +01:00
Johannes Zellner 5405338d20 Remove redundant if condition 2018-03-14 20:10:48 +01:00
Johannes Zellner f8ad2fdc11 currentSubscription is not required anymore 2018-03-14 19:53:36 +01:00
Johannes Zellner a618f2b523 Make update button dependent on the sourceTarballUrl instead of the subscription type 2018-03-14 19:53:36 +01:00
Girish Ramakrishnan 8b5a88ba5e Remove break and just use some margin 2018-03-14 09:09:42 -07:00
Girish Ramakrishnan db9e3b44a1 Revert "Show all apps inactive and blurred in the background of the appstore login form"
This reverts commit b9d6c8f8bb.
2018-03-14 09:04:05 -07:00
Girish Ramakrishnan 634408d3a3 Fix the email instructions 2018-03-13 23:16:15 -07:00
Girish Ramakrishnan 529a668db3 Fix eventlog display 2018-03-13 22:03:25 -07:00
Girish Ramakrishnan c0f01da1cd Make it FREE TRIAL instead 2018-03-13 13:38:19 -07:00
Girish Ramakrishnan 4cbab59fdb Fix the setup billing link 2018-03-13 13:30:33 -07:00
Girish Ramakrishnan ec9c9fb0f5 Fix the subscription dialog text 2018-03-13 13:23:22 -07:00
Girish Ramakrishnan 286d634756 always require terms 2018-03-13 11:06:49 -07:00
Girish Ramakrishnan ca2457bfcb smallcase the Account 2018-03-13 11:00:41 -07:00
Girish Ramakrishnan 459cafdf56 Add description text during signup 2018-03-13 10:59:15 -07:00
Johannes Zellner b9d6c8f8bb Show all apps inactive and blurred in the background of the appstore login form 2018-03-13 10:50:03 +01:00
Johannes Zellner 2da019556b Improve and center appstore login form 2018-03-13 10:21:25 +01:00
Johannes Zellner cbd28bc12f Attempt to better position checkboxes 2018-03-13 10:16:31 +01:00
Johannes Zellner 4332f60cc4 Use the admin domain as the default when installing a new app 2018-03-13 09:38:55 +01:00
Girish Ramakrishnan 950179ee1c Just link to docs instead 2018-03-13 00:29:10 -07:00
Girish Ramakrishnan 803eb4760e Make text clearer 2018-03-13 00:24:33 -07:00
Girish Ramakrishnan 32a41e6c1c Clarify that users need a mailbox to access 2018-03-12 15:49:11 -07:00
Girish Ramakrishnan de195c461b make it text-info 2018-03-12 15:04:37 -07:00
Girish Ramakrishnan 5003a8ea4d Make it text-info for the underline to show 2018-03-12 14:17:58 -07:00
Girish Ramakrishnan caa41b0022 Fix the text to handle multi-domain email 2018-03-12 13:57:50 -07:00
Johannes Zellner c7151d2b8d Reduce newlines 2018-03-12 19:08:15 +01:00
Johannes Zellner 0929ae1a4c Remove unused app feedback dialog 2018-03-12 19:08:05 +01:00
Johannes Zellner 0c79c42c10 Use forum links for missing apps 2018-03-12 19:06:15 +01:00
Girish Ramakrishnan 028b24db03 Don't make the whole dialog red 2018-03-09 15:02:30 -08:00
Johannes Zellner bce3d3f664 Use fqdn instead of location for naked domain apps 2018-03-09 10:17:01 +01:00
Girish Ramakrishnan 828d6f6cc8 Show the provider and format for caas 2018-03-09 00:40:55 -08:00
Girish Ramakrishnan 0a026cc143 Display caas as Managed Cloudron 2018-03-09 00:37:20 -08:00
Girish Ramakrishnan 3bc9a87933 Fix display of caas domain 2018-03-09 00:29:00 -08:00
Girish Ramakrishnan 769f9adc9d Update mail domain when domain is updated 2018-03-08 18:06:50 -08:00
Johannes Zellner b5f53d921e Replace app-request link to point to the new forum 2018-03-08 21:46:16 +01:00
Girish Ramakrishnan 105e9e7825 Use the new app update pattern 2018-03-06 21:30:42 -08:00
Girish Ramakrishnan c8cf050156 Keep it alphabetical 2018-03-05 10:28:22 -08:00
Girish Ramakrishnan b7baafbbe6 actions -> events
also make it all past tense
2018-03-05 10:17:44 -08:00
Girish Ramakrishnan 85dde71ec3 fix display of undefined id
remove id display altogether, it's not very interesting to see it
2018-03-05 10:09:06 -08:00
Girish Ramakrishnan 2970b086a3 Updates -> App Updates 2018-03-05 09:39:03 -08:00
Johannes Zellner 5910709008 Use the correct model attribute for appId in feedback form 2018-03-05 17:10:00 +01:00
Johannes Zellner 2b6ce4f813 Reduce feedback form options and add ability to specify failing app 2018-03-05 12:54:09 +01:00
Johannes Zellner 451c697fb7 Show email as fallback when a user has no username yet 2018-03-05 12:14:20 +01:00
Johannes Zellner 09149318b1 Better format the multiselect element 2018-03-05 12:10:17 +01:00
Johannes Zellner d2d8eb9485 Allow to select multiple actions in the eventlog filter 2018-03-05 12:03:02 +01:00
Johannes Zellner 91265613a9 Prettify eventlog source display 2018-03-02 19:21:24 +01:00
Johannes Zellner 31c414bbe1 Use more readable datetime tooltip format in activity log 2018-03-02 18:58:49 +01:00
Johannes Zellner e2a3654ed7 Give the time more space in the activity log 2018-03-02 18:50:49 +01:00
Johannes Zellner 96d7283534 Do not alternate the background color of the activity log 2018-03-02 18:50:32 +01:00
Girish Ramakrishnan 256a7e322b Keep it all to two words 2018-03-02 09:12:53 -08:00
Johannes Zellner e5b78337ac Show more readable user event data 2018-03-02 13:42:24 +01:00
Johannes Zellner 67ba5aa1c5 fix indentation 2018-03-02 13:19:57 +01:00
Johannes Zellner 848a617f98 Make eventlog entries expandable to show raw event data 2018-03-02 10:50:05 +01:00
Johannes Zellner 1fc7efef0d Improve app related eventlog display 2018-03-02 10:49:46 +01:00
Girish Ramakrishnan 576f6eafbb Rename Chat to Forum 2018-03-01 13:40:10 -08:00
Girish Ramakrishnan 2caf73b5e3 Do not list mail domains and aliases if username is not available 2018-02-28 15:21:42 -08:00
Girish Ramakrishnan 56abb68e0c Link admin link to docs 2018-02-28 13:40:06 -08:00
Girish Ramakrishnan 7aaac5a48a reword email address on domains 2018-02-28 13:26:15 -08:00
Girish Ramakrishnan 8326587886 Give indication that the test is for the relay 2018-02-27 09:24:36 -08:00
Girish Ramakrishnan 466b3f4784 Make the user edit dialog say "Primary email" 2018-02-24 16:42:15 -08:00
Girish Ramakrishnan bccdf548a8 Fix typo making the MX records hidden 2018-02-23 17:04:38 -08:00
Girish Ramakrishnan fa4b1b3d5b Add note that user and group mailboxes must be enabled 2018-02-23 17:02:18 -08:00
Girish Ramakrishnan 9d47fd198f replace chat with forum 2018-02-23 15:53:23 -08:00
Girish Ramakrishnan 5966ee6800 replace terms link with license 2018-02-23 15:25:27 -08:00
Johannes Zellner 2d20e3c13d Scroll to top on category activation 2018-02-23 11:34:39 -08:00
Johannes Zellner 2172f8532d Rework the appstore category list 2018-02-23 11:34:27 -08:00
Johannes Zellner 9dc4318152 Reduce category item size 2018-02-23 11:34:04 -08:00
Johannes Zellner e1a92e7127 Make primary email labels explicit 2018-02-23 10:29:09 -08:00
Girish Ramakrishnan 767b31caa2 Display the pretty domain provider name in the table
This is especially needed to distinguish wildcard/manual.
2018-02-21 10:14:17 -08:00
Johannes Zellner c2232936e0 Replace chat with forum in the support page 2018-02-20 11:55:57 -08:00
Johannes Zellner 4f1bbfd9e3 Make it clear that support ssh button should be enabled only if we ask the user to do so 2018-02-20 11:27:12 -08:00
Johannes Zellner caf57e37dc Add eventlog groups for apps and users 2018-02-20 11:13:51 -08:00
Johannes Zellner 64b8e4ad6c Shorten app ids in eventlog 2018-02-19 01:56:12 -08:00
Johannes Zellner c9d3907124 Add missing whitespace 2018-02-19 01:56:12 -08:00
Girish Ramakrishnan bf6bea800b Add note that user/group mailboxes must be enabled 2018-02-18 12:04:37 -08:00
Johannes Zellner 26f1673d47 Show full fqdn on app grid item hover 2018-02-17 16:01:36 -08:00
Johannes Zellner 08153454a2 Show tooltips immediately for app actions to guide the user 2018-02-09 10:11:23 +01:00
Girish Ramakrishnan efc26ab587 Specify which domain mail should be enabled for 2018-02-08 19:08:00 -08:00
Girish Ramakrishnan e24e0a7e87 br was removed by mistake in 23bc267c46 2018-02-08 15:25:37 -08:00
Johannes Zellner 23bc267c46 Show full fqdn in apps grid for now instead of the domain on the top 2018-02-08 16:17:47 +01:00
Johannes Zellner 35cc592d61 Remove altDomain ui bits 2018-02-08 09:44:35 +01:00
Girish Ramakrishnan 512f6a1166 Remove obsolete action 2018-02-06 23:14:37 -08:00
Johannes Zellner 3160ffec3f The update schedule is only set for the apps now 2018-02-06 19:39:06 +01:00
Johannes Zellner c543d4517f Adjust to new autoupdate pattern rest apis 2018-02-06 19:25:06 +01:00
Girish Ramakrishnan d7334b991b Add DO SGP1 2018-02-05 11:06:40 -08:00
Girish Ramakrishnan 2b355f6ee4 typo 2018-02-03 18:23:49 -08:00
Girish Ramakrishnan cd6af57a6e Use SOS ng endpoint and v4
https://www.exoscale.ch/syslog/2018/01/09/object-storage/
2018-02-02 16:29:10 -08:00
Girish Ramakrishnan 674028ee77 This probably explains why people ask for support in issue tracker 2018-02-02 11:39:36 -08:00
Girish Ramakrishnan f51c2e7b61 pass env=dev as search param to set the tlsConfig 2018-01-31 21:02:12 -08:00
Johannes Zellner 182085d3f8 Remove the generation of the splash screen assets 2018-01-31 09:23:42 +01:00
Johannes Zellner b8e70f1160 Remove console.log() 2018-01-30 17:01:27 +01:00
Johannes Zellner c624c04e9d Hide alias and mailling list UI when no domain has email enabled 2018-01-30 16:33:27 +01:00
Johannes Zellner 666badfa38 Mailinglist remove route returns 204 2018-01-30 13:38:25 +01:00
Girish Ramakrishnan 21b9843083 Enable selector for now 2018-01-29 19:33:56 -08:00
Girish Ramakrishnan f3b53a22f5 Remove use of config.fqdn 2018-01-29 14:35:47 -08:00
Girish Ramakrishnan f850235b3a Remove ununsed setAdminCertificate 2018-01-26 20:46:58 -08:00
Girish Ramakrishnan f555cfddd0 Uncomment for testing 2018-01-26 11:53:26 -08:00
Johannes Zellner 1c9052f085 Rework the email domain and alias handling for user edits to fix various bugs 2018-01-26 15:39:35 +01:00
Johannes Zellner 6a450b7190 setAlias returns 202 on success 2018-01-26 15:39:02 +01:00
Johannes Zellner 75194525fb Remove unused function showBubble() 2018-01-26 15:04:18 +01:00
Johannes Zellner 9d57c81505 Add group edit ui to select mailing lists 2018-01-26 11:31:43 +01:00
Johannes Zellner 8af587b6d9 Add mailing list api wrappers 2018-01-26 11:31:19 +01:00
Girish Ramakrishnan c1cb2eda00 Add a hack for now to just add/remove mail domains as part of domains API 2018-01-25 13:40:45 -08:00
Girish Ramakrishnan 90c867da82 Fix the text 2018-01-25 10:08:29 -08:00
Johannes Zellner d97268dfa7 Give some busy indicator while email configs are fetching 2018-01-25 18:28:11 +01:00
Johannes Zellner c3ce6ef9f0 Add alias ui in user edit 2018-01-25 18:17:40 +01:00
Johannes Zellner eb3d6fe5f1 Use the new alias api in api wrapper 2018-01-25 18:16:47 +01:00
Johannes Zellner e39e7d4898 Adjust to the mailboxes route name change 2018-01-25 12:28:39 +01:00
Johannes Zellner b282375ac7 Also allow to change the fallbackEmail for users 2018-01-24 16:21:14 +01:00
Johannes Zellner 8deb28f8eb Add multiselect to enable mailboxes per user and domain 2018-01-24 16:20:56 +01:00
Johannes Zellner e91833dcf2 Add mailbox api wrappers to client.js 2018-01-24 16:20:21 +01:00
Girish Ramakrishnan ca9781c279 Fix display of domain 2018-01-23 20:43:49 -08:00
Girish Ramakrishnan 2d8412a629 Make API Key text clearer 2018-01-23 18:15:48 -08:00
Girish Ramakrishnan e4b253da22 test email now requires a domain 2018-01-23 16:10:09 -08:00
Girish Ramakrishnan 6edad6b986 remove enterprise checks 2018-01-23 11:55:36 -08:00
Johannes Zellner 7b7e94d3d6 Not sure what to do yet with alias ui in users settings, so disable to make the ui itself work 2018-01-23 17:09:47 +01:00
Johannes Zellner bc164281db Always show warning if an app requires email to be enabled for the selected domain
We can be smarter in the future and show this based on currently
selected domain from the dropdown
2018-01-23 16:51:53 +01:00
Johannes Zellner f94380b2dd Disable multidomain for domains and email view 2018-01-23 15:37:55 +01:00
Johannes Zellner a2241a4e47 Fix return code for email toggle to let the UI correctly react 2018-01-23 15:35:02 +01:00
Johannes Zellner 7e5afcfe6a Reenable and provision the catchall dropdown 2018-01-23 15:11:33 +01:00
Johannes Zellner 7c926cc051 Already update the ui while checking the mail status 2018-01-23 12:41:52 +01:00
Johannes Zellner 16f43e3eac Fixup the status check logic 2018-01-23 12:38:19 +01:00
Johannes Zellner 456577a166 First round of mail view refactoring 2018-01-23 12:30:35 +01:00
Johannes Zellner 7166604fc0 Temporarily disable toplevel email check notification 2018-01-23 12:30:16 +01:00
Johannes Zellner 0ae8d1ed4d Refactor the mail related api wrappers 2018-01-23 12:29:57 +01:00
Girish Ramakrishnan 4388aee70d add dot files 2018-01-22 17:44:51 -08:00
Girish Ramakrishnan 13e4ceff44 Initial commit 2018-01-22 13:01:38 -08:00
483 changed files with 50458 additions and 58571 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
# following files are skipped when exporting using git archive
test export-ignore
.jshintrc export-ignore
.gitlab export-ignore
docs export-ignore
.gitattributes export-ignore
.gitignore export-ignore
+1 -4
View File
@@ -1,9 +1,6 @@
dist/
node_modules/
coverage/
webadmin/dist/
installer/src/certs/server.key
# vim swap files
*.swp
-6
View File
@@ -1,6 +0,0 @@
Please do not use this issue tracker for support requests and bug reports.
This issue tracker is used by the Cloudron development team to track actual
bugs in the code.
Please use the forum at https://forum.cloudron.io to report bugs. For
confidential issues, please email us at support@cloudron.io.
-7
View File
@@ -1,7 +0,0 @@
Please do not use this issue tracker for support requests and feature reports.
This issue tracker is used by the Cloudron development team to track issues in
the code.
Please use the forum at https://forum.cloudron.io to report bugs. For
confidential issues, please email us at support@cloudron.io.
-1
View File
@@ -2,7 +2,6 @@
"node": true,
"browser": true,
"unused": true,
"multistr": true,
"globalstrict": true,
"predef": [ "angular", "$" ],
"esnext": true
-1382
View File
File diff suppressed because it is too large Load Diff
+34 -660
View File
@@ -1,661 +1,35 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
The Cloudron Subscription license
Copyright (c) 2018 Cloudron UG
With regard to the Cloudron Software:
This software and associated documentation files (the "Software") may only be
used in production, if you (and any entity that you represent) have agreed to,
and are in compliance with, the Cloudron Subscription Terms of Service, available
at https://cloudron.io/legal/terms.html (the “Subscription Terms”), or other
agreement governing the use of the Software, as agreed by you and Cloudron,
and otherwise have a valid Cloudron Subscription. Subject to the foregoing sentence,
you are free to modify this Software and publish patches to the Software. You agree
that Subscription and/or its licensors (as applicable) retain all right, title and
interest in and to all such modifications and/or patches, and all such modifications
and/or patches may only be used, copied, modified, displayed, distributed, or otherwise
exploited with a valid Cloudron subscription. Notwithstanding the foregoing, you may copy
and modify the Software for development and testing purposes, without requiring a
subscription. You agree that Cloudron and/or its licensors (as applicable) retain
all right, title and interest in and to all such modifications. You are not
granted any other rights beyond what is expressly stated herein. Subject to the
foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
and/or sell the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
For all third party components incorporated into the Cloudron Software, those
components are licensed under the original license provided by the owner of the
applicable component.
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
box
Copyright (C) 2016,2017,2018 Cloudron UG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
+2 -7
View File
@@ -1,4 +1,4 @@
# Cloudron
# Cloudron Dashboard
[Cloudron](https://cloudron.io) is the best way to run apps on your server.
@@ -29,7 +29,7 @@ anyone to effortlessly host web applications on their server on their own terms.
* Trivially migrate to another server keeping your apps and data (for example, switch your
infrastructure provider or move to a bigger server).
* Comprehensive [REST API](https://cloudron.io/documentation/developer/api/).
* Comprehensive [REST API](https://cloudron.io/developer/api/).
* [CLI](https://cloudron.io/documentation/cli/) to configure apps.
@@ -48,11 +48,6 @@ apps up-to-date and secure.
* [Selfhosting](https://cloudron.io/documentation/installation/) - [Pricing](https://cloudron.io/pricing.html)
* [Managed Hosting](https://cloudron.io/managed.html)
**Note:** This repo is a small part of what gets installed on your server - there is
the dashboard, database addons, graph container, base image etc. Cloudron also relies
on external services such as the App Store for apps to be installed. As such, don't
clone this repo and npm install and expect something to work.
## Documentation
* [Documentation](https://cloudron.io/documentation/)
-193
View File
@@ -1,193 +0,0 @@
#!/bin/bash
set -eu -o pipefail
assertNotEmpty() {
: "${!1:? "$1 is not set."}"
}
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
export JSON="${SOURCE_DIR}/node_modules/.bin/json"
INSTANCE_TYPE="t2.micro"
BLOCK_DEVICE="DeviceName=/dev/sda1,Ebs={VolumeSize=20,DeleteOnTermination=true,VolumeType=gp2}"
SSH_KEY_NAME="id_rsa_yellowtent"
revision=$(git rev-parse HEAD)
ami_name=""
server_id=""
server_ip=""
destroy_server="yes"
deploy_env="prod"
image_id=""
args=$(getopt -o "" -l "revision:,name:,no-destroy,env:,region:" -n "$0" -- "$@")
eval set -- "${args}"
while true; do
case "$1" in
--env) deploy_env="$2"; shift 2;;
--revision) revision="$2"; shift 2;;
--name) ami_name="$2"; shift 2;;
--no-destroy) destroy_server="no"; shift 2;;
--region)
case "$2" in
"us-east-1")
image_id="ami-6edd3078"
security_group="sg-a5e17fd9"
subnet_id="subnet-b8fbc0f1"
;;
"eu-central-1")
image_id="ami-5aee2235"
security_group="sg-19f5a770" # everything open on eu-central-1
subnet_id=""
;;
*)
echo "Unknown aws region $2"
exit 1
;;
esac
export AWS_DEFAULT_REGION="$2" # used by the aws cli tool
shift 2
;;
--) break;;
*) echo "Unknown option $1"; exit 1;;
esac
done
# TODO fix this
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY}"
export AWS_SECRET_ACCESS_KEY="${AWS_ACCESS_SECRET}"
readonly ssh_keys="${HOME}/.ssh/id_rsa_yellowtent"
readonly SSH="ssh -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${ssh_keys}"
if [[ ! -f "${ssh_keys}" ]]; then
echo "caas ssh key is missing at ${ssh_keys} (pick it up from secrets repo)"
exit 1
fi
if [[ -z "${image_id}" ]]; then
echo "--region is required (us-east-1 or eu-central-1)"
exit 1
fi
function get_pretty_revision() {
local git_rev="$1"
local sha1=$(git rev-parse --short "${git_rev}" 2>/dev/null)
echo "${sha1}"
}
function wait_for_ssh() {
echo "=> Waiting for ssh connection"
while true; do
echo -n "."
if $SSH ubuntu@${server_ip} echo "hello"; then
echo ""
break
fi
sleep 5
done
}
now=$(date "+%Y-%m-%d-%H%M%S")
pretty_revision=$(get_pretty_revision "${revision}")
if [[ -z "${ami_name}" ]]; then
ami_name="box-${deploy_env}-${pretty_revision}-${now}"
fi
echo "=> Create EC2 instance"
id=$(aws ec2 run-instances --image-id "${image_id}" --instance-type "${INSTANCE_TYPE}" --security-group-ids "${security_group}" --block-device-mappings "${BLOCK_DEVICE}" --key-name "${SSH_KEY_NAME}" --subnet-id "${subnet_id}" --associate-public-ip-address \
| $JSON Instances \
| $JSON 0.InstanceId)
[[ -z "$id" ]] && exit 1
echo "Instance created ID $id"
echo "=> Waiting for instance to get a public IP"
while true; do
server_ip=$(aws ec2 describe-instances --instance-ids ${id} \
| $JSON Reservations.0.Instances \
| $JSON 0.PublicIpAddress)
if [[ ! -z "${server_ip}" ]]; then
echo ""
break
fi
echo -n "."
sleep 1
done
echo "Got public IP ${server_ip}"
wait_for_ssh
echo "=> Fetching cloudron-setup"
while true; do
if $SSH ubuntu@${server_ip} wget "https://cloudron.io/cloudron-setup" -O "cloudron-setup"; then
echo ""
break
fi
echo -n "."
sleep 5
done
echo "=> Running cloudron-setup"
$SSH ubuntu@${server_ip} sudo /bin/bash "cloudron-setup" --env "${deploy_env}" --provider "ami" --skip-reboot
wait_for_ssh
echo "=> Removing ssh key"
$SSH ubuntu@${server_ip} sudo rm /home/ubuntu/.ssh/authorized_keys /root/.ssh/authorized_keys
echo "=> Creating AMI"
image_id=$(aws ec2 create-image --instance-id "${id}" --name "${ami_name}" | $JSON ImageId)
[[ -z "$id" ]] && exit 1
echo "Creating AMI with Id ${image_id}"
echo "=> Waiting for AMI to be created"
while true; do
state=$(aws ec2 describe-images --image-ids ${image_id} \
| $JSON Images \
| $JSON 0.State)
if [[ "${state}" == "available" ]]; then
echo ""
break
fi
echo -n "."
sleep 5
done
if [[ "${destroy_server}" == "yes" ]]; then
echo "=> Deleting EC2 instance"
while true; do
state=$(aws ec2 terminate-instances --instance-id "${id}" \
| $JSON TerminatingInstances \
| $JSON 0.CurrentState.Name)
if [[ "${state}" == "shutting-down" ]]; then
echo ""
break
fi
echo -n "."
sleep 5
done
fi
echo ""
echo "Done."
echo ""
echo "New AMI is: ${image_id}"
echo ""
-179
View File
@@ -1,179 +0,0 @@
#!/bin/bash
set -eu -o pipefail
assertNotEmpty() {
: "${!1:? "$1 is not set."}"
}
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
export JSON="${SOURCE_DIR}/node_modules/.bin/json"
revision=$(git rev-parse HEAD)
box_name=""
server_id=""
server_ip=""
destroy_server="yes"
deploy_env="dev"
# Only GNU getopt supports long options. OS X comes bundled with the BSD getopt
# brew install gnu-getopt to get the GNU getopt on OS X
[[ $(uname -s) == "Darwin" ]] && GNU_GETOPT="/usr/local/opt/gnu-getopt/bin/getopt" || GNU_GETOPT="getopt"
readonly GNU_GETOPT
args=$(${GNU_GETOPT} -o "" -l "revision:,regions:,size:,name:,no-destroy,env:" -n "$0" -- "$@")
eval set -- "${args}"
while true; do
case "$1" in
--env) deploy_env="$2"; shift 2;;
--revision) revision="$2"; shift 2;;
--name) box_name="$2"; destroy_server="no"; shift 2;;
--no-destroy) destroy_server="no"; shift 2;;
--) break;;
*) echo "Unknown option $1"; exit 1;;
esac
done
echo "Creating digitalocean image"
if [[ "${deploy_env}" == "staging" ]]; then
assertNotEmpty DIGITAL_OCEAN_TOKEN_STAGING
export DIGITAL_OCEAN_TOKEN="${DIGITAL_OCEAN_TOKEN_STAGING}"
elif [[ "${deploy_env}" == "dev" ]]; then
assertNotEmpty DIGITAL_OCEAN_TOKEN_DEV
export DIGITAL_OCEAN_TOKEN="${DIGITAL_OCEAN_TOKEN_DEV}"
elif [[ "${deploy_env}" == "prod" ]]; then
assertNotEmpty DIGITAL_OCEAN_TOKEN_PROD
export DIGITAL_OCEAN_TOKEN="${DIGITAL_OCEAN_TOKEN_PROD}"
else
echo "No such env ${deploy_env}."
exit 1
fi
vps="/bin/bash ${SCRIPT_DIR}/digitalocean.sh"
readonly ssh_keys="${HOME}/.ssh/id_rsa_caas_${deploy_env}"
readonly scp202="scp -P 202 -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${ssh_keys}"
readonly scp22="scp -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${ssh_keys}"
readonly ssh202="ssh -p 202 -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${ssh_keys}"
readonly ssh22="ssh -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${ssh_keys}"
if [[ ! -f "${ssh_keys}" ]]; then
echo "caas ssh key is missing at ${ssh_keys} (pick it up from secrets repo)"
exit 1
fi
function get_pretty_revision() {
local git_rev="$1"
local sha1=$(git rev-parse --short "${git_rev}" 2>/dev/null)
echo "${sha1}"
}
now=$(date "+%Y-%m-%d-%H%M%S")
pretty_revision=$(get_pretty_revision "${revision}")
if [[ -z "${box_name}" ]]; then
# if you change this, change the regexp is appstore/janitor.js
box_name="box-${deploy_env}-${pretty_revision}-${now}" # remove slashes
# create a new server if no name given
if ! caas_ssh_key_id=$($vps get_ssh_key_id "caas"); then
echo "Could not query caas ssh key"
exit 1
fi
echo "Detected caas ssh key id: ${caas_ssh_key_id}"
echo "Creating Server with name [${box_name}]"
if ! server_id=$($vps create ${caas_ssh_key_id} ${box_name}); then
echo "Failed to create server"
exit 1
fi
echo "Created server with id: ${server_id}"
# If we run scripts overenthusiastically without the wait, setup script randomly fails
echo -n "Waiting 120 seconds for server creation"
for i in $(seq 1 24); do
echo -n "."
sleep 5
done
echo ""
else
if ! server_id=$($vps get_id "${box_name}"); then
echo "Could not determine id from name"
exit 1
fi
echo "Reusing server with id: ${server_id}"
$vps power_on "${server_id}"
fi
# Query until we get an IP
while true; do
echo "Trying to get the server IP"
if server_ip=$($vps get_ip "${server_id}"); then
echo "Server IP : [${server_ip}]"
break
fi
echo "Timedout, trying again in 10 seconds"
sleep 10
done
while true; do
echo "Trying to copy init script to server"
if $scp22 "${SCRIPT_DIR}/initializeBaseUbuntuImage.sh" root@${server_ip}:.; then
break
fi
echo "Timedout, trying again in 30 seconds"
sleep 30
done
echo "Copying infra_version.js"
$scp22 "${SCRIPT_DIR}/../src/infra_version.js" root@${server_ip}:.
echo "Copying box source"
cd "${SOURCE_DIR}"
git archive --format=tar HEAD | $ssh22 "root@${server_ip}" "cat - > /tmp/box.tar.gz"
echo "Executing init script"
if ! $ssh22 "root@${server_ip}" "/bin/bash /root/initializeBaseUbuntuImage.sh caas"; then
echo "Init script failed"
exit 1
fi
echo "Shutting down server with id : ${server_id}"
$ssh22 "root@${server_ip}" "shutdown -f now" || true # shutdown sometimes terminates ssh connection immediately making this command fail
# wait 10 secs for actual shutdown
echo "Waiting for 10 seconds for server to shutdown"
sleep 30
echo "Powering off server"
if ! $vps power_off "${server_id}"; then
echo "Could not power off server"
exit 1
fi
snapshot_name="box-${deploy_env}-${pretty_revision}-${now}"
echo "Snapshotting as ${snapshot_name}"
if ! image_id=$($vps snapshot "${server_id}" "${snapshot_name}"); then
echo "Could not snapshot and get image id"
exit 1
fi
if [[ "${destroy_server}" == "yes" ]]; then
echo "Destroying server"
if ! $vps destroy "${server_id}"; then
echo "Could not destroy server"
exit 1
fi
else
echo "Skipping server destroy"
fi
echo "Transferring image ${image_id} to other regions"
$vps transfer_image_to_all_regions "${image_id}"
echo "Done."
-261
View File
@@ -1,261 +0,0 @@
#!/bin/bash
if [[ -z "${DIGITAL_OCEAN_TOKEN}" ]]; then
echo "Script requires DIGITAL_OCEAN_TOKEN env to be set"
exit 1
fi
if [[ -z "${JSON}" ]]; then
echo "Script requires JSON env to be set to path of JSON binary"
exit 1
fi
readonly CURL="curl --retry 5 -s -u ${DIGITAL_OCEAN_TOKEN}:"
function debug() {
echo "$@" >&2
}
function get_ssh_key_id() {
id=$($CURL "https://api.digitalocean.com/v2/account/keys" \
| $JSON ssh_keys \
| $JSON -c "this.name === \"$1\"" \
| $JSON 0.id)
[[ -z "$id" ]] && exit 1
echo "$id"
}
function create_droplet() {
local ssh_key_id="$1"
local box_name="$2"
local image_region="sfo2"
local ubuntu_image_slug="ubuntu-16-04-x64"
local box_size="1gb"
local data="{\"name\":\"${box_name}\",\"size\":\"${box_size}\",\"region\":\"${image_region}\",\"image\":\"${ubuntu_image_slug}\",\"ssh_keys\":[ \"${ssh_key_id}\" ],\"backups\":false}"
id=$($CURL -X POST -H 'Content-Type: application/json' -d "${data}" "https://api.digitalocean.com/v2/droplets" | $JSON droplet.id)
[[ -z "$id" ]] && exit 1
echo "$id"
}
function get_droplet_ip() {
local droplet_id="$1"
ip=$($CURL "https://api.digitalocean.com/v2/droplets/${droplet_id}" | $JSON "droplet.networks.v4[0].ip_address")
[[ -z "$ip" ]] && exit 1
echo "$ip"
}
function get_droplet_id() {
local droplet_name="$1"
id=$($CURL "https://api.digitalocean.com/v2/droplets?per_page=200" | $JSON "droplets" | $JSON -c "this.name === '${droplet_name}'" | $JSON "[0].id")
[[ -z "$id" ]] && exit 1
echo "$id"
}
function power_off_droplet() {
local droplet_id="$1"
local data='{"type":"power_off"}'
local response=$($CURL -X POST -H 'Content-Type: application/json' -d "${data}" "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions")
local event_id=`echo "${response}" | $JSON action.id`
if [[ -z "${event_id}" ]]; then
debug "Got no event id, assuming already powered off."
debug "Response: ${response}"
return
fi
debug "Powered off droplet. Event id: ${event_id}"
debug -n "Waiting for droplet to power off"
while true; do
local event_status=`$CURL "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions/${event_id}" | $JSON action.status`
if [[ "${event_status}" == "completed" ]]; then
break
fi
debug -n "."
sleep 10
done
debug ""
}
function power_on_droplet() {
local droplet_id="$1"
local data='{"type":"power_on"}'
local event_id=`$CURL -X POST -H 'Content-Type: application/json' -d "${data}" "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions" | $JSON action.id`
debug "Powered on droplet. Event id: ${event_id}"
if [[ -z "${event_id}" ]]; then
debug "Got no event id, assuming already powered on"
return
fi
debug -n "Waiting for droplet to power on"
while true; do
local event_status=`$CURL "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions/${event_id}" | $JSON action.status`
if [[ "${event_status}" == "completed" ]]; then
break
fi
debug -n "."
sleep 10
done
debug ""
}
function get_image_id() {
local snapshot_name="$1"
local image_id=""
if ! response=$($CURL "https://api.digitalocean.com/v2/images?per_page=200"); then
echo "Failed to get image listing. ${response}"
return 1
fi
if ! image_id=$(echo "$response" \
| $JSON images \
| $JSON -c "this.name === \"${snapshot_name}\"" 0.id); then
echo "Failed to parse curl response: ${response}"
return 1
fi
if [[ -z "${image_id}" ]]; then
echo "Failed to get image id of ${snapshot_name}. reponse: ${response}"
return 1
fi
echo "${image_id}"
}
function snapshot_droplet() {
local droplet_id="$1"
local snapshot_name="$2"
local data="{\"type\":\"snapshot\",\"name\":\"${snapshot_name}\"}"
local event_id=`$CURL -X POST -H 'Content-Type: application/json' -d "${data}" "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions" | $JSON action.id`
debug "Droplet snapshotted as ${snapshot_name}. Event id: ${event_id}"
debug -n "Waiting for snapshot to complete"
while true; do
if ! response=$($CURL "https://api.digitalocean.com/v2/droplets/${droplet_id}/actions/${event_id}"); then
echo "Could not get action status. ${response}"
continue
fi
if ! event_status=$(echo "${response}" | $JSON action.status); then
echo "Could not parse action.status from response. ${response}"
continue
fi
if [[ "${event_status}" == "completed" ]]; then
break
fi
debug -n "."
sleep 10
done
debug "! done"
if ! image_id=$(get_image_id "${snapshot_name}"); then
return 1
fi
echo "${image_id}"
}
function destroy_droplet() {
local droplet_id="$1"
# TODO: check for 204 status
$CURL -X DELETE "https://api.digitalocean.com/v2/droplets/${droplet_id}"
debug "Droplet destroyed"
debug ""
}
function transfer_image() {
local image_id="$1"
local region_slug="$2"
local data="{\"type\":\"transfer\",\"region\":\"${region_slug}\"}"
local event_id=`$CURL -X POST -H 'Content-Type: application/json' -d "${data}" "https://api.digitalocean.com/v2/images/${image_id}/actions" | $JSON action.id`
echo "${event_id}"
}
function wait_for_image_event() {
local image_id="$1"
local event_id="$2"
debug -n "Waiting for ${event_id}"
while true; do
local event_status=`$CURL "https://api.digitalocean.com/v2/images/${image_id}/actions/${event_id}" | $JSON action.status`
if [[ "${event_status}" == "completed" ]]; then
break
fi
debug -n "."
sleep 10
done
debug ""
}
function transfer_image_to_all_regions() {
local image_id="$1"
xfer_events=()
image_regions=(ams2) ## sfo1 is where the image is created
for image_region in ${image_regions[@]}; do
xfer_event=$(transfer_image ${image_id} ${image_region})
echo "Image transfer to ${image_region} initiated. Event id: ${xfer_event}"
xfer_events+=("${xfer_event}")
sleep 1
done
echo "Image transfer initiated, but they will take some time to get transferred."
for xfer_event in ${xfer_events[@]}; do
$vps wait_for_image_event "${image_id}" "${xfer_event}"
done
}
if [[ $# -lt 1 ]]; then
debug "<command> <params...>"
exit 1
fi
case $1 in
get_ssh_key_id)
get_ssh_key_id "${@:2}"
;;
create)
create_droplet "${@:2}"
;;
get_id)
get_droplet_id "${@:2}"
;;
get_ip)
get_droplet_ip "${@:2}"
;;
power_on)
power_on_droplet "${@:2}"
;;
power_off)
power_off_droplet "${@:2}"
;;
snapshot)
snapshot_droplet "${@:2}"
;;
destroy)
destroy_droplet "${@:2}"
;;
transfer_image_to_all_regions)
transfer_image_to_all_regions "${@:2}"
;;
*)
echo "Unknown command $1"
exit 1
esac
-115
View File
@@ -1,115 +0,0 @@
#!/bin/bash
set -euv -o pipefail
readonly SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly arg_provider="${1:-generic}"
readonly arg_infraversionpath="${SOURCE_DIR}/${2:-}"
function die {
echo $1
exit 1
}
export DEBIAN_FRONTEND=noninteractive
# hold grub since updating it breaks on some VPS providers. also, dist-upgrade will trigger it
apt-mark hold grub* >/dev/null
apt-get -o Dpkg::Options::="--force-confdef" update -y
apt-get -o Dpkg::Options::="--force-confdef" upgrade -y
apt-mark unhold grub* >/dev/null
echo "==> Installing required packages"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password password'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password password'
# this enables automatic security upgrades (https://help.ubuntu.com/community/AutomaticSecurityUpdates)
apt-get -y install \
acl \
awscli \
build-essential \
cron \
curl \
dmsetup \
iptables \
logrotate \
mysql-server-5.7 \
nginx-full \
openssh-server \
pwgen \
rcconf \
swaks \
unattended-upgrades \
unbound \
xfsprogs
# this ensures that unattended upgades are enabled, if it was disabled during ubuntu install time (see #346)
# debconf-set-selection of unattended-upgrades/enable_auto_updates + dpkg-reconfigure does not work
cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
echo "==> Installing node.js"
mkdir -p /usr/local/node-8.9.3
curl -sL https://nodejs.org/dist/v8.9.3/node-v8.9.3-linux-x64.tar.gz | tar zxvf - --strip-components=1 -C /usr/local/node-8.9.3
ln -sf /usr/local/node-8.9.3/bin/node /usr/bin/node
ln -sf /usr/local/node-8.9.3/bin/npm /usr/bin/npm
apt-get install -y python # Install python which is required for npm rebuild
[[ "$(python --version 2>&1)" == "Python 2.7."* ]] || die "Expecting python version to be 2.7.x"
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
echo "==> Installing Docker"
# create systemd drop-in file
mkdir -p /etc/systemd/system/docker.service.d
echo -e "[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// --log-driver=journald --exec-opt native.cgroupdriver=cgroupfs --storage-driver=overlay2" > /etc/systemd/system/docker.service.d/cloudron.conf
curl -sL https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_18.03.1~ce-0~ubuntu_amd64.deb -o /tmp/docker.deb
# apt install with install deps (as opposed to dpkg -i)
apt install -y /tmp/docker.deb
rm /tmp/docker.deb
storage_driver=$(docker info | grep "Storage Driver" | sed 's/.*: //')
if [[ "${storage_driver}" != "overlay2" ]]; then
echo "Docker is using "${storage_driver}" instead of overlay2"
exit 1
fi
# do not upgrade grub because it might prompt user and break this script
echo "==> Enable memory accounting"
apt-get -y --no-upgrade install grub2-common
sed -e 's/^GRUB_CMDLINE_LINUX="\(.*\)"$/GRUB_CMDLINE_LINUX="\1 cgroup_enable=memory swapaccount=1 panic_on_oops=1 panic=5"/' -i /etc/default/grub
update-grub
echo "==> Downloading docker images"
if [ ! -f "${arg_infraversionpath}/infra_version.js" ]; then
echo "No infra_versions.js found"
exit 1
fi
images=$(node -e "var i = require('${arg_infraversionpath}/infra_version.js'); console.log(i.baseImages.join(' '), Object.keys(i.images).map(function (x) { return i.images[x].tag; }).join(' '));")
echo -e "\tPulling docker images: ${images}"
for image in ${images}; do
docker pull "${image}"
done
echo "==> Install collectd"
if ! apt-get install -y collectd collectd-utils; then
# FQDNLookup is true in default debian config. The box code has a custom collectd.conf that fixes this
echo "Failed to install collectd. Presumably because of http://mailman.verplant.org/pipermail/collectd/2015-March/006491.html"
sed -e 's/^FQDNLookup true/FQDNLookup false/' -i /etc/collectd/collectd.conf
fi
# Disable bind for good measure (on online.net, kimsufi servers these are pre-installed and conflicts with unbound)
systemctl stop bind9 || true
systemctl disable bind9 || true
# on ovh images dnsmasq seems to run by default
systemctl stop dnsmasq || true
systemctl disable dnsmasq || true
# on ssdnodes postfix seems to run by default
systemctl stop postfix || true
systemctl disable postfix || true
-63
View File
@@ -1,63 +0,0 @@
#!/usr/bin/env node
'use strict';
require('supererror')({ splatchError: true });
// remove timestamp from debug() based output
require('debug').formatArgs = function formatArgs(args) {
args[0] = this.namespace + ' ' + args[0];
};
var appHealthMonitor = require('./src/apphealthmonitor.js'),
async = require('async'),
config = require('./src/config.js'),
ldap = require('./src/ldap.js'),
dockerProxy = require('./src/dockerproxy.js'),
server = require('./src/server.js');
console.log();
console.log('==========================================');
console.log(' Cloudron will use the following settings ');
console.log('==========================================');
console.log();
console.log(' Environment: ', config.CLOUDRON ? 'CLOUDRON' : 'TEST');
console.log(' Version: ', config.version());
console.log(' Admin Origin: ', config.adminOrigin());
console.log(' Appstore API server origin: ', config.apiServerOrigin());
console.log(' Appstore Web server origin: ', config.webServerOrigin());
console.log(' SysAdmin Port: ', config.get('sysadminPort'));
console.log(' LDAP Server Port: ', config.get('ldapPort'));
console.log(' Docker Proxy Port: ', config.get('dockerProxyPort'));
console.log();
console.log('==========================================');
console.log();
async.series([
server.start,
ldap.start,
dockerProxy.start,
appHealthMonitor.start,
], function (error) {
if (error) {
console.error('Error starting server', error);
process.exit(1);
}
console.log('Cloudron is up and running');
});
var NOOP_CALLBACK = function () { };
process.on('SIGINT', function () {
server.stop(NOOP_CALLBACK);
ldap.stop(NOOP_CALLBACK);
dockerProxy.stop(NOOP_CALLBACK);
setTimeout(process.exit.bind(process), 3000);
});
process.on('SIGTERM', function () {
server.stop(NOOP_CALLBACK);
ldap.stop(NOOP_CALLBACK);
dockerProxy.stop(NOOP_CALLBACK);
setTimeout(process.exit.bind(process), 3000);
});
-23
View File
@@ -1,23 +0,0 @@
#!/usr/bin/env node
'use strict';
var database = require('./src/database.js');
var sendFailureLogs = require('./src/logcollector').sendFailureLogs;
function main() {
if (process.argv.length !== 3) return console.error('Usage: crashnotifier.js <processName>');
var processName = process.argv[2];
console.log('Started crash notifier for', processName);
// mailer needs the db
database.initialize(function (error) {
if (error) return console.error('Cannot connect to database. Unable to send crash log.', error);
sendFailureLogs(processName, { unit: processName });
});
}
main();
+250
View File
@@ -0,0 +1,250 @@
/* jslint node:true */
'use strict';
var argv = require('yargs').argv,
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
cssnano = require('gulp-cssnano'),
ejs = require('gulp-ejs'),
gulp = require('gulp'),
rimraf = require('rimraf'),
sass = require('gulp-sass'),
serve = require('gulp-serve'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify');
gulp.task('3rdparty', function () {
gulp.src([
'src/3rdparty/**/*.js',
'src/3rdparty/**/*.map',
'src/3rdparty/**/*.css',
'src/3rdparty/**/*.otf',
'src/3rdparty/**/*.eot',
'src/3rdparty/**/*.svg',
'src/3rdparty/**/*.gif',
'src/3rdparty/**/*.ttf',
'src/3rdparty/**/*.woff',
'src/3rdparty/**/*.woff2'
])
.pipe(gulp.dest('dist/3rdparty/'));
gulp.src('node_modules/bootstrap-sass/assets/javascripts/bootstrap.min.js')
.pipe(gulp.dest('dist/3rdparty/js'));
});
// --------------
// JavaScript
// --------------
if (argv.help || argv.h) {
console.log('Supported arguments for "gulp develop":');
console.log(' --client-id <clientId>');
console.log(' --client-secret <clientSecret>');
console.log(' --api-origin <cloudron api uri>');
console.log(' --revision <revision>');
process.exit(1);
}
gulp.task('js', ['js-index', 'js-logs', 'js-terminal', 'js-setup', 'js-setupdns', 'js-restore', 'js-update'], function () {});
var oauth = {
clientId: argv.clientId || 'cid-webadmin',
clientSecret: argv.clientSecret || 'unused',
apiOrigin: argv.apiOrigin || '',
};
var revision = argv.revision || '';
console.log();
console.log('Using OAuth credentials:');
console.log(' ClientId: %s', oauth.clientId);
console.log(' ClientSecret: %s', oauth.clientSecret);
console.log(' Cloudron API: %s', oauth.apiOrigin || 'default');
console.log();
console.log('Building for revision: %s', revision);
console.log();
gulp.task('js-index', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src([
'src/js/index.js',
'src/js/client.js',
'src/js/appstore.js',
'src/js/main.js',
'src/views/*.js'
])
.pipe(ejs({ oauth: oauth, revision: revision }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('index.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-logs', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/logs.js', 'src/js/client.js'])
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('logs.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-terminal', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/terminal.js', 'src/js/client.js'])
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('terminal.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-setup', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/setup.js', 'src/js/client.js'])
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('setup.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-setupdns', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/setupdns.js', 'src/js/client.js'])
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('setupdns.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-restore', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/restore.js', 'src/js/client.js'])
.pipe(ejs({ oauth: oauth }, {}, { ext: '.js' }))
.pipe(sourcemaps.init())
.pipe(concat('restore.js', { newLine: ';' }))
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
gulp.task('js-update', function () {
// needs special treatment for error handling
var uglifyer = uglify();
uglifyer.on('error', function (error) {
console.error(error);
});
gulp.src(['src/js/update.js'])
.pipe(sourcemaps.init())
.pipe(uglifyer)
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'));
});
// --------------
// HTML
// --------------
gulp.task('html', ['html-views', 'html-templates'], function () {
return gulp.src('src/*.html').pipe(ejs({ revision: revision }, {}, { ext: '.html' })).pipe(gulp.dest('dist'));
});
gulp.task('html-views', function () {
return gulp.src('src/views/**/*.html').pipe(gulp.dest('dist/views'));
});
gulp.task('html-templates', function () {
return gulp.src('src/templates/**/*.html').pipe(gulp.dest('dist/templates'));
});
// --------------
// CSS
// --------------
gulp.task('css', function () {
return gulp.src('src/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({ includePaths: ['node_modules/bootstrap-sass/assets/stylesheets/'] }).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(cssnano())
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('images', function () {
return gulp.src('src/img/**')
.pipe(gulp.dest('dist/img'));
});
// --------------
// Utilities
// --------------
gulp.task('watch', ['default'], function () {
gulp.watch(['src/*.scss'], ['css']);
gulp.watch(['src/img/*'], ['images']);
gulp.watch(['src/**/*.html'], ['html']);
gulp.watch(['src/views/*.html'], ['html-views']);
gulp.watch(['src/templates/*.html'], ['html-templates']);
gulp.watch(['src/js/update.js'], ['js-update']);
gulp.watch(['src/js/setup.js', 'src/js/client.js'], ['js-setup']);
gulp.watch(['src/js/setupdns.js', 'src/js/client.js'], ['js-setupdns']);
gulp.watch(['src/js/restore.js', 'src/js/client.js'], ['js-restore']);
gulp.watch(['src/js/logs.js', 'src/js/client.js'], ['js-logs']);
gulp.watch(['src/js/terminal.js', 'src/js/client.js'], ['js-terminal']);
gulp.watch(['src/js/index.js', 'src/js/client.js', 'src/js/appstore.js', 'src/js/main.js', 'src/views/*.js'], ['js-index']);
gulp.watch(['src/3rdparty/**/*'], ['3rdparty']);
});
gulp.task('clean', function () {
rimraf.sync('dist');
});
gulp.task('default', ['clean', 'html', 'js', '3rdparty', 'images', 'css'], function () {});
gulp.task('develop', ['watch'], serve({ root: 'dist', port: 4000 }));
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

-14
View File
@@ -1,14 +0,0 @@
'use strict';
var url = require('url');
exports.up = function(db, callback) {
var dbName = url.parse(process.env.DATABASE_URL).path.substr(1); // remove slash
// by default, mysql collates case insensitively. 'utf8_general_cs' is not available
db.runSql('ALTER DATABASE ' + dbName + ' DEFAULT CHARACTER SET=utf8 DEFAULT COLLATE utf8_bin', callback);
};
exports.down = function(db, callback) {
callback();
};
-18
View File
@@ -1,18 +0,0 @@
'use strict';
var fs = require('fs'),
async = require('async'),
path = require('path');
exports.up = function(db, callback) {
var schema = fs.readFileSync(path.join(__dirname, 'initial-schema.sql')).toString('utf8');
var statements = schema.split(';');
async.eachSeries(statements, function (statement, callback) {
if (statement.trim().length === 0) return callback(null);
db.runSql(statement, callback);
}, callback);
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE users, tokens, clients, apps, appPortBindings, authcodes, settings', callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE users ADD COLUMN resetToken VARCHAR(128) DEFAULT ""', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users DROP COLUMN resetToken', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,19 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('DELETE FROM tokens', [], function (error) {
if (error) console.error(error);
db.runSql('ALTER TABLE tokens MODIFY expires BIGINT', [], function (error) {
if (error) console.error(error);
callback(error);
});
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE tokens MODIFY expires VARCHAR(512)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE authcodes ADD COLUMN expiresAt BIGINT NOT NULL', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE authcodes DROP COLUMN expiresAt', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE appPortBindings ADD COLUMN environmentVariable VARCHAR(128) NOT NULL', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE appPortBindings DROP COLUMN environmentVariable', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE appPortBindings DROP COLUMN containerPort', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE appPortBindings ADD COLUMN containerPort VARCHAR(5) NOT NULL', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,19 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('DELETE FROM tokens', [], function (error) {
if (error) console.error(error);
db.runSql('ALTER TABLE tokens CHANGE userId identifier VARCHAR(128) NOT NULL', [], function (error) {
if (error) console.error(error);
callback(error);
});
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE tokens CHANGE identifier userId VARCHAR(128) NOT NULL', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN version', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN version VARCHAR(32)', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN healthy, ADD COLUMN health VARCHAR(128)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN health, ADD COLUMN healthy INTEGER', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN lastBackupId VARCHAR(128)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN lastBackupId', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN createdAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN createdAt', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,10 +0,0 @@
'use strict';
exports.up = function(db, callback) {
// everyday at 1am
db.runSql('INSERT settings (name, value) VALUES("autoupdate_pattern", ?)', [ '00 00 1 * * *' ], callback);
};
exports.down = function(db, callback) {
db.runSql('DELETE * FROM settings WHERE name="autoupdate_pattern"', [ ], callback);
};
@@ -1,14 +0,0 @@
'use strict';
var safe = require('safetydance');
exports.up = function(db, callback) {
var tz = safe.fs.readFileSync('/etc/timezone', 'utf8');
tz = tz ? tz.trim() : 'America/Los_Angeles';
db.runSql('INSERT settings (name, value) VALUES("time_zone", ?)', [ tz ], callback);
};
exports.down = function(db, callback) {
db.runSql('DELETE * FROM settings WHERE name="time_zone"', [ ], callback);
};
@@ -1,24 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
// http://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address
async.series([
db.runSql.bind(db, 'ALTER TABLE users MODIFY username VARCHAR(254)'),
db.runSql.bind(db, 'ALTER TABLE users ADD CONSTRAINT users_username UNIQUE (username)'),
db.runSql.bind(db, 'ALTER TABLE users MODIFY email VARCHAR(254)'),
db.runSql.bind(db, 'ALTER TABLE users ADD CONSTRAINT users_email UNIQUE (email)'),
], callback);
};
exports.down = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE users DROP INDEX users_username'),
db.runSql.bind(db, 'ALTER TABLE users MODIFY username VARCHAR(512)'),
db.runSql.bind(db, 'ALTER TABLE users DROP INDEX users_email'),
db.runSql.bind(db, 'ALTER TABLE users MODIFY email VARCHAR(512)'),
], callback);
};
@@ -1,17 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE users MODIFY username VARCHAR(254) NOT NULL'),
db.runSql.bind(db, 'ALTER TABLE users MODIFY email VARCHAR(254) NOT NULL'),
], callback);
};
exports.down = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE users MODIFY username VARCHAR(254)'),
db.runSql.bind(db, 'ALTER TABLE users MODIFY email VARCHAR(254)'),
], callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN lastManifestJson VARCHAR(2048)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN lastManifestJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE lastManifestJson lastBackupConfigJson VARCHAR(2048)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE lastBackupConfigJson lastManifestJson VARCHAR(2048)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN oldConfigJson VARCHAR(2048)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN oldConfigJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,9 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('DELETE FROM settings', [ ], callback);
};
exports.down = function(db, callback) {
callback();
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN oauthProxy BOOLEAN DEFAULT 0', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN oauthProxy', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,17 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'DELETE FROM clients'),
db.runSql.bind(db, 'ALTER TABLE clients ADD COLUMN type VARCHAR(16) NOT NULL'),
], callback);
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE clients DROP COLUMN type', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE accessRestriction accessRestrictionJson VARCHAR(2048)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE accessRestrictionJson accessRestriction VARCHAR(2048)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps MODIFY manifestJson TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps MODIFY manifestJson VARCHAR(2048)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,19 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE apps MODIFY accessRestrictionJson TEXT'),
db.runSql.bind(db, 'ALTER TABLE apps MODIFY lastBackupConfigJson TEXT'),
db.runSql.bind(db, 'ALTER TABLE apps MODIFY oldConfigJson TEXT')
], callback);
};
exports.down = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE apps MODIFY accessRestrictionJson VARCHAR(2048)'),
db.runSql.bind(db, 'ALTER TABLE apps MODIFY lastBackupConfigJson VARCHAR(2048)'),
db.runSql.bind(db, 'ALTER TABLE apps MODIFY oldConfigJson VARCHAR(2048)')
], callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE users ADD COLUMN displayName VARCHAR(512) DEFAULT ""', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users DROP COLUMN displayName', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN memoryLimit BIGINT DEFAULT 0', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN memoryLimit', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,20 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = "CREATE TABLE groups(" +
"id VARCHAR(128) NOT NULL UNIQUE," +
"name VARCHAR(128) NOT NULL UNIQUE," +
"PRIMARY KEY(id))";
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE groups', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,21 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = "CREATE TABLE IF NOT EXISTS groupMembers(" +
"groupId VARCHAR(128) NOT NULL," +
"userId VARCHAR(128) NOT NULL," +
"FOREIGN KEY(groupId) REFERENCES groups(id)," +
"FOREIGN KEY(userId) REFERENCES users(id));";
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE groupMembers', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,29 +0,0 @@
'use strict';
var async = require('async');
var ADMIN_GROUP_ID = 'admin'; // see constants.js
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'INSERT INTO groups (id, name) VALUES (?, ?)', [ ADMIN_GROUP_ID, 'admin' ]),
function migrateAdminFlag(done) {
db.all('SELECT * FROM users WHERE admin=1', function (error, results) {
if (error) return done(error);
console.dir(results);
async.eachSeries(results, function (r, next) {
db.runSql('INSERT INTO groupMembers (groupId, userId) VALUES (?, ?)', [ ADMIN_GROUP_ID, r.id ], next);
}, done);
});
},
db.runSql.bind(db, 'ALTER TABLE users DROP COLUMN admin'),
db.runSql.bind(db, 'COMMIT')
], callback);
};
exports.down = function(db, callback) {
callback();
};
@@ -1,24 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = "CREATE TABLE backups(" +
"filename VARCHAR(128) NOT NULL," +
"creationTime TIMESTAMP," +
"version VARCHAR(128) NOT NULL," +
"type VARCHAR(16) NOT NULL," +
"dependsOn VARCHAR(4096)," +
"state VARCHAR(16) NOT NULL," +
"PRIMARY KEY (filename))";
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE backups', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE backups ADD COLUMN configJson TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups DROP COLUMN configJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE backups DROP COLUMN configJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups ADD COLUMN configJson TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE backups CHANGE filename id VARCHAR(128)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups CHANGE id filename VARCHAR(128)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE users MODIFY username VARCHAR(254) UNIQUE', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users MODIFY username VARCHAR(254) NOT NULL UNIQUE', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN altDomain VARCHAR(256)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN altDomain', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,23 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = "CREATE TABLE eventlog(" +
"id VARCHAR(128) NOT NULL," +
"source TEXT," +
"creationTime TIMESTAMP," +
"action VARCHAR(128) NOT NULL," +
"data TEXT," +
"PRIMARY KEY (id))";
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE eventlog', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE users ADD COLUMN showTutorial BOOLEAN DEFAULT 0', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users DROP COLUMN showTutorial', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,21 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = 'CREATE TABLE mailboxes(' +
'name VARCHAR(128) NOT NULL,' +
'aliasTarget VARCHAR(128),' +
'creationTime TIMESTAMP,' +
'PRIMARY KEY (name))';
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE mailboxes', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,26 +0,0 @@
'use strict';
var async = require('async');
// imports mailbox entries for existing users
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
function addUserMailboxes(done) {
db.all('SELECT username FROM users', function (error, results) {
if (error) return done(error);
async.eachSeries(results, function (r, next) {
if (!r.username) return next();
db.runSql('INSERT INTO mailboxes (name) VALUES (?)', [ r.username ], next);
}, done);
});
},
db.runSql.bind(db, 'COMMIT')
], callback);
};
exports.down = function(db, callback) {
callback();
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN lastBackupConfigJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN lastBackupConfigJson TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps MODIFY installationProgress TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps MODIFY installationProgress VARCHAR(512)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN xFrameOptions VARCHAR(512)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN xFrameOptions', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.all('SELECT id FROM users', function (error, results) {
if (error) return callback(error);
// existing cloudrons have email enabled by default. future cloudrons will have it disabled by default
var enable = results.length !== 0;
db.runSql('INSERT settings (name, value) VALUES("mail_config", ?)', [ JSON.stringify({ enabled: enable }) ], callback);
});
};
exports.down = function(db, callback) {
db.runSql('DELETE * FROM settings WHERE name="mail_config"', [ ], callback);
};
@@ -1,73 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE mailboxes ADD COLUMN ownerId VARCHAR(128)'),
db.runSql.bind(db, 'ALTER TABLE mailboxes ADD COLUMN ownerType VARCHAR(16)'),
db.runSql.bind(db, 'START TRANSACTION;'),
function addGroupMailboxes(done) {
console.log('Importing group mailboxes');
db.all('SELECT id, name FROM groups', function (error, results) {
if (error) return done(error);
async.eachSeries(results, function (g, next) {
db.runSql('INSERT INTO mailboxes (ownerId, ownerType, name) VALUES (?, ?, ?)', [ g.id, 'group', g.name ], function (error) {
if (error) console.error('Error importing group ' + JSON.stringify(g) + error);
next();
});
}, done);
});
},
function addAppMailboxes(done) {
console.log('Importing app mail boxes');
db.all('SELECT id, location, manifestJson FROM apps', function (error, results) {
if (error) return done(error);
async.eachSeries(results, function (a, next) {
var manifest = JSON.parse(a.manifestJson);
if (!manifest.addons['sendmail'] && !manifest.addons['recvmail']) return next();
var mailboxName = (a.location ? a.location : manifest.title.replace(/[^a-zA-Z0-9]/g, '')) + '.app';
db.runSql('INSERT INTO mailboxes (ownerId, ownerType, name) VALUES (?, ?, ?)', [ a.id, 'app', mailboxName ], function (error) {
if (error) console.error('Error importing app ' + JSON.stringify(a) + error);
next();
});
}, done);
});
},
function setUserMailboxOwnerIds(done) {
console.log('Setting owner id of user mailboxes and aliases');
db.all('SELECT id, username FROM users', function (error, results) {
if (error) return done(error);
async.eachSeries(results, function (u, next) {
if (!u.username) return next();
db.runSql('UPDATE mailboxes SET ownerId = ?, ownerType = ? WHERE name = ? OR aliasTarget = ?', [ u.id, 'user', u.username, u.username ], function (error) {
if (error) console.error('Error setting ownerid ' + JSON.stringify(u) + error);
next();
});
}, done);
});
},
db.runSql.bind(db, 'COMMIT'),
db.runSql.bind(db, 'ALTER TABLE mailboxes MODIFY ownerId VARCHAR(128) NOT NULL'),
db.runSql.bind(db, 'ALTER TABLE mailboxes MODIFY ownerType VARCHAR(128) NOT NULL'),
], callback);
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE mailboxes DROP COLUMN ownerId', function (error) {
if (error) console.error(error);
db.runSql('ALTER TABLE mailboxes DROP COLUMN ownerType', function (error) {
if (error) console.error(error);
callback(error);
});
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN sso BOOLEAN DEFAULT 1', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN sso', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN oauthProxy', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN oauthProxy BOOLEAN DEFAULT 0', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE users DROP COLUMN showTutorial', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users ADD COLUMN showTutorial BOOLEAN DEFAULT 0', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN debugModeJson TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN debugModeJson ', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE backups MODIFY dependsOn TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups MODIFY dependsOn VARCHAR(4096)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,16 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE appAddonConfigs ADD COLUMN name VARCHAR(128)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE appAddonConfigs DROP COLUMN name', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,14 +0,0 @@
'use strict';
var url = require('url');
exports.up = function(db, callback) {
var dbName = url.parse(process.env.DATABASE_URL).path.substr(1); // remove slash
// by default, mysql collates case insensitively. 'utf8_general_cs' is not available
db.runSql('ALTER DATABASE ' + dbName + ' DEFAULT CHARACTER SET=utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci', callback);
};
exports.down = function(db, callback) {
callback();
};
@@ -1,95 +0,0 @@
'use strict';
var async = require('async');
// from apps.js DO NOT UPDATE WHEN apps.js changes, as this is part of db migration!!
function postProcess(result) {
try {
result.manifest = JSON.parse(result.manifestJson);
delete result.manifestJson;
result.oldConfig = JSON.parse(result.oldConfigJson);
delete result.oldConfigJson;
result.portBindings = { };
var hostPorts = result.hostPorts === null ? [ ] : result.hostPorts.split(',');
var environmentVariables = result.environmentVariables === null ? [ ] : result.environmentVariables.split(',');
delete result.hostPorts;
delete result.environmentVariables;
for (var i = 0; i < environmentVariables.length; i++) {
result.portBindings[environmentVariables[i]] = parseInt(hostPorts[i], 10);
}
result.accessRestriction = JSON.parse(result.accessRestrictionJson);
if (result.accessRestriction && !result.accessRestriction.users) result.accessRestriction.users = [];
delete result.accessRestrictionJson;
// TODO remove later once all apps have this attribute
result.xFrameOptions = result.xFrameOptions || 'SAMEORIGIN';
result.sso = !!result.sso; // make it bool
result.debugMode = JSON.parse(result.debugModeJson);
delete result.debugModeJson;
} catch (e) {
console.error('Failed to get restoreConfig for app.', e);
console.error('Falling back to empty values to make the update succeed.');
result.manifest = null;
}
}
// from apps.js DO NOT UPDATE WHEN apps.js changes, as this is part of db migration!!
var APPS_FIELDS_PREFIXED = [ 'apps.id', 'apps.appStoreId', 'apps.installationState', 'apps.installationProgress', 'apps.runState',
'apps.health', 'apps.containerId', 'apps.manifestJson', 'apps.httpPort', 'apps.location', 'apps.dnsRecordId',
'apps.accessRestrictionJson', 'apps.lastBackupId', 'apps.oldConfigJson', 'apps.memoryLimit', 'apps.altDomain',
'apps.xFrameOptions', 'apps.sso', 'apps.debugModeJson' ].join(',');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE backups ADD COLUMN restoreConfigJson TEXT'),
// fill all the backups with restoreConfigs from current apps
function addRestoreConfigs(callback) {
console.log('Importing restoreConfigs');
var appQuery = 'SELECT ' + APPS_FIELDS_PREFIXED + ',' +
'GROUP_CONCAT(CAST(appPortBindings.hostPort AS CHAR(6))) AS hostPorts, GROUP_CONCAT(appPortBindings.environmentVariable) AS environmentVariables' +
' FROM apps LEFT OUTER JOIN appPortBindings ON apps.id = appPortBindings.appId' +
' GROUP BY apps.id ORDER BY apps.id';
db.all(appQuery, function (error, apps) {
if (error) return callback(error);
apps.forEach(postProcess);
async.eachSeries(apps, function (app, next) {
if (app.manifest === null) return next();
db.all('SELECT * FROM backups WHERE type="app" AND id LIKE "%app%\\_' + app.id + '\\_%"', function (error, backups) {
if (error) return next(error);
// from apps.js:getAppConfig()
var restoreConfig = {
manifest: app.manifest,
location: app.location,
accessRestriction: app.accessRestriction,
portBindings: app.portBindings,
memoryLimit: app.memoryLimit,
xFrameOptions: app.xFrameOptions || 'SAMEORIGIN',
altDomain: app.altDomain
};
async.eachSeries(backups, function (backup, next) {
db.runSql('UPDATE backups SET restoreConfigJson=?,creationTime=creationTime WHERE id=?', [ JSON.stringify(restoreConfig), backup.id ], next);
}, next);
});
}, callback);
});
}
], callback);
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups DROP COLUMN restoreConfigJson', callback);
};
@@ -1,22 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.all('SELECT value FROM settings WHERE name="backup_config"', function (error, results) {
if (error || results.length === 0) return callback(error);
var backupConfig = JSON.parse(results[0].value);
if (backupConfig.provider === 'filesystem') {
backupConfig.retentionSecs = 2 * 24 * 60 * 60; // 2 days
} else if (backupConfig.provider === 's3') { // S3
backupConfig.retentionSecs = -1;
} else if (backupConfig.provider === 'caas') {
backupConfig.retentionSecs = 10 * 24 * 60 * 60; // 10 days
}
db.runSql('UPDATE settings SET value=? WHERE name="backup_config"', [ JSON.stringify(backupConfig) ], callback);
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,9 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('INSERT settings (name, value) VALUES("mail_relay", ?)', [ JSON.stringify({ provider: 'cloudron-smtp' }) ], callback);
};
exports.down = function(db, callback) {
db.runSql('DELETE * FROM settings WHERE name="mail_relay"', [ ], callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN robotsTxt TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN robotsTxt', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,29 +0,0 @@
'use strict';
// we used to have JSON as the db type for those two, however mariadb does not support it
// and we never used any JSON related features, but have the TEXT pattern everywhere
// This ensures all old cloudrons will have the columns altered
exports.up = function(db, callback) {
db.runSql('ALTER TABLE eventlog MODIFY data TEXT', [], function (error) {
if (error) console.error(error);
db.runSql('ALTER TABLE eventlog MODIFY source TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE eventlog MODIFY data TEXT', [], function (error) {
if (error) console.error(error);
db.runSql('ALTER TABLE eventlog MODIFY source TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
});
};
@@ -1,16 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN enableBackup BOOLEAN DEFAULT 1', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN enableBackup', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE settings MODIFY value TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE settings MODIFY value VARCHAR(512)', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,25 +0,0 @@
'use strict';
// ensure backupFolder and format are not empty
exports.up = function(db, callback) {
db.all('SELECT * FROM settings WHERE name=?', [ 'backup_config' ], function (error, result) {
if (error || result.length === 0) return callback(error);
var value = JSON.parse(result[0].value);
value.format = 'tgz'; // set the format
if (value.provider === 'filesystem' && !value.backupFolder) {
value.backupFolder = '/var/backups'; // set the backupFolder
}
db.runSql('UPDATE settings SET value = ? WHERE name = ?', [ JSON.stringify(value), 'backup_config' ], function (error) {
if (error) console.error('Error setting ownerid ' + JSON.stringify(u) + error);
callback();
});
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE backups ADD COLUMN format VARCHAR(16) DEFAULT "tgz"', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE backups DROP COLUMN format', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN newConfigJson TEXT', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN newConfigJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,40 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE backups ADD COLUMN manifestJson TEXT'),
db.runSql.bind(db, 'START TRANSACTION;'),
// fill all the backups with restoreConfigs from current apps
function addManifests(callback) {
console.log('Importing manifests');
db.all('SELECT * FROM backups WHERE type="app"', function (error, backups) {
if (error) return callback(error);
async.eachSeries(backups, function (backup, next) {
var m = backup.restoreConfigJson ? JSON.parse(backup.restoreConfigJson) : null;
if (m) m = JSON.stringify(m.manifest);
db.runSql('UPDATE backups SET manifestJson=? WHERE id=?', [ m, backup.id ], next);
}, callback);
});
},
db.runSql.bind(db, 'COMMIT'),
// remove the restoreConfig
db.runSql.bind(db, 'ALTER TABLE backups DROP COLUMN restoreConfigJson')
], callback);
};
exports.down = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE backups DROP COLUMN manifestJson'),
db.runSql.bind(db, 'ALTER TABLE backups ADD COLUMN restoreConfigJson TEXT'),
], callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE newConfigJson updateConfigJson TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE updateConfigJson newConfigJson TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE lastBackupId restoreConfigJson TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE restoreConfigJson lastBackupId TEXT', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,31 +0,0 @@
'use strict';
// WARNING!!
// At this point the default db collation is utf8mb4_unicode_ci however we already have foreign key constraits
// already with tables on utf8_bin charset, so we cannot convert all tables here to utf8mb4 collation without
// a reimport from a sql dump, as foreign keys across different collations are not supported
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'ALTER TABLE appPortBindings CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE apps CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE authcodes CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE backups CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE clients CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE eventlog CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE groupMembers CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE groups CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE mailboxes CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE migrations CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE settings CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE tokens CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin'),
db.runSql.bind(db, 'ALTER TABLE users CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin')
], callback);
};
exports.down = function(db, callback) {
// nothing to be done here
callback();
};
@@ -1,70 +0,0 @@
'use strict';
var async = require('async'),
safe = require('safetydance');
exports.up = function(db, callback) {
// first check precondtion of domain entry in settings
db.all('SELECT * FROM settings WHERE name = ?', [ 'domain' ], function (error, result) {
if (error) return callback(error);
var domain = {};
if (result[0]) domain = safe.JSON.parse(result[0].value) || {};
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
function addAppsDomainColumn(done) {
db.runSql('ALTER TABLE apps ADD COLUMN domain VARCHAR(128)', [], done);
},
function setAppDomain(done) {
if (!domain.fqdn) return done(); // skip for new cloudrons without a domain
db.runSql('UPDATE apps SET domain = ?', [ domain.fqdn ], done);
},
function addAppsLocationDomainUniqueConstraint(done) {
db.runSql('ALTER TABLE apps ADD UNIQUE location_domain_unique_index (location, domain)', [], done);
},
function removePresetupAdminGroupIfNew(done) {
// do not delete on update, will update the record in setMailboxesDomain()
if (domain.fqdn) return done();
// this will be finally created once we have a domain when we create the owner in user.js
const ADMIN_GROUP_ID = 'admin'; // see constants.js
db.runSql('DELETE FROM groups WHERE id = ?', [ ADMIN_GROUP_ID ], function (error) {
if (error) return done(error);
db.runSql('DELETE FROM mailboxes WHERE ownerId = ?', [ ADMIN_GROUP_ID ], done);
});
},
function addMailboxesDomainColumn(done) {
db.runSql('ALTER TABLE mailboxes ADD COLUMN domain VARCHAR(128)', [], done);
},
function setMailboxesDomain(done) {
if (!domain.fqdn) return done(); // skip for new cloudrons without a domain
db.runSql('UPDATE mailboxes SET domain = ?', [ domain.fqdn ], done);
},
function dropAppsLocationUniqueConstraint(done) {
db.runSql('ALTER TABLE apps DROP INDEX location', [], done);
},
db.runSql.bind(db, 'COMMIT')
], callback);
});
};
exports.down = function(db, callback) {
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
function dropMailboxesDomainColumn(done) {
db.runSql('ALTER TABLE mailboxes DROP COLUMN domain', [], done);
},
function dropLocationDomainUniqueConstraint(done) {
db.runSql('ALTER TABLE apps DROP INDEX location_domain_unique_index', [], done);
},
function dropAppsDomainColumn(done) {
db.runSql('ALTER TABLE apps DROP COLUMN domain', [], done);
},
function addAppsLocationUniqueConstraint(done) {
db.runSql('ALTER TABLE apps ADD UNIQUE location (location)', [], done);
},
db.runSql.bind(db, 'COMMIT')
], callback);
};
@@ -1,61 +0,0 @@
'use strict';
var async = require('async'),
safe = require('safetydance'),
tld = require('tldjs');
exports.up = function(db, callback) {
var fqdn, zoneName, configJson;
async.series([
function gatherDomain(done) {
db.all('SELECT * FROM settings WHERE name = ?', [ 'domain' ], function (error, result) {
if (error) return done(error);
var domain = {};
if (result[0]) domain = safe.JSON.parse(result[0].value) || {};
fqdn = domain.fqdn || ''; // will be null pre-setup
zoneName = domain.zoneName || tld.getDomain(fqdn) || fqdn;
done();
});
},
function gatherDNSConfig(done) {
db.all('SELECT * FROM settings WHERE name = ?', [ 'dns_config' ], function (error, result) {
if (error) return done(error);
configJson = (result[0] && result[0].value) ? result[0].value : JSON.stringify({ provider: 'manual'});
// caas dns config needs an fqdn
var config = JSON.parse(configJson);
if (config.provider === 'caas') config.fqdn = fqdn;
configJson = JSON.stringify(config);
done();
});
},
db.runSql.bind(db, 'START TRANSACTION;'),
function createDomainsTable(done) {
var cmd = `
CREATE TABLE domains(
domain VARCHAR(128) NOT NULL UNIQUE,
zoneName VARCHAR(128) NOT NULL,
configJson TEXT,
PRIMARY KEY (domain)) CHARACTER SET utf8 COLLATE utf8_bin
`;
db.runSql(cmd, [], done);
},
function addInitialDomain(done) {
if (!fqdn) return done();
db.runSql('INSERT INTO domains (domain, zoneName, configJson) VALUES (?, ?, ?)', [ fqdn, zoneName, configJson ], done);
},
db.runSql.bind(db, 'COMMIT')
], callback);
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE domains', callback);
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD CONSTRAINT apps_domain_constraint FOREIGN KEY(domain) REFERENCES domains(domain)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP FOREIGN KEY apps_domain_constraint', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE mailboxes ADD CONSTRAINT mailboxes_domain_constraint FOREIGN KEY(domain) REFERENCES domains(domain)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE mailboxes DROP FOREIGN KEY mailboxes_domain_constraint', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE mailboxes DROP PRIMARY KEY', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE mailboxes ADD PRIMARY KEY(name)', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE mailboxes ADD UNIQUE mailboxes_name_domain_unique_index (name, domain)', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE mailboxes DROP INDEX mailboxes_name_domain_unique_index', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN updateTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP', function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps DROP COLUMN updateTime', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,15 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE createdAt creationTime TIMESTAMP(2) NOT NULL', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps CHANGE creationTime createdAt TIMESTAMP(2) NOT NULL', [], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,28 +0,0 @@
'use strict';
var async = require('async');
// NOTE: This migration is incorrect because 'caas' domain is not guaranteed to be present in all Caas cloudrons
exports.up = function(db, callback) {
db.all('SELECT * FROM domains', function (error, domains) {
if (error) return callback(error);
var caasDomains = domains.filter(function (d) { return JSON.parse(d.configJson).provider === 'caas'; });
if (caasDomains.length === 0) return callback();
var caasDomain = caasDomains[0].domain;
db.all('SELECT * FROM settings WHERE name=?', [ 'backup_config' ], function (error, settings) {
if (error) return callback(error);
var setting = settings[0];
var config = JSON.parse(setting.value);
config.fqdn = caasDomain;
db.runSql('UPDATE settings SET value=? WHERE name=?', [ JSON.stringify(config), setting.name ], callback);
});
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,23 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var backupConfig = {
"provider": "filesystem",
"backupFolder": "/var/backups",
"format": "tgz",
"retentionSecs": 172800
};
db.runSql('INSERT settings (name, value) VALUES(?, ?)', [ 'backup_config', JSON.stringify(backupConfig) ], function (error) {
if (!error || error.code === 'ER_DUP_ENTRY') return callback(); // dup entry is OK for existing cloudrons
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DELETE FROM settings WHERE name=?', ['backup_config'], function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,33 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
// first check precondtion of domain entry in settings
db.all('SELECT * FROM domains', [ ], function (error, domains) {
if (error) return callback(error);
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'ALTER TABLE domains ADD COLUMN provider VARCHAR(16) DEFAULT ""'),
function setProvider(done) {
async.eachSeries(domains, function (domain, iteratorCallback) {
var config = JSON.parse(domain.configJson);
var provider = config.provider;
delete config.provider;
db.runSql('UPDATE domains SET provider = ?, configJson = ? WHERE domain = ?', [ provider, JSON.stringify(config), domain.domain ], iteratorCallback);
}, done);
},
db.runSql.bind(db, 'ALTER TABLE domains MODIFY provider VARCHAR(16) NOT NULL'),
db.runSql.bind(db, 'COMMIT')
], callback);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE domains DROP COLUMN provider', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,24 +0,0 @@
'use strict';
exports.up = function(db, callback) {
var cmd = 'CREATE TABLE IF NOT EXISTS mail(' +
'domain VARCHAR(128) NOT NULL UNIQUE,' +
'enabled BOOLEAN DEFAULT 0,' +
'mailFromValidation BOOLEAN DEFAULT 1,' +
'catchAllJson TEXT,' +
'relayJson TEXT,' +
'FOREIGN KEY(domain) REFERENCES domains(domain),' +
'PRIMARY KEY(domain)) CHARACTER SET utf8 COLLATE utf8_bin';
db.runSql(cmd, function (error) {
if (error) console.error(error);
callback(error);
});
};
exports.down = function(db, callback) {
db.runSql('DROP TABLE mail', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,34 +0,0 @@
'use strict';
exports.up = function(db, callback) {
db.all('SELECT * FROM domains', function (error, domains) {
if (error) return callback(error);
if (domains.length === 0) return callback();
db.all('SELECT * FROM settings', function (error, allSettings) {
if (error) return callback(error);
// defaults
var mailFromValidation = true;
var catchAll = [ ];
var relay = { provider: 'cloudron-smtp' };
var mailEnabled = false;
allSettings.forEach(function (setting) {
switch (setting.name) {
case 'mail_from_validation': mailFromValidation = !!setting.value; break;
case 'catch_all_address': catchAll = JSON.parse(setting.value); break;
case 'mail_relay': relay = JSON.parse(setting.value); break;
case 'mail_config': mailEnabled = JSON.parse(setting.value).enabled; break;
}
});
db.runSql('INSERT INTO mail (domain, enabled, mailFromValidation, catchAllJson, relayJson) VALUES (?, ?, ?, ?, ?)',
[ domains[0].domain, mailEnabled, mailFromValidation, JSON.stringify(catchAll), JSON.stringify(relay) ], callback);
});
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,44 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
db.all('SELECT * FROM users', [ ], function (error, users) {
if (error) return callback(error);
db.all('SELECT * FROM mail WHERE enabled=1', [ ], function (error, mailDomains) {
if (error) return callback(error);
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'ALTER TABLE users DROP INDEX users_email'),
db.runSql.bind(db, 'ALTER TABLE users ADD COLUMN fallbackEmail VARCHAR(512) DEFAULT ""'),
function setDefaults(done) {
async.eachSeries(users, function (user, iteratorCallback) {
var defaultEmail = '';
var fallbackEmail = '';
if (mailDomains.length === 0) {
defaultEmail = user.email;
fallbackEmail = user.email;
} else {
defaultEmail = user.username ? (user.username + '@' + mailDomains[0].domain) : user.email;
fallbackEmail = user.email;
}
db.runSql('UPDATE users SET email = ?, fallbackEmail = ? WHERE id = ?', [ defaultEmail, fallbackEmail, user.id ], iteratorCallback);
}, done);
},
db.runSql.bind(db, 'ALTER TABLE users ADD UNIQUE users_email (email)'),
db.runSql.bind(db, 'COMMIT')
], callback);
});
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE users DROP COLUMN fallbackEmail', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,26 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
db.all('SELECT * FROM settings WHERE name = ?', [ 'tls_config' ], function (error, result) {
if (error) return callback(error);
var tlsConfig = (result[0] && result[0].value) ? JSON.parse(result[0].value) : { provider: 'letsencrypt-prod'};
tlsConfig.provider = tlsConfig.provider.replace(/$le\-/, 'letsencrypt-'); // old cloudrons had le-prod/le-staging
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'ALTER TABLE domains ADD COLUMN tlsConfigJson TEXT'),
db.runSql.bind(db, 'UPDATE domains SET tlsConfigJson = ?', [ JSON.stringify(tlsConfig) ]),
db.runSql.bind(db, 'COMMIT')
], callback);
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE domains DROP COLUMN tlsConfigJson', function (error) {
if (error) console.error(error);
callback(error);
});
};
@@ -1,47 +0,0 @@
'use strict';
var async = require('async'),
fs = require('fs'),
superagent = require('superagent');
exports.up = function(db, callback) {
if (!fs.existsSync('/home/yellowtent/configs/cloudron.conf')) {
console.log('Unable to locate cloudron.conf');
return callback();
}
var config = JSON.parse(fs.readFileSync('/home/yellowtent/configs/cloudron.conf', 'utf8'));
if (config.provider !== 'caas' || !config.fqdn) {
console.log('Not caas (%s) or no fqdn', config.provider, config.fqdn);
return callback();
}
db.runSql('SELECT COUNT(*) AS total FROM users', function (error, result) {
if (error) return callback(error);
if (result[0].total === 0) {
console.log('This cloudron is not activated. It will automatically get appstore and caas configs from autoprovision logic');
return callback();
}
console.log('Downloading appstore and caas config');
superagent.get(config.apiServerOrigin + `/api/v1/boxes/${config.fqdn}/config`)
.query({ token: config.token })
.timeout(30 * 1000).end(function (error, result) {
if (error) return callback(error);
console.log('Adding %j config', result.body);
async.series([
db.runSql.bind(db, 'INSERT settings (name, value) VALUES(?, ?)', [ 'appstore_config', JSON.stringify(result.body.appstoreConfig) ]),
db.runSql.bind(db, 'INSERT settings (name, value) VALUES(?, ?)', [ 'caas_config', JSON.stringify(result.body.caasConfig) ])
], callback);
});
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,24 +0,0 @@
'use strict';
var async = require('async');
exports.up = function(db, callback) {
db.runSql('SELECT * FROM settings WHERE name=?', ['autoupdate_pattern'], function (error, results) {
if (error || results.length === 0) return callback(error); // will use defaults from box code
// migrate the 'daily' update pattern
var appUpdatePattern = results[0].value;
if (appUpdatePattern === '00 00 1,3,5,23 * * *') appUpdatePattern = '00 30 1,3,5,23 * * *';
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'DELETE FROM settings WHERE name=?', ['autoupdate_pattern']),
db.runSql.bind(db, 'INSERT settings (name, value) VALUES(?, ?)', ['app_autoupdate_pattern', appUpdatePattern]),
db.runSql.bind(db, 'COMMIT')
], callback);
});
};
exports.down = function(db, callback) {
callback();
};
@@ -1,121 +0,0 @@
'use strict';
var async = require('async'),
crypto = require('crypto'),
fs = require('fs'),
os = require('os'),
path = require('path'),
safe = require('safetydance'),
tldjs = require('tldjs');
exports.up = function(db, callback) {
db.all('SELECT * FROM apps', function (error, apps) {
if (error) return callback(error);
async.eachSeries(apps, function (app, callback) {
if (!app.altDomain) {
console.log('App %s does not use altDomain, skip', app.id);
return callback();
}
const domain = tldjs.getDomain(app.altDomain);
const subdomain = tldjs.getSubdomain(app.altDomain);
const mailboxName = (subdomain ? subdomain : JSON.parse(app.manifestJson).title.toLowerCase().replace(/[^a-zA-Z0-9]/g, '')) + '.app';
console.log('App %s is on domain %s and subdomain %s with mailbox', app.id, domain, subdomain, mailboxName);
async.series([
// Add domain if not exists
function (callback) {
const query = 'INSERT INTO domains (domain, zoneName, provider, configJson, tlsConfigJson) VALUES (?, ?, ?, ?, ?)';
const args = [ domain, domain, 'manual', JSON.stringify({}), JSON.stringify({ provider: 'letsencrypt-prod' }) ];
db.runSql(query, args, function (error) {
if (error && error.code !== 'ER_DUP_ENTRY') return callback(error);
console.log('Added domain %s', domain);
// ensure we have a fallback cert for the newly added domain. This is the same as in reverseproxy.js
// WARNING this will only work on the cloudron itself not during local testing!
const certFilePath = `/home/yellowtent/boxdata/certs/${domain}.host.cert`;
const keyFilePath = `/home/yellowtent/boxdata/certs/${domain}.host.key`;
if (!fs.existsSync(certFilePath) || !fs.existsSync(keyFilePath)) { // generate it
let opensslConf = safe.fs.readFileSync('/etc/ssl/openssl.cnf', 'utf8');
let opensslConfWithSan = `${opensslConf}\n[SAN]\nsubjectAltName=DNS:${domain}\n`;
let configFile = path.join(os.tmpdir(), 'openssl-' + crypto.randomBytes(4).readUInt32LE(0) + '.conf');
let certCommand = `openssl req -x509 -newkey rsa:2048 -keyout ${keyFilePath} -out ${certFilePath} -days 3650 -subj /CN=*.${domain} -extensions SAN -config ${configFile} -nodes`;
safe.fs.writeFileSync(configFile, opensslConfWithSan, 'utf8');
if (!safe.child_process.execSync(certCommand)) return callback(safe.error.message);
safe.fs.unlinkSync(configFile);
}
callback();
});
},
// Add domain to mail table if not exists
function (callback) {
const query = 'INSERT INTO mail (domain, enabled, mailFromValidation, catchAllJson, relayJson) VALUES (?, ?, ?, ?, ?)';
const args = [ domain, 0, 1, '[]', JSON.stringify({ provider: 'cloudron-smtp' }) ];
db.runSql(query, args, function (error) {
if (error && error.code !== 'ER_DUP_ENTRY') return callback(error);
console.log('Added domain %s to mail table', domain);
callback();
});
},
// Remove old mailbox record if any
function (callback) {
const query = 'DELETE FROM mailboxes WHERE ownerId=?';
const args = [ app.id ];
db.runSql(query, args, function (error) {
if (error) return callback(error);
console.log('Cleaned up mailbox record for app %s', app.id);
callback();
});
},
// Add new mailbox record
function (callback) {
const query = 'INSERT INTO mailboxes (name, domain, ownerId, ownerType) VALUES (?, ?, ?, ?)';
const args = [ mailboxName, domain, app.id, 'app' /* mailboxdb.TYPE_APP */ ];
db.runSql(query, args, function (error) {
if (error) return callback(error);
console.log('Added mailbox record for app %s', app.id);
callback();
});
},
// Update app record
function (callback) {
const query = 'UPDATE apps SET location=?, domain=?, altDomain=? WHERE id=?';
const args = [ subdomain, domain, '', app.id ];
db.runSql(query, args, function (error) {
if (error) return error;
console.log('Updated app %s with new domain', app.id);
callback();
});
}
], callback);
}, function (error) {
if (error) return callback(error);
// finally drop the altDomain db field
db.runSql('ALTER TABLE apps DROP COLUMN altDomain', [], callback);
});
});
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE apps ADD COLUMN altDomain VARCHAR(256)', [], callback);
};

Some files were not shown because too many files have changed in this diff Show More