From 5605eca23fc3c41f8fa37943e5bcf1cdd11e9797 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Fri, 3 Jan 2020 14:41:04 -0500 Subject: [PATCH] activation fixes --- .../bubble/server/BubbleConfiguration.java | 28 +++++--- .../service/boot/ActivationService.java | 1 + .../service/boot/StandardSelfNodeService.java | 2 +- .../post_auth/ResourceMessages.properties | 1 - .../pre_auth/ResourceMessages.properties | 65 ++++++++++++++++++- .../bubble/test/dev/BlankDevServerTest.java | 4 +- bubble-web | 2 +- utils/cobbzilla-wizard | 2 +- 8 files changed, 88 insertions(+), 17 deletions(-) diff --git a/bubble-server/src/main/java/bubble/server/BubbleConfiguration.java b/bubble-server/src/main/java/bubble/server/BubbleConfiguration.java index 41329647..b97acb4b 100644 --- a/bubble-server/src/main/java/bubble/server/BubbleConfiguration.java +++ b/bubble-server/src/main/java/bubble/server/BubbleConfiguration.java @@ -40,6 +40,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import java.beans.Transient; import java.io.File; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import static bubble.ApiConstants.*; @@ -221,15 +222,24 @@ public class BubbleConfiguration extends PgRestServerConfiguration @Getter(lazy=true) private final List cloudDriverClasses = ClasspathScanner.scan(CloudServiceDriver.class, CloudServiceDriver.CLOUD_DRIVER_PACKAGE).stream() - .map(c -> c.getClass().getName()) - .collect(Collectors.toList()); - - @Getter(lazy=true) private final Map publicSystemConfigs = MapBuilder.build(new Object[][] { - { TAG_ALLOW_REGISTRATION, getThisNetwork().getBooleanTag(TAG_ALLOW_REGISTRATION, false) }, - { TAG_SAGE_LAUNCHER, isSageLauncher() }, - { TAG_PAYMENTS_ENABLED, paymentsEnabled() }, - { TAG_CLOUD_DRIVERS, getCloudDriverClasses() } - }); + .map(Class::getName) + .collect(Collectors.toList()); + + private final AtomicReference> publicSystemConfigs = new AtomicReference<>(); + public Map getPublicSystemConfigs () { + synchronized (publicSystemConfigs) { + if (publicSystemConfigs.get() == null) { + publicSystemConfigs.set(MapBuilder.build(new Object[][]{ + {TAG_ALLOW_REGISTRATION, getThisNetwork() == null ? null : getThisNetwork().getBooleanTag(TAG_ALLOW_REGISTRATION, false)}, + {TAG_SAGE_LAUNCHER, isSageLauncher()}, + {TAG_PAYMENTS_ENABLED, paymentsEnabled()}, + {TAG_CLOUD_DRIVERS, getCloudDriverClasses()} + })); + } + return publicSystemConfigs.get(); + } + } + public void refreshPublicSystemConfigs () { synchronized (publicSystemConfigs) { publicSystemConfigs.set(null); } } @Getter @Setter private String[] disallowedCountries; diff --git a/bubble-server/src/main/java/bubble/service/boot/ActivationService.java b/bubble-server/src/main/java/bubble/service/boot/ActivationService.java index f15e8a98..9881125b 100644 --- a/bubble-server/src/main/java/bubble/service/boot/ActivationService.java +++ b/bubble-server/src/main/java/bubble/service/boot/ActivationService.java @@ -144,6 +144,7 @@ public class ActivationService { domainDAO.update(domain.setRoles(domainRoles)); selfNodeService.initThisNode(node); + configuration.refreshPublicSystemConfigs(); return node; } diff --git a/bubble-server/src/main/java/bubble/service/boot/StandardSelfNodeService.java b/bubble-server/src/main/java/bubble/service/boot/StandardSelfNodeService.java index 94253832..36404443 100644 --- a/bubble-server/src/main/java/bubble/service/boot/StandardSelfNodeService.java +++ b/bubble-server/src/main/java/bubble/service/boot/StandardSelfNodeService.java @@ -171,7 +171,7 @@ public class StandardSelfNodeService implements SelfNodeService { } private final AutoRefreshingReference thisNet = new AutoRefreshingReference<>() { - @Override public BubbleNetwork refresh() { return networkDAO.findByUuid(getThisNode().getNetwork()); } + @Override public BubbleNetwork refresh() { return getThisNode() == null ? null : networkDAO.findByUuid(getThisNode().getNetwork()); } @Override public long getTimeout() { return DAYS.toMillis(1); } }; @Override public BubbleNetwork getThisNetwork () { return thisNet.get(); } diff --git a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties index d026b474..86802986 100644 --- a/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties +++ b/bubble-server/src/main/resources/message_templates/en_US/server/post_auth/ResourceMessages.properties @@ -26,7 +26,6 @@ label_menu_logout_icon=fa fa-sign-out-alt # Profile fields field_label_url=URL -field_label_description=Description field_label_administrator=Administrator field_label_suspended=Suspended field_label_auto_update_policy=Auto-Update Policy diff --git a/bubble-server/src/main/resources/message_templates/en_US/server/pre_auth/ResourceMessages.properties b/bubble-server/src/main/resources/message_templates/en_US/server/pre_auth/ResourceMessages.properties index 0210ee46..efcae96a 100644 --- a/bubble-server/src/main/resources/message_templates/en_US/server/pre_auth/ResourceMessages.properties +++ b/bubble-server/src/main/resources/message_templates/en_US/server/pre_auth/ResourceMessages.properties @@ -34,6 +34,19 @@ err.country.invalid=Country is invalid err.parent.notFound=Parent account does not exist err.accountInit.timeout=Timeout initializing new account +# Activation form +form_title_activation=Activate Bubble +field_label_description=Description +field_label_network_name=Network Name +field_label_dns_service=DNS Service +field_label_storage_service=Storage Service +form_section_title_dns=DNS +form_section_title_storage=Storage +form_section_title_domain=Domain +form_section_title_credentials=Credentials +form_section_title_config=Configuration +button_label_activate=Activate + # Login/Registration form form_title_login=Login field_label_username=Username @@ -71,33 +84,63 @@ err.driverConfig.initFailure=Cloud driver failed to initialize properlyu err.ec.param.invalid=Parameter is invalid err.ec.fieldType.none_set=Field type was not set -# Driver names +# Cloud drivers driver_bubble.cloud.authenticator.TOTPAuthenticatorDriver=TOTP Service description_bubble.cloud.authenticator.TOTPAuthenticatorDriver=A TOTP authentication service that is compatible with common authenticators, like Google Authenticator. This service runs locally and does not use any cloud APIs. driver_bubble.cloud.compute.vultr.VultrDriver=Vultr Compute Cloud description_bubble.cloud.compute.vultr.VultrDriver=Use Vultr to launch new Bubbles +driver_credential_API-Key.bubble.cloud.compute.vultr.VultrDriver=Vultr API Key +driver_config_regions_bubble.cloud.compute.vultr.VultrDriver=Regions JSON +driver_config_description_regions_bubble.cloud.compute.vultr.VultrDriver=Array of bubble.cloud.CloudRegion objects. Determines which regions are supported, and defines latitude/longitude to enable geo-aware decisions. +driver_config_sizes_bubble.cloud.compute.vultr.VultrDriver=Instance Sizes JSON +driver_config_sizes_description_regions_bubble.cloud.compute.vultr.VultrDriver=Array of bubble.cloud.compute.ComputeNodeSize objects. Determines which instance sizes are supported. +driver_config_config_bubble.cloud.compute.vultr.VultrDriver=Additional Config JSON +driver_config_config_description_regions_bubble.cloud.compute.vultr.VultrDriver=Array of configuration options in the form [ {name: "...", "value": ...} ] There must be one option named 'os' that contains the Operating System image to use when launching Bubbles. driver_bubble.cloud.compute.digitalocean.DigitalOceanDriver=DigitalOcean Compute Cloud description_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Use DigitalOcean to launch new Bubbles +driver_credential_apiKey.bubble.cloud.compute.digitalocean.DigitalOceanDriver=DigitalOcean API Key +driver_config_regions_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Regions JSON +driver_config__description_regions_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Array of bubble.cloud.CloudRegion objects. Determines which regions are supported, and defines latitude/longitude to enable geo-aware decisions. +driver_config_sizes_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Instance Sizes JSON +driver_config_sizes_description_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Array of bubble.cloud.compute.ComputeNodeSize objects. Determines which instance sizes are supported. +driver_config_config_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Additional Config JSON +driver_config_config_description_regions_bubble.cloud.compute.digitalocean.DigitalOceanDriver=Array of configuration options in the form [ {name: "...", "value": ...} ] There must be one option named 'os' that contains the Operating System image to use when launching Bubbles. driver_bubble.cloud.dns.godaddy.GoDaddyDnsDriver=GoDaddy DNS description_bubble.cloud.dns.godaddy.GoDaddyDnsDriver=Use GoDaddy to manage DNS records for Bubbles +driver_credential_GODADDY_API_KEY_bubble.cloud.dns.godaddy.GoDaddyDnsDriver=GoDaddy API Key +driver_credential_GODADDY_API_SECRET_bubble.cloud.dns.godaddy.GoDaddyDnsDriver=GoDaddy Secret Key driver_bubble.cloud.dns.route53.Route53DnsDriver=Amazon Route53 DNS description_bubble.cloud.dns.route53.Route53DnsDriver=Use Amazon Route53 to manage DNS records for Bubbles +driver_credential_AWS_ACCESS_KEY_ID_bubble.cloud.dns.route53.Route53DnsDriver=AWS Access Key +driver_credential_AWS_SECRET_KEY_bubble.cloud.dns.route53.Route53DnsDriver=AWS Secret Key driver_bubble.cloud.email.SmtpEmailDriver=SMTP Email -description_bubble.cloud.email.SmtpEmailDriver=Connect to any standard SMTP service to deliver email. +description_bubble.cloud.email.SmtpEmailDriver=Connect to any standard SMTP service to deliver email +driver_credential_user_bubble.cloud.email.SmtpEmailDriver=SMTP User +driver_credential_password_bubble.cloud.email.SmtpEmailDriver=SMTP Password +driver_credential_host_bubble.cloud.email.SmtpEmailDriver=SMTP Hostname +driver_credential_port_bubble.cloud.email.SmtpEmailDriver=SMTP Port +driver_config_tlsEnabled_bubble.cloud.email.SmtpEmailDriver=Enable TLS driver_bubble.cloud.geoCode.google.GoogleGeoCodeDriver=Google Geocoding API description_bubble.cloud.geoCode.google.GoogleGeoCodeDriver=Use the Google Geocoding API to convert place names to latitude/longitude. +driver_credential_apiKey_bubble.cloud.geoCode.google.GoogleGeoCodeDriver=Google API Key driver_bubble.cloud.geoLocation.maxmind.MaxMindDriver=MaxMind GeoIP Database description_bubble.cloud.geoLocation.maxmind.MaxMindDriver=Use the MaxMind GeoIP database to resolve IP addresses to city/region/country. This services runs locally using a database file and does not use any cloud APIs, except to download the database file. +driver_credential_apiKey_bubble.cloud.geoLocation.maxmind.MaxMindDriver=MaxMind API Key +driver_config_url_bubble.cloud.geoLocation.maxmind.MaxMindDriver=MaxMind Database File URL +driver_config_description_url_bubble.cloud.geoLocation.maxmind.MaxMindDriver=URL to download the database file from. You can use [[apiKey]] in the URL, and it will be replaced with your MaxMind API Key when the download is made. +driver_config_file_bubble.cloud.geoLocation.maxmind.MaxMindDriver=MaxMind Database File Regex +driver_config_description_file_bubble.cloud.geoLocation.maxmind.MaxMindDriver=A regular expression used to find the MaxMind database file within the downloaded ZIP file or tarball. driver_bubble.cloud.geoTime.google.GoogleGeoTimeDriver=Google Time Zone API description_bubble.cloud.geoTime.google.GoogleGeoTimeDriver=Use the Google Time Zone API to resolve IP addresses to time zones. +driver_credential_apiKey_bubble.cloud.geoTime.google.GoogleGeoTimeDriver=Google API Key driver_bubble.cloud.payment.free.FreePaymentDriver=Free description_bubble.cloud.payment.free.FreePaymentDriver=Allows users to add Account Plans without actually paying for anything. @@ -107,12 +150,30 @@ description_bubble.cloud.payment.code.CodePaymentDriver=Supports invitation code driver_bubble.cloud.payment.stripe.StripePaymentDriver=Stripe Payments description_bubble.cloud.payment.stripe.StripePaymentDriver=Allows payment for Account Plans using credit and debit cards via the Stripe payments service. +driver_credential_secretApiKey_bubble.cloud.payment.stripe.StripePaymentDriver=Stripe Secret API Key +driver_config_publicApiKey_bubble.cloud.payment.stripe.StripePaymentDriver=Stripe Public API Key +driver_config_description_publicApiKey_bubble.cloud.payment.stripe.StripePaymentDriver=Your Stripe Public API Key driver_bubble.cloud.sms.twilio.TwilioSmsDriver=Twilio SMS description_bubble.cloud.sms.twilio.TwilioSmsDriver=Deliver SMS messages via Twilio. +driver_credential_accountSID_bubble.cloud.sms.twilio.TwilioSmsDriver=Twilio Account SID +driver_credential_authToken_bubble.cloud.sms.twilio.TwilioSmsDriver=Twilio Auth Token +driver_credential_fromPhoneNumber_bubble.cloud.sms.twilio.TwilioSmsDriver=From Phone Number driver_bubble.cloud.storage.s3.S3StorageDriver=Amazon S3 Storage description_bubble.cloud.storage.s3.S3StorageDriver=Supports storage for Amazon S3. Data is encrypted locally, S3 never sees unencrypted data. +driver_credential_AWS_ACCESS_KEY_ID_bubble.cloud.storage.s3.S3StorageDriver=AWS Access Key +driver_credential_AWS_SECRET_KEY_bubble.cloud.storage.s3.S3StorageDriver=AWS Secret Key +driver_config_region_bubble.cloud.storage.s3.S3StorageDriver=AWS Region +driver_config_description_region_bubble.cloud.storage.s3.S3StorageDriver=The AWS Region to use. Must be a valid name in the AWS Regions enum class. +driver_config_bucket_bubble.cloud.storage.s3.S3StorageDriver=S3 Bucket Name +driver_config_description_bucket_bubble.cloud.storage.s3.S3StorageDriver=The name of the S3 bucket to use. The credentials provided in AWS Access Key and AWS Secret key must have permissions to read, write, and list objects in this bucket. +driver_config_prefix_bubble.cloud.storage.s3.S3StorageDriver=S3 Bucket Prefix +driver_config_description_prefix_bubble.cloud.storage.s3.S3StorageDriver=The bucket prefix (subdirectory) to use. All objects stored in S3 will be put under this prefix. This allows you to use the same S3 Bucket for multiple Bubbles, as long as they each use a distinct prefix. +driver_config_listFetchSize_bubble.cloud.storage.s3.S3StorageDriver=S3 List Fetch Size +driver_config_description_listFetchSize_bubble.cloud.storage.s3.S3StorageDriver=The "batch size" to use when making S3 list requests driver_bubble.cloud.storage.local.LocalStorageDriver=Local Storage description_bubble.cloud.storage.local.LocalStorageDriver=Supports local filesystem storage. +driver_config_baseDir_bubble.cloud.storage.local.LocalStorageDriver=Local Storage Base Directory +driver_config_description_baseDir_bubble.cloud.storage.local.LocalStorageDriver=Base directory to use for storage. Must be writeable by the user account running the Bubble API server. If not an absolute path, it is relative to the user account running the Bubble API server. diff --git a/bubble-server/src/test/java/bubble/test/dev/BlankDevServerTest.java b/bubble-server/src/test/java/bubble/test/dev/BlankDevServerTest.java index 90d086d6..37b6ba9d 100644 --- a/bubble-server/src/test/java/bubble/test/dev/BlankDevServerTest.java +++ b/bubble-server/src/test/java/bubble/test/dev/BlankDevServerTest.java @@ -22,8 +22,8 @@ public class BlankDevServerTest extends BubbleModelTestBase { super.onStart(server); } - @Test public void runDevServer () throws Exception { - log.info("runDevServer: Bubble API server started and model initialized. You may now begin testing."); + @Test public void runBlankServer () throws Exception { + log.info("runBlankServer: Bubble API server started and model initialized. You may now begin testing."); sleep(DAYS.toMillis(30), "running dev server"); } diff --git a/bubble-web b/bubble-web index fe10ccfc..6c141907 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit fe10ccfcc9663a178928328b86038185521f45e8 +Subproject commit 6c141907a646db2d5357bff3607391a23407de8c diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index b86ae902..22bc9dc5 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit b86ae9027fbf97f206266b2c66ff84d6e8eaf505 +Subproject commit 22bc9dc582dc9d1cf5269ff2fa36e178c97a47c3