From de1b36180837c44d2800f9790ebfafe3724a02bb Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Mon, 6 Jan 2020 10:23:22 -0500 Subject: [PATCH] add SysInit listener, move some models into main, preparing for dist support --- README.md | 41 ---- bin/build_dist | 49 +++++ .../java/bubble/cloud/CloudServiceDriver.java | 2 + .../TOTPAuthenticatorDriver.java | 2 + .../java/bubble/dao/account/AccountDAO.java | 12 +- .../main/java/bubble/server/BubbleServer.java | 4 +- .../META-INF/bubble/bubble.properties | 2 +- .../apps/analytics/bubbleApp_analytics.json | 0 .../bubbleApp_analytics_matchers.json | 0 .../apps/user_block/bubbleApp_userBlock.json | 0 .../user_block/hn/bubbleApp_userBlock_hn.json | 0 .../hn/bubbleApp_userBlock_hn_matchers.json | 0 .../models/dist/bubbleFootprint.json | 21 ++ .../resources/models/dist/bubblePlan.json | 23 ++ .../resources/models/dist/cloudService.json | 206 ++++++++++++++++++ .../resources/models/dist/ruleDriver.json | 18 ++ .../models/manifest-app-analytics.json | 0 .../models/manifest-app-user-block.json | 5 + .../main/resources/models/manifest-dist.json | 7 + .../java/bubble/test/BubbleModelTestBase.java | 8 +- dev-README.md | 44 ++++ dist-README.md | 50 +++++ utils/cobbzilla-utils | 2 +- utils/cobbzilla-wizard | 2 +- 24 files changed, 448 insertions(+), 50 deletions(-) create mode 100755 bin/build_dist rename bubble-server/src/{test => main}/resources/models/apps/analytics/bubbleApp_analytics.json (100%) rename bubble-server/src/{test => main}/resources/models/apps/analytics/bubbleApp_analytics_matchers.json (100%) rename bubble-server/src/{test => main}/resources/models/apps/user_block/bubbleApp_userBlock.json (100%) rename bubble-server/src/{test => main}/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json (100%) rename bubble-server/src/{test => main}/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn_matchers.json (100%) create mode 100644 bubble-server/src/main/resources/models/dist/bubbleFootprint.json create mode 100644 bubble-server/src/main/resources/models/dist/bubblePlan.json create mode 100644 bubble-server/src/main/resources/models/dist/cloudService.json create mode 100644 bubble-server/src/main/resources/models/dist/ruleDriver.json rename bubble-server/src/{test => main}/resources/models/manifest-app-analytics.json (100%) create mode 100644 bubble-server/src/main/resources/models/manifest-app-user-block.json create mode 100644 bubble-server/src/main/resources/models/manifest-dist.json create mode 100644 dev-README.md create mode 100644 dist-README.md diff --git a/README.md b/README.md index 1f2a9558..52821f6d 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,3 @@ bubble ====== -# Development Setup - -## First-Time System Setup -After you clone this repository, run: - - ./bin/first_time_ubuntu.sh - -If you are running on a non-Ubuntu system, copy that file to something like: - - ./bin/first_time_myoperatingsystem.sh - -And then edit it such that all the same packages get installed. Then submit a pull request and we can add support for your operating system to the main repository. - -You only need to run this command once, ever, on a development system. It ensures that the appropriate packages are installed and proper databases and database users exist. - -## First-Time Dev Setup -After running the system setup above, run: - - ./bin/first_time_setup.sh - -This will grab all the submodules and perform an initial build of all components. - -## Bubble environment file -You will need a file named `${HOME}/.bubble.env` which contains various environment variables required to run the server. - -Talk to another developer to get a copy of this file. Do not ever send this file over email or any other unencrypted channel. -Always use `scp` to copy this file from one machine to another. - -After you have the env file in place, create a symlink called `${HOME}/.bubble-test.env` - - cd ${HOME} && ln -s .bubble.env .bubble-test.env - -## Subsequent Updates -If you want to grab the latest code, and ensure that all git submodules are properly in sync with the main repository, run: - - ./bin/git_update_bubble.sh - -This will update and rebuild all submodules, and the main bubble jar file. - -## Running in development -Assuming you ran the commands above, you can run a test server using the method described in the bubble-web [README](https://git.bubblev.org/bubbleV/bubble-web/src/branch/master/README.md). diff --git a/bin/build_dist b/bin/build_dist new file mode 100755 index 00000000..ebc4dadd --- /dev/null +++ b/bin/build_dist @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Build Bubble distribution ZIP file +# +# Usage: +# +# build_dist [no-build] +# +# no-build : if present, do not rebuild the bubble jar file +# +# Environment variables +# +# BUBBLE_ENV : env file to load. Default is ~/.bubble.env or /home/bubble/current/bubble.env (whichever is found first) +# +SCRIPT="${0}" +SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) +. ${SCRIPT_DIR}/bubble_common + +NO_BUILD="${1}" + +BASE=$(cd $(dirname $0)/.. && pwd) +cd ${BASE} + +if [[ -z "${NO_BUILD}" || "${NO_BUILD}" != "no-build" ]] ; then + echo "Building bubble jar..." + ${BASE}/bin/git_update_bubble.sh || die "Error building bubble jar file" +else + echo "Not building bubble jar: no-build was set" +fi + +DIST_BASE="${BASE}/dist" +rm -rf "${DIST_BASE}" || die "Error removing "${DIST_BASE}" directory" +mkdir -p "${DIST_BASE}" || die "Error creating "${DIST_BASE}" directory" + +JAR_DIR="${BASE}/bubble-server/target" +JAR="$(find "${JAR_DIR}" -type f -name "bubble-server-*.jar" | head -1)" +if [[ -z "${JAR}" ]] ; then + die "No bubble jar found in ${JAR_DIR}" +fi + +VERSION_FILE="${BASE}/bubble-server/src/main/resources/META-INF/bubble/bubble.properties" +VERSION=$(cat "${VERSION_FILE}" | grep bubble.version | awk -F '=' '{print $2}') +if [[ -z "${VERSION}" ]] ; then + die "No version found in ${VERSION_FILE}" +fi + +DIST="${DIST_BASE}/bubble-${VERSION}" +cp "${JAR}" "${DIST}/bubble.jar" || die "Error copying ${JAR} to ${DIST}/bubble.jar" +cp "${BASE}/dist-README.md" "${DIST}/README.md" || die "Error copying dist-README.md to ${DIST}/README.md" diff --git a/bubble-server/src/main/java/bubble/cloud/CloudServiceDriver.java b/bubble-server/src/main/java/bubble/cloud/CloudServiceDriver.java index 5f50f8af..84d09daf 100644 --- a/bubble-server/src/main/java/bubble/cloud/CloudServiceDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/CloudServiceDriver.java @@ -22,6 +22,8 @@ public interface CloudServiceDriver { String CTX_API_KEY = "apiKey"; String CTX_PARAMS = "params"; + default boolean disableDelegation () { return false; } + default void startDriver() {} void setConfig(JsonNode json, CloudService cloudService); diff --git a/bubble-server/src/main/java/bubble/cloud/authenticator/TOTPAuthenticatorDriver.java b/bubble-server/src/main/java/bubble/cloud/authenticator/TOTPAuthenticatorDriver.java index 27380b5a..815ad1e0 100644 --- a/bubble-server/src/main/java/bubble/cloud/authenticator/TOTPAuthenticatorDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/authenticator/TOTPAuthenticatorDriver.java @@ -9,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; public class TOTPAuthenticatorDriver implements AuthenticatorServiceDriver { + @Override public boolean disableDelegation() { return true; } + @Autowired private AccountPolicyDAO policyDAO; @Autowired private StandardAccountMessageService messageService; diff --git a/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java b/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java index 27a32ba1..5fc55005 100644 --- a/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java +++ b/bubble-server/src/main/java/bubble/dao/account/AccountDAO.java @@ -1,5 +1,6 @@ package bubble.dao.account; +import bubble.cloud.CloudServiceDriver; import bubble.dao.account.message.AccountMessageDAO; import bubble.dao.app.*; import bubble.dao.cloud.AnsibleRoleDAO; @@ -121,9 +122,14 @@ public class AccountDAO extends AbstractCRUDDAO implements SqlViewSearc final Map clouds = new HashMap<>(); copyTemplateObjects(acct, parent, cloudDAO, new AccountTemplate.CopyTemplate<>() { @Override public CloudService preCreate(CloudService parentEntity, CloudService accountEntity) { - return accountEntity.setDelegated(parentEntity.getUuid()) - .setCredentials(CloudCredentials.delegate(configuration.getThisNode(), configuration)) - .setTemplate(false); + final CloudServiceDriver driver = parentEntity.getDriver(); + if (driver.disableDelegation()) { + return accountEntity.setTemplate(false); + } else { + return accountEntity.setDelegated(parentEntity.getUuid()) + .setCredentials(CloudCredentials.delegate(configuration.getThisNode(), configuration)) + .setTemplate(false); + } } @Override public void postCreate(CloudService parentEntity, CloudService accountEntity) { clouds.put(parentEntity.getUuid(), accountEntity); diff --git a/bubble-server/src/main/java/bubble/server/BubbleServer.java b/bubble-server/src/main/java/bubble/server/BubbleServer.java index e5b73769..c7c5e9ad 100644 --- a/bubble-server/src/main/java/bubble/server/BubbleServer.java +++ b/bubble-server/src/main/java/bubble/server/BubbleServer.java @@ -14,6 +14,7 @@ import org.cobbzilla.wizard.server.RestServerLifecycleListener; import org.cobbzilla.wizard.server.RestServerLifecycleListenerBase; import org.cobbzilla.wizard.server.config.factory.ConfigurationSource; import org.cobbzilla.wizard.server.listener.FlywayMigrationListener; +import org.cobbzilla.wizard.server.listener.SystemInitializerListener; import java.io.File; import java.util.Arrays; @@ -38,8 +39,9 @@ public class BubbleServer extends RestServerBase { public static final String BUBBLE_DUMP_CONFIG = "BUBBLE_DUMP_CONFIG"; public static final List LIFECYCLE_LISTENERS = Arrays.asList(new RestServerLifecycleListener[] { - new NodeInitializerListener(), + new SystemInitializerListener(), new FlywayMigrationListener(), + new NodeInitializerListener(), new DeviceInitializerListener(), new BubbleFirstTimeListener() }); diff --git a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties index 8259f3c0..430dc56c 100644 --- a/bubble-server/src/main/resources/META-INF/bubble/bubble.properties +++ b/bubble-server/src/main/resources/META-INF/bubble/bubble.properties @@ -1 +1 @@ -bubble.version=0.0.3 +bubble.version=0.1.4 diff --git a/bubble-server/src/test/resources/models/apps/analytics/bubbleApp_analytics.json b/bubble-server/src/main/resources/models/apps/analytics/bubbleApp_analytics.json similarity index 100% rename from bubble-server/src/test/resources/models/apps/analytics/bubbleApp_analytics.json rename to bubble-server/src/main/resources/models/apps/analytics/bubbleApp_analytics.json diff --git a/bubble-server/src/test/resources/models/apps/analytics/bubbleApp_analytics_matchers.json b/bubble-server/src/main/resources/models/apps/analytics/bubbleApp_analytics_matchers.json similarity index 100% rename from bubble-server/src/test/resources/models/apps/analytics/bubbleApp_analytics_matchers.json rename to bubble-server/src/main/resources/models/apps/analytics/bubbleApp_analytics_matchers.json diff --git a/bubble-server/src/test/resources/models/apps/user_block/bubbleApp_userBlock.json b/bubble-server/src/main/resources/models/apps/user_block/bubbleApp_userBlock.json similarity index 100% rename from bubble-server/src/test/resources/models/apps/user_block/bubbleApp_userBlock.json rename to bubble-server/src/main/resources/models/apps/user_block/bubbleApp_userBlock.json diff --git a/bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json b/bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json similarity index 100% rename from bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json rename to bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json diff --git a/bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn_matchers.json b/bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn_matchers.json similarity index 100% rename from bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn_matchers.json rename to bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn_matchers.json diff --git a/bubble-server/src/main/resources/models/dist/bubbleFootprint.json b/bubble-server/src/main/resources/models/dist/bubbleFootprint.json new file mode 100644 index 00000000..17724199 --- /dev/null +++ b/bubble-server/src/main/resources/models/dist/bubbleFootprint.json @@ -0,0 +1,21 @@ +[ + { + "name": "Worldwide", + "description": "No restrictions, run anywhere", + "template": true + }, + + { + "name": "US", + "description": "Only run in the United States", + "template": true, + "allowedCountries": ["US"] + }, + + { + "name": "EU", + "description": "Only run in the European Union", + "template": true, + "allowedCountries": ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "UK", "GB"] + } +] \ No newline at end of file diff --git a/bubble-server/src/main/resources/models/dist/bubblePlan.json b/bubble-server/src/main/resources/models/dist/bubblePlan.json new file mode 100644 index 00000000..874b640d --- /dev/null +++ b/bubble-server/src/main/resources/models/dist/bubblePlan.json @@ -0,0 +1,23 @@ +[{ + "name": "bubble", + "chargeName": "BubbleStd", + "computeSizeType": "small", + "nodesIncluded": 1, + "additionalPerNodePrice": 0, + "price": 0, + "storageGbIncluded": 15, + "additionalStoragePerGbPrice": 0, + "bandwidthGbIncluded": 500, + "additionalBandwidthPerGbPrice": 0 +}, { + "name": "bubble_plus", + "chargeName": "BubblePlus", + "computeSizeType": "medium", + "nodesIncluded": 1, + "additionalPerNodePrice": 0, + "price": 0, + "storageGbIncluded": 40, + "additionalStoragePerGbPrice": 0, + "bandwidthGbIncluded": 1000, + "additionalBandwidthPerGbPrice": 0 +}] diff --git a/bubble-server/src/main/resources/models/dist/cloudService.json b/bubble-server/src/main/resources/models/dist/cloudService.json new file mode 100644 index 00000000..4fe78842 --- /dev/null +++ b/bubble-server/src/main/resources/models/dist/cloudService.json @@ -0,0 +1,206 @@ +[ + { + "_subst": true, + "name": "GoogleGeoCoder", + "type": "geoCode", + "driverClass": "bubble.cloud.geoCode.google.GoogleGeoCodeDriver", + "credentials": { "params": [ {"name": "apiKey", "value": "{{required GOOGLE_API_KEY}}"} ] }, + "template": true + }, + + { + "_subst": true, + "name": "TOTPAuthenticator", + "type": "authenticator", + "driverClass": "bubble.cloud.authenticator.TOTPAuthenticatorDriver", + "template": true + }, + + { + "_subst": true, + "name": "SmtpServer", + "type": "email", + "driverClass": "{{BUBBLE_SMTP_DRIVER}}", + "driverConfig": { + "tlsEnabled": true + }, + "credentials": { + "params": [ + {"name": "user", "value": "{{required BUBBLE_SMTP_USER}}"}, + {"name": "password", "value": "{{required BUBBLE_SMTP_PASS}}"}, + {"name": "host", "value": "{{required BUBBLE_SMTP_SERVER}}"}, + {"name": "port", "value": "{{required BUBBLE_SMTP_PORT}}"} + ] + }, + "template": true + }, + + { + "_subst": true, + "name": "TwilioSms", + "type": "sms", + "driverClass": "{{BUBBLE_SMS_DRIVER}}", + "driverConfig": {}, + "credentials": { + "params": [ + {"name": "accountSID", "value": "{{required TWILIO_ACCOUNT_SID}}"}, + {"name": "authToken", "value": "{{required TWILIO_AUTH_TOKEN}}"}, + {"name": "fromPhoneNumber", "value": "{{required TWILIO_FROM_PHONE_NUMBER}}"} + ] + }, + "template": true + }, + + { + "_subst": true, + "name": "GoogleGeoTime", + "type": "geoTime", + "driverClass": "bubble.cloud.geoTime.google.GoogleGeoTimeDriver", + "credentials": { "params": [ {"name": "apiKey", "value": "{{required GOOGLE_API_KEY}}"} ] }, + "template": true + }, + + { + "_subst": true, + "name": "VultrCompute", + "type": "compute", + "driverClass": "bubble.cloud.compute.vultr.VultrDriver", + "driverConfig": { + "regions": [{ + "name": "Vultr - Dallas", + "internalName": "Dallas", + "location": {"city": "Dallas", "country": "US", "region": "TX", "lat": "32.779167", "lon": "-96.808889"} + }, { + "name": "Vultr - Los Angeles", + "internalName": "Los Angeles", + "location": {"city": "Los Angeles", "country": "US", "region": "CA", "lat": "34.05", "lon": "-118.25"} + }, { + "name": "Vultr - Miami", + "internalName": "Miami", + "location": {"city": "Miami", "country": "US", "region": "FL", "lat": "25.775278", "lon": "-80.208889"} + }, { + "name": "Vultr - Seattle", + "internalName": "Seattle", + "location": {"city": "Seattle", "country": "US", "region": "WA", "lat": "47.609722", "lon": "-122.333056"} + }, { + "name": "Vultr - New Jersey", + "internalName": "New Jersey", + "location": {"city": "Newark", "country": "US", "region": "NJ", "lat": "40.72", "lon": "-74.17"} + }, { + "name": "Vultr - Atlanta", + "internalName": "Atlanta", + "location": {"city": "Atlanta", "country": "US", "region": "GA", "lat": "33.755", "lon": "-84.39"} + }, { + "name": "Vultr - Chicago", + "internalName": "Chicago", + "location": {"city": "Chicago", "country": "US", "region": "IL", "lat": "41.881944", "lon": "-87.627778"} + }, { + "name": "Vultr - San Jose", + "internalName": "Silicon Valley", + "location": {"city": "San Jose", "country": "US", "region": "CA", "lat": "37.333333", "lon": "-121.9"} + }, { + "name": "Vultr - Toronto", + "internalName": "Toronto", + "location": {"city": "Toronto", "country": "CA", "region": "ON", "lat": "43.741667", "lon": "-79.373333"} + }, { + "name": "Vultr - London", + "internalName": "London", + "location": {"city": "London", "country": "GB", "region": "London", "lat": "51.507222", "lon": "-0.1275"} + }, { + "name": "Vultr - Paris", + "internalName": "Paris", + "location": {"city": "Paris", "country": "FR", "region": "Ile-de-Paris", "lat": "48.8567", "lon": "2.3508"} + }, { + "name": "Vultr - Frankfurt", + "internalName": "Frankfurt", + "location": {"city": "Frankfurt", "country": "DE", "region": "Hesse", "lat": "50.116667", "lon": "8.683333"} + }, { + "name": "Vultr - Singapore", + "internalName": "Singapore", + "location": {"city": "Singapore", "country": "SG", "region": "Singapore", "lat": "1.283333", "lon": "103.833333"} + }, { + "name": "Vultr - Tokyo", + "internalName": "Tokyo", + "location": {"city": "Tokyo", "country": "JP", "region": "Kantō", "lat": "35.689722", "lon": "139.692222"} + }, { + "name": "Vultr - Sydney", + "internalName": "Sydney", + "location": {"city": "Sydney", "country": "AU", "region": "NSW", "lat": "-33.865", "lon": "151.209444"} + }, { + "name": "Vultr - Amsterdam", + "internalName": "ams3", + "location": {"city": "Amsterdam", "country": "NL", "region": "North Holland", "lat": "52.366667", "lon": "4.9"} + }], + "sizes": [ + {"name": "small", "type": "small", "internalName": "1024 MB RAM,25 GB SSD,1.00 TB BW", "vcpu": 1, "memoryMB": 1024, "ssdGB": 25}, + {"name": "medium", "type": "medium", "internalName": "2048 MB RAM,55 GB SSD,2.00 TB BW", "vcpu": 1, "memoryMB": 2048, "ssdGB": 55}, + {"name": "large", "type": "large", "internalName": "4096 MB RAM,80 GB SSD,3.00 TB BW", "vcpu": 1, "memoryMB": 4096, "ssdGB": 80} + ], + "config": [{"name": "os", "value": "Ubuntu 18.04 x64"}] + }, + "credentials": { + "params": [ + {"name": "API-Key", "value": "{{required VULTR_API_KEY}}"} + ] + }, + "template": true + }, + + { + "_subst": true, + "name": "DigitalOceanCompute", + "type": "compute", + "driverClass": "bubble.cloud.compute.digitalocean.DigitalOceanDriver", + "driverConfig": { + "regions": [{ + "name": "DigitalOcean - New York City 1", + "internalName": "nyc1", + "location": {"city": "New York", "country": "US", "region": "NY", "lat": "40.661", "lon": "-73.944"} + },{ + "name": "DigitalOcean - New York City 3", + "internalName": "nyc3", + "location": {"city": "New York", "country": "US", "region": "NY", "lat": "40.661", "lon": "-73.944"} + }, { + "name": "DigitalOcean - Singapore 1", + "internalName": "sgp1", + "location": {"city": "Singapore", "country": "SG", "region": "Singapore", "lat": "1.283333", "lon": "103.833333"} + }, { + "name": "DigitalOcean - London 1", + "internalName": "lon1", + "location": {"city": "London", "country": "GB", "region": "London", "lat": "51.507222", "lon": "-0.1275"} + }, { + "name": "DigitalOcean - Amsterdam 3", + "internalName": "ams3", + "location": {"city": "Amsterdam", "country": "NL", "region": "North Holland", "lat": "52.366667", "lon": "4.9"} + }, { + "name": "DigitalOcean - Frankfurt 1", + "internalName": "fra1", + "location": {"city": "Frankfurt", "country": "DE", "region": "Hesse", "lat": "50.116667", "lon": "8.683333"} + }, { + "name": "DigitalOcean - Toronto 1", + "internalName": "tor1", + "location": {"city": "Toronto", "country": "CA", "region": "ON", "lat": "43.741667", "lon": "-79.373333"} + }, { + "name": "DigitalOcean - San Francisco 2", + "internalName": "sfo2", + "location": {"city": "San Francisco", "country": "US", "region": "CA", "lat": "37.783333", "lon": "-122.416667"} + }, { + "name": "DigitalOcean - Bangalore 1", + "internalName": "blr1", + "location": {"city": "Bangalore", "country": "IN", "region": "Karnataka", "lat": "12.983333", "lon": "77.583333"} + }], + "sizes": [ + {"name": "small", "type": "small", "internalName": "s-1vcpu-1gb", "vcpu": 1, "memoryMB": 1024, "ssdGB": 25}, + {"name": "medium", "type": "medium", "internalName": "s-1vcpu-2gb", "vcpu": 1, "memoryMB": 2048, "ssdGB": 50}, + {"name": "large", "type": "large", "internalName": "s-2vcpu-4gb", "vcpu": 2, "memoryMB": 4096, "ssdGB": 80} + ], + "config": [{"name": "os", "value": "ubuntu-18-04-x64"}] + }, + "credentials": { + "params": [ + {"name": "apiKey", "value": "{{required DIGITALOCEAN_API_KEY}}"} + ] + }, + "template": true + } +] \ No newline at end of file diff --git a/bubble-server/src/main/resources/models/dist/ruleDriver.json b/bubble-server/src/main/resources/models/dist/ruleDriver.json new file mode 100644 index 00000000..1ec49ef0 --- /dev/null +++ b/bubble-server/src/main/resources/models/dist/ruleDriver.json @@ -0,0 +1,18 @@ +[ + { + "name": "UserBlocker", + "driverClass": "bubble.rule.social.block.UserBlocker", + "template": true, + "userConfig": { + "fields": [] + } + }, + { + "name": "TrafficAnalytics", + "driverClass": "bubble.rule.analytics.TrafficAnalytics", + "template": true, + "userConfig": { + "fields": [] + } + } +] \ No newline at end of file diff --git a/bubble-server/src/test/resources/models/manifest-app-analytics.json b/bubble-server/src/main/resources/models/manifest-app-analytics.json similarity index 100% rename from bubble-server/src/test/resources/models/manifest-app-analytics.json rename to bubble-server/src/main/resources/models/manifest-app-analytics.json diff --git a/bubble-server/src/main/resources/models/manifest-app-user-block.json b/bubble-server/src/main/resources/models/manifest-app-user-block.json new file mode 100644 index 00000000..3cdabc73 --- /dev/null +++ b/bubble-server/src/main/resources/models/manifest-app-user-block.json @@ -0,0 +1,5 @@ +[ + "apps/user_block/bubbleApp_userBlock", + "apps/user_block/hn/bubbleApp_userBlock_hn", + "apps/user_block/hn/bubbleApp_userBlock_hn_matchers" +] \ No newline at end of file diff --git a/bubble-server/src/main/resources/models/manifest-dist.json b/bubble-server/src/main/resources/models/manifest-dist.json new file mode 100644 index 00000000..1ab3808e --- /dev/null +++ b/bubble-server/src/main/resources/models/manifest-dist.json @@ -0,0 +1,7 @@ +[ + "dist/bubbleFootprint", + "dist/bubblePlan", + "dist/ruleDriver", + "manifest-app-analytics", + "manifest-app-user-block" +] \ No newline at end of file diff --git a/bubble-server/src/test/java/bubble/test/BubbleModelTestBase.java b/bubble-server/src/test/java/bubble/test/BubbleModelTestBase.java index 7bff0d79..bab38af8 100644 --- a/bubble-server/src/test/java/bubble/test/BubbleModelTestBase.java +++ b/bubble-server/src/test/java/bubble/test/BubbleModelTestBase.java @@ -38,7 +38,6 @@ public abstract class BubbleModelTestBase extends ApiModelTestBase server) { server.getConfiguration().setBackupsEnabled(backupsEnabled()); - registerTestHelpers(getApiRunner().getHandlebars()); super.beforeStart(server); } @@ -51,7 +50,12 @@ public abstract class BubbleModelTestBase extends ApiModelTestBase getLifecycleListeners() { return TEST_LIFECYCLE_LISTENERS; } - @Getter(lazy=true) private final ApiRunner apiRunner = new ApiRunner(getApi(), (ApiRunnerListener) getListener()); + @Getter(lazy=true) private final ApiRunner apiRunner = initApiRunner(); + private ApiRunner initApiRunner() { + final ApiRunner runner = new ApiRunner(getApi(), (ApiRunnerListener) getListener()); + registerTestHelpers(runner.getHandlebars()); + return runner; + } @Getter private StreamConfigurationSource configurationSource = new StreamConfigurationSource("test-bubble-config.yml"); diff --git a/dev-README.md b/dev-README.md new file mode 100644 index 00000000..1f2a9558 --- /dev/null +++ b/dev-README.md @@ -0,0 +1,44 @@ +bubble +====== + +# Development Setup + +## First-Time System Setup +After you clone this repository, run: + + ./bin/first_time_ubuntu.sh + +If you are running on a non-Ubuntu system, copy that file to something like: + + ./bin/first_time_myoperatingsystem.sh + +And then edit it such that all the same packages get installed. Then submit a pull request and we can add support for your operating system to the main repository. + +You only need to run this command once, ever, on a development system. It ensures that the appropriate packages are installed and proper databases and database users exist. + +## First-Time Dev Setup +After running the system setup above, run: + + ./bin/first_time_setup.sh + +This will grab all the submodules and perform an initial build of all components. + +## Bubble environment file +You will need a file named `${HOME}/.bubble.env` which contains various environment variables required to run the server. + +Talk to another developer to get a copy of this file. Do not ever send this file over email or any other unencrypted channel. +Always use `scp` to copy this file from one machine to another. + +After you have the env file in place, create a symlink called `${HOME}/.bubble-test.env` + + cd ${HOME} && ln -s .bubble.env .bubble-test.env + +## Subsequent Updates +If you want to grab the latest code, and ensure that all git submodules are properly in sync with the main repository, run: + + ./bin/git_update_bubble.sh + +This will update and rebuild all submodules, and the main bubble jar file. + +## Running in development +Assuming you ran the commands above, you can run a test server using the method described in the bubble-web [README](https://git.bubblev.org/bubbleV/bubble-web/src/branch/master/README.md). diff --git a/dist-README.md b/dist-README.md new file mode 100644 index 00000000..dd42cdcd --- /dev/null +++ b/dist-README.md @@ -0,0 +1,50 @@ +# Bubble: a privacy-first VPN + +Bubble helps you start and manage your own private VPN. + +It also adds tools to this VPN to improve your Internet experience by modifying your traffic: to +remove ads, block malware, and much more. + +## Operating System Support +Once your Bubble is running, any device can connect to it: Windows, Linux, Mac, iOS, Android; if it supports VPN connections, +it will probably work just fine. + +However, to launch your own Bubble using this software, you will need a Linux machine to run the launcher. +It *probably* works on MacOS, but it has not been tested and there are likely to be issues. Pull requests are welcome! + +If you'd like to enjoy all the benefits of Bubble without going through this hassle, please try out the Bubble launching +service available on [bubblev.com](https://bubblev.com). Any Bubble you launch from [bubblev.com](https://bubblev.com) +will also be "yours only" -- all Bubbles disconnect from their launcher during configuration. + +## Getting Started + +### Download a Bubble Distribution + +### Install PostgreSQL and Redis +Install [PostgreSQL](https://www.postgresql.org/download/) if it is not installed on your system. +It will probably be easier to install using an OS package, for example `sudo apt install postgresql` + +Install [Redis](https://redis.io/download) if it is not already installed on your system. +It will probably be easier to install using an OS package, for example `sudo apt install redis` + +### Configure PostgreSQL +The Bubble launcher connects to a PostgreSQL database named 'bubble' as the PostgreSQL user 'bubble'. + +If your current OS user account has permissions to create PostgreSQL databases and users, you can skip this step +since the database and user will be created upon startup. + +Otherwise, please either: + * Update the PostgreSQL `pg_hba.conf` file to allow your current OS user to create databases and DB users, OR + * Create a PostgreSQL database named `bubble` and a database user named `bubble`. Set a password for the `bubble` user, + and set the environment variable `BUBBLE_PG_PASSWORD` to this password when starting the Bubble launcher. + +### Start the Bubble launcher +Running a Bubble locally + +### Activate your local Bubble + +#### Activate using the Web UI + +#### Activate using the command line + +### Configure Cloud Services diff --git a/utils/cobbzilla-utils b/utils/cobbzilla-utils index 00bc3379..94b18c17 160000 --- a/utils/cobbzilla-utils +++ b/utils/cobbzilla-utils @@ -1 +1 @@ -Subproject commit 00bc337910b7637d2e9941c4be12caf5d4d2e7e6 +Subproject commit 94b18c1772002c013c1cc2a856126378aebc7460 diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index 5f6b0f96..b66a2c79 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit 5f6b0f9600179cf034db942a878eb6729f29b70a +Subproject commit b66a2c79a0f770659c7fed6de8a3824d1a00a3f0