Hi Brian,

I am still having issues setting up nginx.
My development environment is as follows

I have a blazeds endpoint  running on tomcat that can be accessed via this
url

http://localhost:8080/myblazeds/messagebroker/websocket-amf

During development, I can run royale using the maven embedded tomcat plug in

mvn tomcat7:run

Once the app is running, I can access the url using this

http://localhost:8082/MainApp/index.html

In my remote endpoint configuration, I usually hard code the full url
(including localhost and port no) to blazeds.

Based on your recommendation I configured a relative url part for my remote
end point.
/myblazeds/messagebroker/websocket-amf

This works if I copy the royale js files to my spring boot web resource
folder. i.e. I bundled the royale app as part of the spring boot
application.

I want to keep the
1. front end and back end separate.
2. Use the relative endpoint url.
3. Use nginx to proxy the front end request to the back end.


I have installed nginx. and tried your earlier configuration. It is not
working. I am using a windows pc.

Regards,

On Tue, Nov 23, 2021 at 11:07 AM Roman Isitua <[email protected]> wrote:

> I have gone through the below. The only section that is not clear is the
> section
>
> alias "/some/path/to/src";
>
>
> Am I expected to put the file path to the src folder that contains the
> royale mxml and actionscript code  of my project ?
>
>
>
> On Mon, 22 Nov 2021, 23:37 Brian Raymes, <[email protected]> wrote:
>
>> Glad it worked! If you need any assistance setting it up, let me know.
>> Here’s the basic server block I use to make it work, if others are
>> interested:
>>
>>
>>
>> server {
>>
>>     listen 80;
>>
>>
>>
>>     location / {
>>
>>
>>
>>         # don't cache it
>>
>>         proxy_no_cache 1;
>>
>>         # even if cached, don't try to use it
>>
>>         proxy_cache_bypass 1;
>>
>>
>>
>>         root "/some/path/to/royale/target/javascript/bin/js-debug";
>>
>>
>>
>>         # This try_files allows you to reach local stuff first before
>> going to the @remoteserver, such as the /src location below
>>
>>         try_files $uri $uri/ @remoteserver;
>>
>>     }
>>
>>
>>
>>     location /src {
>>
>>         alias "/some/path/to/src";
>>
>>     }
>>
>>
>>
>>     location @remoteserver {
>>
>>         # Development Servers
>>
>>         proxy_pass http://path/to/dev/server;
>>
>>
>>
>>         # Test, other, etc
>>
>>         #proxy_pass http://something/else/;
>>
>>     }
>>
>> }
>>
>>
>>
>> Brian
>>
>>
>>
>> *From:* Roman Isitua <[email protected]>
>> *Sent:* Monday, November 22, 2021 1:45 PM
>> *To:* [email protected]
>> *Subject:* Re: [EXTERNAL] Configuring rpc end points in royale
>>
>>
>>
>> Thank you very much Brian. It worked.
>>
>>
>>
>> I would like to know how I can set up a local instance of Nginx that
>> proxies to my backend. I see a lot of benefits in having this capability.
>>
>>
>>
>> Regards,
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Oct 31, 2021 at 8:43 AM Roman Isitua <[email protected]>
>> wrote:
>>
>> Thanks for this response. I will certainly try the below configuration
>> and revert.
>>
>>
>>
>>
>>
>> However, I want  to understand your usage of nginx.
>>
>>
>>
>> My approach is to develop on my local machine then deploy to test server
>> then test there.
>>
>>
>>
>> If I understood you correctly, you are deploying the front end in your
>> local machine however you are using nginx to route traffic to your test
>> server ?
>>
>>
>>
>> I would appreciate if you have links on how to do this. Sounds
>> very interesting.
>>
>>
>>
>> On Tue, 26 Oct 2021, 23:15 Brian Raymes, <[email protected]>
>> wrote:
>>
>> Correct, remove the hostname and IP from your configuration and it will
>> infer it at runtime. FYI, I’m using crux as well, although, I have mine
>> configured a bit differently.
>>
>>
>>
>> Example for you:
>>
>>
>>
>> <mx:RemoteObject id="serviceDAO"
>>
>>      endpoint="messagebroker/websocket-amf
>> <http://localhost:8080/messagebroker/websocket-amf>"
>>
>>      destination="genericService">
>>
>>
>>
>>     <mx:method name="findWithNamedQuery">
>>
>>     </mx:method>
>>
>>
>>
>> </mx:RemoteObject>
>>
>>
>>
>> Then, what I do, is set up my nginx proxy to forward traffic to my test
>> server. Have the forward include the “spaceiofm”. Then, your code is
>> deployment agnostic.
>>
>>
>>
>> Hope that helps. Let me know if you need more concrete examples.
>>
>>
>>
>> Brian
>>
>>
>>
>> *From:* Roman Isitua <[email protected]>
>> *Sent:* Monday, October 25, 2021 12:25 PM
>> *To:* [email protected]
>> *Subject:* Re: [EXTERNAL] Configuring rpc end points in royale
>>
>>
>>
>> Hi Brian,
>>
>>
>>
>> Thanks for your response. Though I am still not clear how your suggestion
>> will work. Formy app I am using crux. There is a beans.xml file where I
>> configured my remote end points as follows
>>
>>
>>
>>
>>
>>  <mx:RemoteObject id="serviceDAO"
>>
>>                          endpoint="
>> http://localhost:8080/messagebroker/websocket-amf";
>>
>>                          destination="genericService">
>>
>>             <mx:method name="findWithNamedQuery">
>>
>>             </mx:method>
>>
>>          </mx:RemoteObject>
>>
>>
>>
>>
>>
>> When running the program on my development pc my server is localhost. So
>> it works fine. When I deploy to the test server, the above configuration
>> will not work. I have to adjust the ip address to be something like this
>>
>>
>>
>>  <mx:RemoteObject id="serviceDAO"
>>
>>                          endpoint="
>> http://192.68.43.22:8080/spaciofm/messagebroker/websocket-amf";
>>
>>                          destination="genericService">
>>
>>             <mx:method name="findWithNamedQuery">
>>
>>             </mx:method>
>>
>>          </mx:RemoteObject>
>>
>>
>>
>>
>>
>> If I do this, it works.
>>
>>
>>
>> My guess is that there should be a way to configure the end point such
>> that it defaults to the server host name without any configuration.
>>
>>
>>
>> Regards,
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Oct 18, 2021 at 8:49 PM Brian Raymes <[email protected]>
>> wrote:
>>
>> Hi Roman,
>>
>>
>>
>> I do this by running a local instance of Nginx that proxies to my backend
>> (or wherever you need as it’s easily changeable).
>>
>>
>>
>> As for RPC configuration, I have mine all set relatively, as-in, simply:
>>
>>
>>
>> AMFChannel("my-amf", "messagebroker/amf");
>>
>>
>>
>> This way, they always look local, but proxy through Nginx to any server I
>> need throughout the development/test process.
>>
>>
>>
>> By doing it this way, I never have to modify a build. They just work in
>> call cases, whether that be local for development, or remote when deployed.
>>
>>
>>
>> If you need any config assistance for Nginx, let me know.
>>
>>
>>
>> Regards,
>>
>> Brian
>>
>>
>>
>> *From:* Roman Isitua <[email protected]>
>> *Sent:* Monday, October 18, 2021 9:23 AM
>> *To:* [email protected]
>> *Subject:* [EXTERNAL] Configuring rpc end points in royale
>>
>>
>>
>> Hi,
>>
>>
>>
>> In an app, I am working on. I am using rpc based end points to access my
>> back end. On my development machine I use localhost. I intend to start
>> deploying the the app to a test server for testing. I realise that each
>> time, I do a deployment to the test server, I have to remember to switch
>> from local host to the ip address of the test server. I do this via the
>> beans.mxml configuration files. (I am using crux). Sometimes I forget to do
>> this,  so I have to redeploy again.
>>
>>
>>
>> My question is, is there a better way to configure my rpc end points such
>> that I don't have to be changing ip addresses of the rpc end points in the
>> beans.mxml file ?
>>
>>
>>
>> Once testing is done, the app will be moved to production, again, ip
>> addresses will change.
>>
>>
>>
>> What is the best practice for configuring rpc end points in royale ?
>>
>>
>>
>> Is there a way to store deployment environments specific configurations  ?
>>
>>
>>
>>
>>
>> Regards,
>>
>>

Reply via email to