Giter VIP home page Giter VIP logo

go-poly-tenant's Introduction

Go Polymer MultiTenancy

An example of using server-side Go templating to serve a multi-tenanted Polymer client using AppEngine. Each client could be served from it's own custom domain or using a CNAME from a root service (e.g. tenant.service.com).

Examples:

The dummy tenants are generated via the /app/warmup.go file.

Yes, those are some funky URLs, the '-dot-' part is todo with how AppEngine provides HTTPS for appspot.com domains. In reality you'd use a custom domain so you would have tenant URLs like red.myservice.com or www.red.com.

The index.html page and manifest.json file is generated dynamically for the domain it's being served from. All other static files are served by the AppEngine frontend edge cache (like a CDN).

Creating the index.html page from a template saves having to download the app and then make a separate request to get the runtime config for the tenant. We want fast and zippy and no waiting to render. This could also be used to add additional server-side meta-data for SEO, open-graph etc... by adding a little more server-side routing to the mix.

The app config and tenant data (for use within the app) is set to the MyApp global object. It can contain additional config settings such as api, auth or image endpoints.

Dependencies

You need to have

  • Go SDK for AppEngine
  • Polymer CLI

Setup

The /app folder contains the AppEngine application and also serves the polymer frontend SPA from a static folder which uses a symlink to point to the regular Polymer-CLI build folder. Create it in the /app folder using:

$ ln -s ../build/unbundled static

Run Locally

Build the polymer app using ./build.sh. This runs polymer build with the parameters to include the additonal files required (images and the webcomponent polyfill).

Start the app locally by running goapp serve within the /app folder

Go to one of the tenant sites:

xip.io is a wildcard DNS service that can be used when developing locally.

Develop Locally

I normally have the root index.html page set to use a dev tenant configuration.

go-poly-tenant's People

Contributors

captaincodeman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.