Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ajay.Gov
    @ajay-gov
    @1-14x0r regarding running on heroku, please make sure you have a VM (preferably linux), install a JVM (8+). Once you have that you can follow the links sent by @freyadyu in the previous message
    Kara Rawson
    @1-14x0r
    i have run tbrough all the tutorial and can get the simple chat project and cookbook to work locally
    i have this successfully building and running on heroku on the default 9001 port
    Ajay.Gov
    @ajay-gov
    That's great :+1:
    Kara Rawson
    @1-14x0r
    heroku doesn't allow for static ports, so i guess my question is how to either map the dynamic port to the static port define in server.recon file
    honestly i think its more of an issue with how to network with heroku then swim itself, didn't know if anyone has gotten a server running in heroku before
    Ajay.Gov
    @ajay-gov
    yes it is a heroku issue i believe. We have only used ec2 and azure. Will heroku let you run the swim application on a privileged port like 80 or 443
    Also you can always modify the port you are listening to by changing the server.recon file. Here is the place to modify it in the tutorial app https://github.com/swimos/tutorial/blob/master/server/src/main/resources/server.recon#L5
    Once you modify it, you can re-run the application (./gradlew run) and it should bind to the port that you have specified
    tlecouffe
    @tlecouffe
    I've been reading and listening to podcasts on swim that talk about capabilities such as "And all you have to do is define what’s in your data and then SWIM builds a model for you, trains the model, and does the inference and prediction". I feel like i'm missing that so far in the Github repo and documentation so far. Any way I can be pointed in the right direction on that?
    Kara Rawson
    @1-14x0r
    @ajay-gov ty, im trying port 80 right now
    i get this error when using port 80
    Exception in thread "main" swim.io.StationException: java.net.SocketException: Permission denied
    at swim.io/swim.io.Endpoint.bindTcp(Endpoint.java:82)
    Ajay.Gov
    @ajay-gov
    Oh right, privileged ports are not accessible to java processes unless they are run as a root user. There is a way to work around it by running the following command: setcap 'cap_net_bind_service=+ep' /path/to/program
    In your case the path to the java binary. For jdk11 on our cloud machines we do the following:
    sudo setcap 'cap_net_bind_service=+ep' /usr/lib/jvm/java-11-oracle/bin/java
    Ajay.Gov
    @ajay-gov

    @tlecouffe Good question.
    By defining the data, we refer to modeling the WebAgents and the Lanes in the WebAgents along with the interactions between the WebAgents.
    You can invoke learning algorithms within the callback functions of specific lanes in the WebAgent. What Swim provides for you is the ability to continuously learn when new data is received.

    We have examples of this in our traffic app(https://traffic.swim.ai). You can see this by clicking on the red/yellow/green bands on the traffic lanes that are adjoining an intersection. A countdown timer will appear and it will indicate when the light will change. This is implemented by the code here: https://github.com/swimos/traffic/blob/master/server/src/main/java/swim/traffic/agent/IntersectionAgent.java#L285-L312

    We have also implemented a more sophisticated algorithm specifically a neural network algorithms to predict light changes. This is not available in the open source repo yet. We plan on making it available to the open source repo soon.

    tlecouffe
    @tlecouffe
    @ajay-gov Thanks!!
    Kara Rawson
    @1-14x0r
    @ajay-gov ty so much for that code, ill give that a try.
    Kara Rawson
    @1-14x0r
    okay so that stuff is blocked via heroku too
    what i see other java apps are allowing you to override the properties by passing in arguments like in spring boot '-Dserver.port=$PORT'
    Ajay.Gov
    @ajay-gov
    @1-14x0r that's too bad. Does heroku give you the static port that they have allowed when you deploy the VM? If so then can you can change the port value in the server.recon file with that port once you have deployed the VM?
    Kara Rawson
    @1-14x0r
    never
    sadly
    heroku assigns you one open port on a dyno when its spooled up
    and to answer your question, yes that is what i am working on today with gradle
    Ajay.Gov
    @ajay-gov
    Shoot ok. So we have a commandline property to read the recon file, so you can pass in your own version of the recon file for overrides. But unfortunately we don't have a way to read individual fields in the recon file like port numbers etc. from a commandline property
    Kara Rawson
    @1-14x0r
    yes, i was reviewing the sources and didnt see that
    having a port that changes is acceptable for the prototype
    it would be nice to be able to procedurally start the swim server via a Java class wrapper
    Ajay.Gov
    @ajay-gov
    it's a good feature to have especially since port numbers are quite dynamic in cloud environments
    Kara Rawson
    @1-14x0r
    quick question, has anyone tried to get this to work with spring boot?
    ty you again for our time and respose, much appreciated
    Ajay.Gov
    @ajay-gov
    Actually it is possible to start the Swim server via a Java class wrapper..in fact the BasicPlane (https://github.com/swimos/cookbook/blob/master/planes/src/main/java/swim/basic/BasicPlane.java#L66-L70) does exactly that. However the details are in the line (final Kernel kernel = ServerLoader.loadServer();) We will add some documentation deconstructing that line. If you'd like to dive into the details of how it is loaded it's here: https://github.com/swimos/swim/blob/master/swim-system-java/swim-mesh-java/swim.server/src/main/java/swim/server/ServerLoader.java#L44-L60
    Regarding springboot, we haven't tried it yet. We might do this at some point
    Kara Rawson
    @1-14x0r
    great, you read my mind, that was my next question.. ill dig around in those
    Ajay.Gov
    @ajay-gov

    @1-14x0r So we have a Custom ServerLoader to override ports. Here is the link to it: https://gist.github.com/ajay-gov/408ab8fbc252419f8a481f2231ecf677. The line that changes the port is here : https://gist.github.com/ajay-gov/408ab8fbc252419f8a481f2231ecf677#file-myserverloader-L109-L113. This assumes that the property name passed into the java class is 'port'

    So give this new ServerLoader you have to do the following:

    1. Change the Plane code to use the new server loader in your Plane class. So change the line here (https://github.com/swimos/cookbook/blob/master/planes/src/main/java/swim/basic/BasicPlane.java#L66) to be:
      final Kernel kernel = MyServerLoader.loadServer();
    2. If you are running from gradle then you need to pass the System property to the gradle run task. Unfortunately gradle doesn't do this by default. So add the following line to the gradle run task: (using this as an example gradle file: https://github.com/swimos/cookbook/blob/master/planes/build.gradle#L59)
      systemProperties System.getProperties(). So the run task would look like this:
    run {
        dependsOn jar
        systemProperties System.getProperties()
        doFirst {
          jvmArgs += [
            '--module-path', files(configurations.runtimeClasspath, jar.archivePath).asPath,
            '--module', "${moduleName}/${mainClassName}"
          ]
          classpath = files()
        }
      }
    To run it you would do: ./gradlew run -Dport=$PORT. I hope Heroku lets u access the port from the commandline.
    Kara Rawson
    @1-14x0r
    ty for the info, yes this in the only place, im testing all possible vectors now, but im pretty sure its the only place
    Ajay.Gov
    @ajay-gov
    looks like heroku is using uppercase for the port system property, so please change the code here (https://gist.github.com/ajay-gov/408ab8fbc252419f8a481f2231ecf677#file-myserverloader-L110) to use "PORT" instead of "port"
    Kara Rawson
    @1-14x0r
    you have to use Procfile to define custom CLI
    Kara Rawson
    @1-14x0r
    the problem is with how heroky handles gradle
    it always autodetects the buildpack, and autogenerates a command, regardless if you soecify a procfil
    Ajay.Gov
    @ajay-gov
    @1-14x0r can u share with us the command it generates?
    Ajay.Gov
    @ajay-gov
    @1-14x0r It seems that heroku runs the task: 'gradle stage' command if it doesn't recognize the framework you are using which is what it's doing for swim apps I think. Can you confirm?
    it seems that you can override this by setting a config variable GRADLE_TASK. So can you try setting this in the config var to the following and give it a try:
    heroku config:set GRADLE_TASK="run -Dport=$PORT"
    We are basing this on what we read here: https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#the-procfile
    Kara Rawson
    @1-14x0r
    thank you i will test that out today
    tlecouffe
    @tlecouffe
    Hi.. Is there documentation available describing how to deploy to azure iot edge? Back in July there was an indication that it was coming.. Just curious if that's out there yet? Thanks!
    Scott Clarke
    @scottswim
    @tlecouffe Hi Tyler, we're currently in the process of updating our Azure IoT offering in the Marketplace with a new example app and lots of documentation around it however we are still working through the azure approval process. That said, i would love you pass you over a link and hopefully get a bit of feedback from you on it. Can you pass along your email either here or emails us at developers@swim.ai and i will pass along the link to you? I think you will find the updates and new documentation to be much more helpful and i look forward to hearing what you think. As always, we are here to answer any questions you have.
    tlecouffe
    @tlecouffe
    That