Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Scout app multi deployment - differents options ?(Make scout application multi tenancy to prevent multiple deployment)
Scout app multi deployment - differents options ? [message #1835030] Mon, 23 November 2020 16:35 Go to next message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
I all,
We have a scout application used by multiple clients. What are doing now is for each client we setup: a database, a deployment of server.war, a deployment of client.war and set up of nginx proxy as shown below

- Client 1 (client1.myapp.com) <--> http://localhost:8080/client1 <--> http://localhost:8080/client1-server
- Client 2 (client2.myapp.com) <--> http://localhost:8080/client2 <--> http://localhost:8080/client2-server

All is working fine, but fixing a bug or adding a feature is becoming a nightmare due to redeployment (or jar update in lib folder) for each client manually.

We are thinking making the application multi tenant so that we will have a single deployment (server + client) so that we will have something like:

- Client 1 (client1.myapp.com) <--> http://localhost:8080/myapp?tenantId=client1 <--> http://localhost:8080/myapp-server
- Client 2 (client2.myapp.com) <--> http://localhost:8080/myapp?tenantId=client2 <--> http://localhost:8080/myapp-server

Our questions are:
- how we can get the request parameter "tenantId" from client side
- how we can transmit the got request param to server side (We are thinking using the instruction provided in this post https://www.eclipse.org/forums/index.php/t/1084235/)
- how we can get the request param from server side inside Service method

Our application so simple so we are planning to use a row based multi tenancy for now(we will have to only modify our queries that are located in a same package) and since other kind of multi tenancy seems to be difficult to setup with scout.
Re: Scout app multi deployment - differents options ? [message #1835074 is a reply to message #1835030] Tue, 24 November 2020 10:47 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi

Looks like a good idea to make your application multi-tenant capable.

When Scout creates a ClientSession you have access to all request parameters, see UiSession.java:

  protected IClientSession createAndStartClientSession(Locale locale, UserAgent userAgent, Map<String, String> sessionStartupParams) {
    return BEANS.get(ClientSessionProvider.class).provide(ClientRunContexts.copyCurrent()
        .withLocale(locale)
        .withUserAgent(userAgent)
        .withProperties(sessionStartupParams)); // Make startup parameters available at {@link PropertyMap#CURRENT} during client session is starting.
  }


So in MyProjectClientSession#execLoadSession you could do this:
m_tenantId = PropertyMap.CURRENT.get().get("tenantId");

You can access the ClientSession object in your client application from everywhere, so at this point you have the tenantId where needed, for instance to call your service methods, where tenantId is a parameter you simply pass each time.

Another solution is to set the tenantId on the ServerSession. For that you could try something like described in the the link you've posted, or you could simply define a method startup(String tentantId) on a service, which you call once, when your client application starts. The implementation of this method would set the tenantId on the server session instance, and use it where needed.

André


Eclipse Scout Homepage | Documentation | GitHub

[Updated on: Wed, 25 November 2020 06:27]

Report message to a moderator

Re: Scout app multi deployment - differents options ? [message #1835099 is a reply to message #1835074] Tue, 24 November 2020 18:10 Go to previous message
Seydou Zakou is currently offline Seydou ZakouFriend
Messages: 44
Registered: May 2020
Member
Thanks Andre for your quick response.

I will try a proof of concept of my ideas and come back with feedback.

Previous Topic:Dauerhafte Ausführung einer Methode nach Init
Next Topic:Cannot build project
Goto Forum:
  


Current Time: Thu Sep 19 19:23:32 GMT 2024

Powered by FUDForum. Page generated in 0.04144 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top