Changing the Default Play Framework HTTP Port (without Using System Property) - scala

There's an oft-asked question about changing the HTTP port to which a Play application will bind. James Ward's answer is generally accepted as the most complete, but it involves overriding the default by setting a http.port system property. However, is it possible to change this default without having to manually add it to the run command at development time, tweak the environment, or package an override in a runtime configuration?

This can be accomplished by setting the playDefaultPort key, as follows:
import PlayKeys._
playDefaultPort := 9123
Afterwards, you'll be able to run and testProd without needing to remember the desired port.
This works in both development:
$ sbt run
[info] Loading project definition from /Users/michaelahlers/Projects/MyApp/project
[info] Set current project to MyApp (in build file:/Users/michaelahlers/Projects/MyApp/)
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9123
(Server started, use Ctrl+D to stop and go back to the console...)
And production modes:
$ sbt testProd
[info] Loading project definition from /Users/michaelahlers/Projects/MyApp/project
[info] Set current project to MyApp (in build file:/Users/michaelahlers/Projects/MyApp/)
[info] Packaging /Users/michaelahlers/Projects/MyApp/target/scala-2.11/MyApp_2.11-1.0.0-SNAPSHOT-web-assets.jar ...
[info] Done packaging.
(Starting server. Type Ctrl+D to exit logs, the server will remain in background)
2016-04-08 13:09:45,594 [info] a.e.s.Slf4jLogger - Slf4jLogger started
2016-04-08 13:09:45,655 [info] play.api.Play - Application started (Prod)
2016-04-08 13:09:45,767 [info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9123

Related

OSRM Extract Silently Fails

I'm trying to setup a OSRM backend server using Docker. The host machine is a MacBook Pro with 32GB RAM running OS 10.14 (Mojave).
Having downloaded the england-latest.osm.pbf file I've tried to start the process with the following command.
docker run -t -v $(pwd):/data osrm/osrm-backend osrm-extract -p /opt/car.lua /data/england-latest.osm.pbf
The output is as follows:
[info] Parsed 0 location-dependent features with 0 GeoJSON polygons
[info] Using script /opt/car.lua
[info] Input file: england-latest.osm.pbf
[info] Profile: car.lua
[info] Threads: 6
[info] Parsing in progress..
[info] input file generated by osmium/1.8.0
[info] timestamp: 2018-11-02T21:15:02Z
[info] Using profile api version 4
[info] Found 3 turn restriction tags:
[info] motorcar
[info] motor_vehicle
[info] vehicle
[info] Parse relations ...
[info] Parse ways and nodes ...
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
[info] Using profile api version 4
At this point the process silently fails and doesn't write any of the files you'd expect. If I use the greater-london-latest.osm.pbf file then everything works fine so I'm guessing it's some sort of memory constraint. How do I go about identifying the problem and fixing it?
After running into the same issue on my Mac, I solved it by increasing the memory available to Docker. Look for the whale icon on the menubar, click then select Preferences > Advanced. Change the slider to a higher amount, press Apply & Restart, then try running again.
https://docs.docker.com/docker-for-mac/#memory
I could run within the 2GB default limit with a 415MB file (Canada > British Columbia) but nothing larger. Given the England file is 422MB, you can probably increase to 4GB and have it work. (Trying to run for all of Canada, a 2.4GB file, needed >8GB of RAM.)

Can't find Raspberry_pi section (rpi gpio ) in node-red after an update

i used node red to control a led from a local server I had a section in nodes called "Raspberry_Pi" where i could add rpi gpio output/input and other interesting stuff
Howerver after upadating node red => "update-nodejs-and-nodered" I couldnt find this section.
Rpi gpio is correctly installed in my machine but the problem is i cant access it from node red The question is How to access Rpi gpio/mouse/keyboard/..... from node red ?
Start Up log
Start Node-RED
Once Node-RED has started, point a browser at http://192.168.1.5:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
To find more nodes and example flows - go to http://flows.nodered.org
3 May 19:29:02 - [info]
Welcome to Node-RED
===================
3 May 19:29:02 - [info] Node-RED version: v0.16.2
3 May 19:29:02 - [info] Node.js version: v6.10.3
3 May 19:29:02 - [info] Linux 4.9.24-v7+ arm LE
3 May 19:29:03 - [info] Loading palette nodes
3 May 19:29:07 - [info] Settings file : /root/.node-red/settings.js
3 May 19:29:07 - [info] User directory : /root/.node-red
3 May 19:29:07 - [info] Flows file : /root/.node-red/flows_ziedpi.json
3 May 19:29:08 - [info] Server now running at http://127.0.0.1:1880/
3 May 19:29:08 - [info] Starting flows
3 May 19:29:08 - [info] Started flows

why does server with play framework shutdown abnormally

Our server backend is with play framework. During developing it seems everything is OK until we deploy it to production environment.
In production environment, the server just shutdown without any errors/warnings in logs. The last logs is like below:
2016-03-16 10:15:44,866 - [INFO] - from application in
ForkJoinPool-2-worker-1 ReactiveMongoApi stopping... 2016-03-16
10:15:44,903 - [INFO] - from application in ForkJoinPool-2-worker-3
ReactiveMongoApi connections stopped. [Success(Closed)] 2016-03-16
10:15:44,958 - [INFO] - from
play.api.libs.concurrent.ActorSystemProvider in
ForkJoinPool-2-worker-1 Shutdown application default Akka system:
application
My question is: in which case would play shutdown itself? Why there is no error messages? Where should I check into first?
Thanks in advance.

Playframework running but not able to be accessed on 127.0.0.1

I have downloaded playframework from its official website https://playframework.com/ and tried following:
activator new [appname](It has downloaded all the jar files and went through well)
on activator ui it says
Play server process ID is 4419
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /127.0.0.1:8888
[info] a.e.s.Slf4jLogger - Slf4jLogger started
but however I am not access it on 127.0.0.1:8888. please help.
Thank in adv.
Play defaults to port 9000 - what you're seeing on port 8888 is activator.
Go to http://127.0.0.1:9000 - if it doesn't work, it's because you're not running your Play app.
Either...
Go the the Run view the activator app in your browser (http://127.0.0.1:8888) and cilck the Run button. If you do this, you will see the following (or similar) in the browser:
Setting up Play fork run ... (use Ctrl+D to cancel)
--- (Running the application, auto-reloading is enabled) ---
p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
Or, run activator in console mode (on the command line, go to your Play app directory and type activator without ui). When it starts up, type run. You will see the following (or similar):
--- (Running the application, auto-reloading is enabled) ---
[info] p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
You can now go to http://127.0.0.1:9000 to see your app.

Cannot engage module rampart, not sending security details

I'm using eclipse with WTP plugin for creating a client to call secure web service.
I have used web service client wizard to generate the client and now I want to configure apache rampart in the eclipse project to call the service protected with username token
the error is "can not engage module rampart".
-------- update ----
After getting the cannot engage module rampart corrected, I'm getting folllowing:
[INFO] Deploying module: addressing-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/addressing-1.5.2.mar
[INFO] Deploying module: metadataExchange-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/mex-1.5.2.mar
[INFO] Deploying module: mtompolicy-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/mtompolicy-1.5.2.mar
[INFO] Deploying module: ping-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/ping-1.5.2.mar
[INFO] Deploying module: rampart-1.4 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/rampart-1.4.mar
[INFO] Deploying module: script-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/scripting-1.5.2.mar
[INFO] Deploying module: soapmonitor-1.5.2 - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/modules/soapmonitor-1.5.2.mar
[INFO] Deploying Web service: version.aar - file:/E:/Source Code Evaluations/axis2Codes/myAxisClient/WebContent/WEB-INF/services/version.aar
[INFO] Unable to sendViaPost to url[https://192.168.9.120:9443/services/HelloService.HelloServiceHttpsEndpoint/]
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
_----------------------------------- update end -------------------
thanks in advance
You probably not copied rampart-1.5.mar (or newer) to axis2 modules directory.
In cases when you are not using axis repositories for development and using eclipse, you don't need to manually engage the module, you can just place the rampar and rahas jars to class path and it will work fine.
Thanks
I had to do something similar.
I set my stub to point to a local http address instead of the remote webservice, ie:
"http://localhost:88/onca/soap3"
I then used TCPMon to check what was being set
Listen # 88
Target HostName 127.0.0.1
TargetPort 8080
This let me confirm that the SOAP request I was sending was what I expected.
I also copied the request into SOAP UI and checked it could be sent successfully from there.