@@ -301,19 +301,6 @@ | |||||
<version>1.0.0-SNAPSHOT</version> | <version>1.0.0-SNAPSHOT</version> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>io.swagger</groupId> | |||||
<artifactId>swagger-jersey2-jaxrs</artifactId> | |||||
<version>1.5.24</version> | |||||
<exclusions> | |||||
<exclusion> | |||||
<groupId>com.fasterxml.jackson.dataformat</groupId> | |||||
<artifactId>jackson-dataformat-yaml</artifactId> | |||||
</exclusion> | |||||
</exclusions> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
@@ -266,6 +266,8 @@ public class ApiConstants { | |||||
public static final String DEBUG_ENDPOINT = "/debug"; | public static final String DEBUG_ENDPOINT = "/debug"; | ||||
public static final String BUBBLE_MAGIC_ENDPOINT = "/.bubble"; | public static final String BUBBLE_MAGIC_ENDPOINT = "/.bubble"; | ||||
public static final String OPENAPI_JSON_ENDPOINT = "/openapi.json"; | |||||
public static final String FILTER_HTTP_ENDPOINT = "/filter"; | public static final String FILTER_HTTP_ENDPOINT = "/filter"; | ||||
public static final String EP_CHECK = "/check"; | public static final String EP_CHECK = "/check"; | ||||
public static final String EP_APPLY = "/apply"; | public static final String EP_APPLY = "/apply"; | ||||
@@ -32,7 +32,8 @@ public class BubbleAuthFilter extends AuthFilter<Account> { | |||||
PLANS_ENDPOINT, PAYMENT_METHODS_ENDPOINT, | PLANS_ENDPOINT, PAYMENT_METHODS_ENDPOINT, | ||||
BUBBLE_MAGIC_ENDPOINT, | BUBBLE_MAGIC_ENDPOINT, | ||||
MESSAGES_ENDPOINT, TIMEZONES_ENDPOINT, | MESSAGES_ENDPOINT, TIMEZONES_ENDPOINT, | ||||
NOTIFY_ENDPOINT, FILTER_HTTP_ENDPOINT, DETECT_ENDPOINT | |||||
NOTIFY_ENDPOINT, FILTER_HTTP_ENDPOINT, DETECT_ENDPOINT, | |||||
OPENAPI_JSON_ENDPOINT | |||||
)); | )); | ||||
public static final Set<String> SKIP_AUTH_PATHS = new SingletonSet<>(AUTH_ENDPOINT); | public static final Set<String> SKIP_AUTH_PATHS = new SingletonSet<>(AUTH_ENDPOINT); | ||||
public static final Set<String> SKIP_ALL_AUTH = new SingletonSet<>("/"); | public static final Set<String> SKIP_ALL_AUTH = new SingletonSet<>("/"); | ||||
@@ -259,7 +259,7 @@ public class BubbleConfiguration extends PgRestServerConfiguration | |||||
try { | try { | ||||
properties.load(loadResourceAsStream("META-INF/bubble/bubble.properties")); | properties.load(loadResourceAsStream("META-INF/bubble/bubble.properties")); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
return die("getVersion: "+e, e); | |||||
return die("jarVersion: "+e, e); | |||||
} | } | ||||
return properties.getProperty(META_PROP_BUBBLE_VERSION); | return properties.getProperty(META_PROP_BUBBLE_VERSION); | ||||
} | } | ||||
@@ -45,10 +45,13 @@ import static org.cobbzilla.util.io.FileUtil.abs; | |||||
import static org.cobbzilla.util.io.FileUtil.mkdirOrDie; | import static org.cobbzilla.util.io.FileUtil.mkdirOrDie; | ||||
import static org.cobbzilla.util.io.StreamUtil.copyClasspathDirectory; | import static org.cobbzilla.util.io.StreamUtil.copyClasspathDirectory; | ||||
import static org.cobbzilla.util.json.JsonUtil.json; | import static org.cobbzilla.util.json.JsonUtil.json; | ||||
import static org.cobbzilla.wizard.server.config.OpenApiConfiguration.OPENAPI_DISABLED; | |||||
@Service @Slf4j | @Service @Slf4j | ||||
public class AnsiblePrepService { | public class AnsiblePrepService { | ||||
private static final int MIN_OPEN_API_MEMORY = 4096; | |||||
@Autowired private DatabaseFilterService dbFilter; | @Autowired private DatabaseFilterService dbFilter; | ||||
@Autowired private BubbleConfiguration configuration; | @Autowired private BubbleConfiguration configuration; | ||||
@Autowired private AccountPlanDAO accountPlanDAO; | @Autowired private AccountPlanDAO accountPlanDAO; | ||||
@@ -92,6 +95,12 @@ public class AnsiblePrepService { | |||||
ctx.put("support", configuration.getSupport()); | ctx.put("support", configuration.getSupport()); | ||||
ctx.put("appLinks", configuration.getAppLinks()); | ctx.put("appLinks", configuration.getAppLinks()); | ||||
if (shouldEnableOpenApi(installType, nodeSize)) { | |||||
ctx.put("openapi_contact_email", configuration.getOpenApi().getContactEmail()); | |||||
} else { | |||||
ctx.put("openapi_contact_email", OPENAPI_DISABLED); | |||||
} | |||||
if (network.sendErrors() && configuration.hasErrorApi()) { | if (network.sendErrors() && configuration.hasErrorApi()) { | ||||
final ErrorApiConfiguration errorApi = configuration.getErrorApi(); | final ErrorApiConfiguration errorApi = configuration.getErrorApi(); | ||||
ctx.put("error_url", errorApi.getUrl()); | ctx.put("error_url", errorApi.getUrl()); | ||||
@@ -168,4 +177,12 @@ public class AnsiblePrepService { | |||||
return (int) (((double) memoryMB) * 0.19d); | return (int) (((double) memoryMB) * 0.19d); | ||||
} | } | ||||
private boolean shouldEnableOpenApi(AnsibleInstallType installType, ComputeNodeSize nodeSize) { | |||||
// to enable OpenAPI on a deployed node: | |||||
// - it must already be enabled on the current bubble | |||||
// - the bubble being launched must be a sage or have 4GB+ memory | |||||
return configuration.hasOpenApi() && | |||||
(installType == AnsibleInstallType.sage || nodeSize.getMemoryMB() >= MIN_OPEN_API_MEMORY); | |||||
} | |||||
} | } |
@@ -20,6 +20,7 @@ | |||||
{"name": "db_name", "value": "bubble"}, | {"name": "db_name", "value": "bubble"}, | ||||
{"name": "db_key", "value": "[[dbEncryptionKey]]"}, | {"name": "db_key", "value": "[[dbEncryptionKey]]"}, | ||||
{"name": "letsencrypt_email", "value": "[[configuration.letsencryptEmail]]"}, | {"name": "letsencrypt_email", "value": "[[configuration.letsencryptEmail]]"}, | ||||
{"name": "openapi_contact_email", "value": "openapi_contact_email"}, | |||||
{"name": "is_fork", "value": "[[fork]]"}, | {"name": "is_fork", "value": "[[fork]]"}, | ||||
{"name": "restore_key", "value": "[[restoreKey]]"}, | {"name": "restore_key", "value": "[[restoreKey]]"}, | ||||
{"name": "restore_timeout", "value": "[[restoreTimeoutSeconds]]"}, | {"name": "restore_timeout", "value": "[[restoreTimeoutSeconds]]"}, | ||||
@@ -22,3 +22,4 @@ export APP_LINK_MACOSX={{ app_link_macosx }} | |||||
export APP_LINK_LINUX={{ app_link_linux }} | export APP_LINK_LINUX={{ app_link_linux }} | ||||
export CERT_VALIDATION_HOST={{ cert_validation_host }} | export CERT_VALIDATION_HOST={{ cert_validation_host }} | ||||
export OPENAPI_CONTACT_EMAIL={{ openapi_contact_email }} |
@@ -8,6 +8,14 @@ serverName: bubble-api | |||||
publicUriBase: {{PUBLIC_BASE_URI}} | publicUriBase: {{PUBLIC_BASE_URI}} | ||||
openApi: | |||||
title: Bubble API Reference, <<configuration.version>> | |||||
description: This is the Bubble API. It is used by the web UI, native apps, and CLI tools. | |||||
contactEmail: {{OPENAPI_CONTACT_EMAIL}} | |||||
terms: https://getbubblenow.com/terms/ | |||||
licenseName: Bubble License | |||||
licenseUrl: https://getbubblenow.com/bubble-license/ | |||||
defaultLocale: {{#exists BUBBLE_DEFAULT_LOCALE}}{{BUBBLE_DEFAULT_LOCALE}}{{else}}en_US{{/exists}} | defaultLocale: {{#exists BUBBLE_DEFAULT_LOCALE}}{{BUBBLE_DEFAULT_LOCALE}}{{else}}en_US{{/exists}} | ||||
testMode: {{#exists BUBBLE_TEST_MODE}}{{BUBBLE_TEST_MODE}}{{else}}false{{/exists}} | testMode: {{#exists BUBBLE_TEST_MODE}}{{BUBBLE_TEST_MODE}}{{else}}false{{/exists}} | ||||
@@ -1 +1 @@ | |||||
Subproject commit 72419b875024efae04931a9ce06b8cda8173cb9e | |||||
Subproject commit d915a7aff9e07888d389fc021693994fa538923c |
@@ -1 +1 @@ | |||||
Subproject commit e79af2c70ce31672995e708b2adbfa6f5e733f97 | |||||
Subproject commit 8da076b3a54a1af1d9d4efceace3b9c832b8d5dc |