Date   
Re: running the spring example

Rick Hightower
 

I feel inadequate. 
I have a 32GB NUC and a mac book pro.. beyond that AWS. :) 
I need to go shopping. 


On Tue, Apr 4, 2017 at 6:42 PM, David "Funcmaster D" Pollak <funcmaster-d@...> wrote:
I run Mesos via Vagrant on a 128gb workstation... :-)


On Tue, Apr 4, 2017, at 05:35 PM, Rick Hightower wrote:

That makes sense. 


What are you using to run mesos locally?

Do you use https://minimesos.org/?

I have used DC/OS (mesos distribution) running in AWS, and a few others. 

I have not had much luck (gave up really) running things with Vagrant. But MiniMesos looked encouraging. 

I was just wondering what your dev environment with Mesos looks like. 

Will I need to install DC/OS on AWS? or do you have a suggested env to run things on a Mac Book Pro laptop cirica 2015? :) 

Also are there any docs wrt any of these bits. 

BTW I dig the project. It makes a ton of sense. 





--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net




--
Rick Hightower
(415) 968-9037
Profile 

Re: running the spring example

David "Funcmaster D" Pollak
 

I run Mesos via Vagrant on a 128gb workstation... :-)


On Tue, Apr 4, 2017, at 05:35 PM, Rick Hightower wrote:

That makes sense. 


What are you using to run mesos locally?

Do you use https://minimesos.org/?

I have used DC/OS (mesos distribution) running in AWS, and a few others. 

I have not had much luck (gave up really) running things with Vagrant. But MiniMesos looked encouraging. 

I was just wondering what your dev environment with Mesos looks like. 

Will I need to install DC/OS on AWS? or do you have a suggested env to run things on a Mac Book Pro laptop cirica 2015? :) 

Also are there any docs wrt any of these bits. 

BTW I dig the project. It makes a ton of sense. 





--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

Re: running the spring example

Rick Hightower
 

That makes sense. 


What are you using to run mesos locally?

Do you use https://minimesos.org/?

I have used DC/OS (mesos distribution) running in AWS, and a few others. 

I have not had much luck (gave up really) running things with Vagrant. But MiniMesos looked encouraging. 

I was just wondering what your dev environment with Mesos looks like. 

Will I need to install DC/OS on AWS? or do you have a suggested env to run things on a Mac Book Pro laptop cirica 2015? :) 

Also are there any docs wrt any of these bits. 

BTW I dig the project. It makes a ton of sense. 

Re: running the spring example

David "Funcmaster D" Pollak
 

Okay... if you're running the "dev mode" container. You cannot upload code to the dev mode container. You can only connect to the dev mode container with funcatron.devshim.Register.register() That connects to port 54657 from your app.

In order to upload a JAR file, you have to run Funcatron in a Mesos cluster and then the wget stuff is valid.

The confusing thing that I have to fix is the Mesos cluster uses port 3000 on the Tron to upload and control the cluster. The dev mode container uses port 3000 for the http request port.

My suggestion is to follow the instructions at https://www.funcatron.org/master/funcatron/info/dev_intro.html including creating a new project from the Maven template.

Feel free/encouraged to open all kinds of issues related to usability. :-(


On Tue, Apr 4, 2017, at 05:13 PM, Rick Hightower wrote:

I understand. 


Ok... just to wrap my head around things a bit.

I decided to try to deploy the java (no spring) version.

I just might be doing something wrong.


Docker container for Funcatron is running as follows:

$ docker ps

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                        NAMES

26b03fca941c        funcatron/tron:v0.2.6   "/usr/bin/java -ja..."   51 minutes ago      Up 51 minutes       0.0.0.0:3000->3000/tcp, 0.0.0.0:54657->54657/tcp, 4000/tcp   reverent_williams 


I am in the github project folder for the java example. 

$ pwd

/Users/rick/funcatron/samples/java


As the readme states, I build 

$ mvn clean package

$ find . -name "*.jar"

./target/java_sample-0.1-SNAPSHOT-jar-with-dependencies.jar


./target/java_sample-0.1-SNAPSHOT.jar

Then deploy

$ wget -O - --post-file=target/java_sample-0.1-SNAPSHOT-jar-with-dependencies.jar      http://localhost:3000/api/v1/add_func

I get this:


--2017-04-04 17:01:17--  http://localhost:3000/api/v1/add_func

Resolving localhost... ::1, 127.0.0.1

Connecting to localhost|::1|:3000... connected.

HTTP request sent, awaiting response... 404 Not Found

2017-04-04 17:01:17 ERROR 404: Not Found.

This tells me that I am doing something wrong. 

Since I play a developer on TV, I guess I should go look for where this endpoint is bound in good old tron. 

Which is a bit of a challenge because my cloujure skills mostly equate to I know how to say the word cloujure. (Ok.. a bit more than this but...)

I found the route table in tron. 


(defn tron-routes
"Routes for Tron"
[state]
(-> (routes
(POST "/api/v1/enable" req (enable-func req state))
(POST "/api/v1/disable" req (disable-func req state))
(GET "/api/v1/stats" req (get-stats req state))
(GET "/api/v1/routes" req (get-routes req state))
(GET "/api/v1/known_funcs" req (get-known-funcs req state))
(GET "/api/v1/bundle/:sha" req (return-sha req state))
(POST "/api/v1/add_func"
req (upload-func-bundle req state)))
(wrap-json-response :pretty true :escape-non-ascii true)
rm-json/wrap-json-params
))


Hmm.. maybe ....no wait.. no clue. 






--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

Re: running the spring example

Rick Hightower
 

I understand. 


Ok... just to wrap my head around things a bit.

I decided to try to deploy the java (no spring) version.

I just might be doing something wrong.


Docker container for Funcatron is running as follows:

$ docker ps

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                        NAMES

26b03fca941c        funcatron/tron:v0.2.6   "/usr/bin/java -ja..."   51 minutes ago      Up 51 minutes       0.0.0.0:3000->3000/tcp, 0.0.0.0:54657->54657/tcp, 4000/tcp   reverent_williams 


I am in the github project folder for the java example. 

$ pwd

/Users/rick/funcatron/samples/java


As the readme states, I build 

$ mvn clean package

$ find . -name "*.jar"

./target/java_sample-0.1-SNAPSHOT-jar-with-dependencies.jar

./target/java_sample-0.1-SNAPSHOT.jar

Then deploy

$ wget -O - --post-file=target/java_sample-0.1-SNAPSHOT-jar-with-dependencies.jar      http://localhost:3000/api/v1/add_func

I get this:


--2017-04-04 17:01:17--  http://localhost:3000/api/v1/add_func

Resolving localhost... ::1, 127.0.0.1

Connecting to localhost|::1|:3000... connected.

HTTP request sent, awaiting response... 404 Not Found

2017-04-04 17:01:17 ERROR 404: Not Found.

This tells me that I am doing something wrong. 

Since I play a developer on TV, I guess I should go look for where this endpoint is bound in good old tron. 

Which is a bit of a challenge because my cloujure skills mostly equate to I know how to say the word cloujure. (Ok.. a bit more than this but...)

I found the route table in tron. 


(defn tron-routes
"Routes for Tron"
[state]
(-> (routes
(POST "/api/v1/enable" req (enable-func req state))
(POST "/api/v1/disable" req (disable-func req state))
(GET "/api/v1/stats" req (get-stats req state))
(GET "/api/v1/routes" req (get-routes req state))
(GET "/api/v1/known_funcs" req (get-known-funcs req state))
(GET "/api/v1/bundle/:sha" req (return-sha req state))
(POST "/api/v1/add_func"
req (upload-func-bundle req state)))
(wrap-json-response :pretty true :escape-non-ascii true)
rm-json/wrap-json-params
))


Hmm.. maybe ....no wait.. no clue. 


Re: running the spring example

David "Funcmaster D" Pollak
 

Okay... I've got some updating to do. :-)

This issue was reported privately by another user and there's some updated code that I have to push into the public repo.

I'm working on a related issue for JPA not initializing correctly. Hope to get both fixed and pushed up today.



On Tue, Apr 4, 2017, at 04:38 PM, Rick Hightower wrote:
I am trying to run the spring example. 

Tron is running!

$ docker ps

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                        NAMES

26b03fca941c        funcatron/tron:v0.2.6   "/usr/bin/java -ja..."   51 minutes ago      Up 51 minutes       0.0.0.0:3000->3000/tcp, 0.0.0.0:54657->54657/tcp, 4000/tcp   reverent_williams


From the IDE I try to run funcatron.java_spring_sample.Application

I am getting a NPE. 

With some debugging... 

The Map swagger is null.

Map swagger = ContextImpl.runOperation(Constants.GetSwaggerConst,
        new HashMap<>(),
        Logger.getAnonymousLogger(), Map.class);


The above sets swagger to null. 

Then later this line fails. Line 46.

fos.write(swagger.get("swagger").toString().getBytes("UTF-8"));

Then the rest of it gently rolls down hill. 

Disconnected from the target VM, address: '127.0.0.1:51045', transport: 'socket'
Exception in thread "main" java.lang.NullPointerException
at funcatron.java_spring_sample.Application.main(Application.java:46)
2017-04-04 16:15:18.485  INFO 49781 --- [       Thread-1] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1e16c0aa: startup date [Tue Apr 04 16:14:35 PDT 2017]; root of context hierarchy
2017-04-04 16:15:18.486  INFO 49781 --- [       Thread-1] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 2147483647
2017-04-04 16:15:18.488  INFO 49781 --- [       Thread-1] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown



What am I doing wrong?





--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

running the spring example

Rick Hightower
 

I am trying to run the spring example. 

Tron is running!

$ docker ps

CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                        NAMES

26b03fca941c        funcatron/tron:v0.2.6   "/usr/bin/java -ja..."   51 minutes ago      Up 51 minutes       0.0.0.0:3000->3000/tcp, 0.0.0.0:54657->54657/tcp, 4000/tcp   reverent_williams


From the IDE I try to run funcatron.java_spring_sample.Application

I am getting a NPE. 

With some debugging... 

The Map swagger is null.

Map swagger = ContextImpl.runOperation(Constants.GetSwaggerConst,
        new HashMap<>(),
        Logger.getAnonymousLogger(), Map.class);


The above sets swagger to null. 

Then later this line fails. Line 46.

fos.write(swagger.get("swagger").toString().getBytes("UTF-8"));

Then the rest of it gently rolls down hill. 

Disconnected from the target VM, address: '127.0.0.1:51045', transport: 'socket'
Exception in thread "main" java.lang.NullPointerException
at funcatron.java_spring_sample.Application.main(Application.java:46)
2017-04-04 16:15:18.485  INFO 49781 --- [       Thread-1] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1e16c0aa: startup date [Tue Apr 04 16:14:35 PDT 2017]; root of context hierarchy
2017-04-04 16:15:18.486  INFO 49781 --- [       Thread-1] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 2147483647
2017-04-04 16:15:18.488  INFO 49781 --- [       Thread-1] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown



What am I doing wrong?

Re: Spring-boot app on tron in devmode

David "Funcmaster D" Pollak
 

I've updated the Spring Boot sample documentation to make clear how to run your Spring Boot app in "devmode" (connected to a local Funcatron instance rather than uploaded to a Funcatron cluster running on Mesos/K8s): https://github.com/funcatron/samples/blob/master/java-spring/README.adoc

Hope this helps.


On Mon, Feb 6, 2017, at 08:14 AM, popikyardo wrote:

David, thanks for your reply!

>Why would you try to post to port 54657? When running in devmode, port 54657 is the port that your running app uses to talk to the Tron? 
I thought that 
port 54657 is a port which the tron is listening to accept the incoming uberJar files (isn't it?) 

I'll see if my app uses Register.register(). I plan to create a swagger2 doc manually and then use it in my main() method. I'll provide a detailed answer later (~5-6 hours)





--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

Re: Spring-boot app on tron in devmode

popikyardo
 

David, thanks for your reply!

>Why would you try to post to port 54657? When running in devmode, port 54657 is the port that your running app uses to talk to the Tron? 
I thought that 
port 54657 is a port which the tron is listening to accept the incoming uberJar files (isn't it?) 

I'll see if my app uses Register.register(). I plan to create a swagger2 doc manually and then use it in my main() method. I'll provide a detailed answer later (~5-6 hours)

Re: Spring-boot app on tron in devmode

David "Funcmaster D" Pollak
 




On Wed, Feb 1, 2017, at 03:27 AM, popikyardo wrote:

Hi!


Is it possible to publish the packaged spring-boot uberJar to the tron in devmode?

I do the following:

1) run docker container: 

docker run -ti --rm  -e TRON_1=--devmode -p 3000:3000 -p 54657:54657 funcatron/tron:v0.2.6

2) compile and package java-spring app from samples

3) do 

wget -O - --post-file=target/java_spring_sample-0.1-SNAPSHOT.jar http://localhost:54657/api/v1/add_func


Why would you try to post to port 54657? When running in devmode, port 54657 is the port that your running app uses to talk to the Tron? 

To run in DevMode, main sure your main() method invokes the Register.register() method (see https://github.com/funcatron/starter/blob/master/src/main/resources/archetype-resources/src/main/java/MyFunction.java#L108-L110)

When you run your app in the IDE, it will register with Funcatron and then you'll be able to access the app at http://localhost:3000



it fails with this result.

in the tron docker container I get the logs






--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

Re: Spring-boot app on tron in devmode

David "Funcmaster D" Pollak
 

Sorry for the delayed response.

I will look into this issue tomorrow Pacific time.


On Wed, Feb 1, 2017, at 06:27 AM, popikyardo wrote:

Hi!


Is it possible to publish the packaged spring-boot uberJar to the tron in devmode?

I do the following:

1) run docker container: 

docker run -ti --rm  -e TRON_1=--devmode -p 3000:3000 -p 54657:54657 funcatron/tron:v0.2.6

2) compile and package java-spring app from samples

3) do 

wget -O - --post-file=target/java_spring_sample-0.1-SNAPSHOT.jar http://localhost:54657/api/v1/add_func

it fails with this result.

in the tron docker container I get the logs






--
Funcatron, Simply Serverless http://funcatron.org
Lift, the simply functional web framework http://liftweb.net

Spring-boot app on tron in devmode

popikyardo
 

Hi!


Is it possible to publish the packaged spring-boot uberJar to the tron in devmode?

I do the following:

1) run docker container: 

docker run -ti --rm  -e TRON_1=--devmode -p 3000:3000 -p 54657:54657 funcatron/tron:v0.2.6

2) compile and package java-spring app from samples

3) do 

wget -O - --post-file=target/java_spring_sample-0.1-SNAPSHOT.jar http://localhost:54657/api/v1/add_func

it fails with this result.

in the tron docker container I get the logs


Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:WIP] By David Pollak <feeder.of.the.bears@...>:
85f404a25b23: Cleaned up some RabbitMQ on Mesos related logic

Modified: src/clojure/funcatron/tron/brokers/rabbitmq.clj

Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:WIP] By David Pollak <feeder.of.the.bears@...>:
cdfcda56a011: Added information about the RabbitMQ instance

Modified: src/clojure/funcatron/tron/core.clj

Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:WIP] By David Pollak <feeder.of.the.bears@...>:
9619b163c939: Added more Mesos service discovery

Modified: src/clojure/funcatron/tron/brokers/rabbitmq.clj
Modified: src/clojure/funcatron/tron/core.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj
Modified: src/clojure/funcatron/tron/substrate/mesos_substrate.clj
Modified: src/clojure/funcatron/tron/util.clj

Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:WIP] By David Pollak <feeder.of.the.bears@...>:
b68d9671a7b3: Treat environment variables prefixed with TRON_ as environment variables

Modified: src/clojure/funcatron/tron/core.clj

Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:WIP] By David Pollak <feeder.of.the.bears@...>:
3db9d0ed64e6: WIP for figuring out how to set up environment within a container

Added: doc/stuff_to_do.md
Modified: src/clojure/funcatron/tron/core.clj
Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/dev_mode.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/options.clj
Modified: src/clojure/funcatron/tron/util.clj

Updates to Github #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:master] By David Pollak <feeder.of.the.bears@...>:
30bfd3f7cc5d: Small changes to clean up the code

Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj


[tron] New branch WIP was created by dpp.

Github push to funcatron:tron #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:master] By David Pollak <feeder.of.the.bears@...>:
73f6bc3ce47a: Got the bundle management mostly working and got requests associated with a queue running from the front end all the way to the Runner and back again

Modified: doc/messages.md
Modified: src/clojure/funcatron/tron/core.clj
Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj
Modified: src/clojure/funcatron/tron/options.clj

Updates to Github #github

Funcatron Integration <funcatron@...>
 

1 New Commit:

[tron:Lifecycle] By David Pollak <feeder.of.the.bears@...>:
25a546175b99: Got the Lifecycle stuff working with Tron and Runner

Modified: doc/messages.md
Modified: src/clojure/funcatron/tron/brokers/inmemory.clj
Modified: src/clojure/funcatron/tron/brokers/rabbitmq.clj
Modified: src/clojure/funcatron/tron/brokers/shared.clj
Modified: src/clojure/funcatron/tron/core.clj
Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/dev_mode.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj
Modified: src/clojure/funcatron/tron/routers/jar_router.clj
Modified: src/clojure/funcatron/tron/substrate/mesos_substrate.clj
Modified: src/clojure/funcatron/tron/util.clj
Modified: test/funcatron/tron/util_test.clj


3 New Commits:

[tron:master] By David Pollak <feeder.of.the.bears@...>:
92ddefba2de0: WIP

Modified: project.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj


[tron:master] By David Pollak <feeder.of.the.bears@...>:
9ac09dec3c0e: WIP for getting major run modes into Lifecycles

Added: src/java/funcatron/abstractions/Lifecycle.java
Modified: project.clj
Modified: src/clojure/funcatron/tron/brokers/shared.clj
Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj
Modified: src/clojure/funcatron/tron/util.clj
Modified: src/java/funcatron/abstractions/ContainerSubstrate.java


[tron:master] By David Pollak <feeder.of.the.bears@...>:
25a546175b99: Got the Lifecycle stuff working with Tron and Runner

Modified: doc/messages.md
Modified: src/clojure/funcatron/tron/brokers/inmemory.clj
Modified: src/clojure/funcatron/tron/brokers/rabbitmq.clj
Modified: src/clojure/funcatron/tron/brokers/shared.clj
Modified: src/clojure/funcatron/tron/core.clj
Modified: src/clojure/funcatron/tron/modes/common.clj
Modified: src/clojure/funcatron/tron/modes/dev_mode.clj
Modified: src/clojure/funcatron/tron/modes/runner_mode.clj
Modified: src/clojure/funcatron/tron/modes/tron_mode.clj
Modified: src/clojure/funcatron/tron/routers/jar_router.clj
Modified: src/clojure/funcatron/tron/substrate/mesos_substrate.clj
Modified: src/clojure/funcatron/tron/util.clj
Modified: test/funcatron/tron/util_test.clj


[tron] The branch "Lifecycle" was deleted by dpp


[tron] The branch "manager" was deleted by dpp


[tron] The branch "WIP" was deleted by dpp