I am deploying my Flask application on WebFaction. I am using flask-socketio which has lead me to deploying it with a Custom Websocket App (listening on port). Flask-socketio's instructs me to deploy my app by starting the serving with the call socketio.run(app, port= < port_listening_on >) in my main python script. I have installed eventlet on the server so socketio.run should run the app on the eventlet web server.
I can call python < app >.py and all works great – server runs, can view it at the domain, sockets working, etc. My problems start when I attempt to turn this into a long running process. I've been advised to use supervisor which I have installed and configured on my webapp following these instructions: https://community.webfaction.com/questions/18483/how-do-i-install-and-use-supervisord-to-control-long-running-processes
The problem is once I actually add the command for supervisor to run my app it errors with:
Exited too quickly
My log states the above error as well as:
(exit status 1; not expected)
In my supervisor config file I currently have the following program config:
[program:<prog_name>]
command=/usr/bin/python2.7 /home/<user>/webapps/<app_name>/<app>.py
autostart=true
autorestart=true
I have tried a removing and adding settings but it all leads to the same FATAL error.
So this is what part of my supervisor config looks like, I'm using gunicorn to run my flask app.
Also, I'm logging errors to a file from the supervisor config, so if you do that, it might help you see why it's not starting correctly.
[program:gunicorn]
command=/juzten/venv/bin/gunicorn run:app --preload -p rocket.pid -b 0.0.0.0:5000 --access-logfile "-"
directory=/juzten/app-folder-name
user=juzten
autostart=true
autorestart=unexpected
stdout_logfile=/juzten/gunicorn.log
stderr_logfile=/juzten/gunicorn.log
Related
I try to run the server for ssa by using ssaserver& command but I face this error on my server machine
from yesterday.
Error creating listening socket at [host name : port number] the network address may be in use.
I really don't know why it is showing this error and how can be the address in use.
My OS is RedHat7.
That is really happen because you maybe closed your terminal or logged out from current user account in RedHat.
To solve this issue you can use this command here:
ps -ef|grep ssaserver
Which will show you if the service ssaserver already in use and from this you can get the service id and child ids.
You can then kill the service id by using kill command:
kill #(serviceid)
Here is a link to show you how to use kill command: Link_1
But you can face this problem again and again so I think it will be fine if you will use nohup command to run the service you need.
Note: nohup is a command used to run a process(job) on a server and have it continue after you have logged out or otherwise lost connection to the server
Such as:
nohup ssaserver&
Here is extra link for nohup examples: Link_2
telnet is necessary in order to maintain compatibility with older software in this case. I'm working with the Yocto Rocko 2.4.2 distribution. when I try to telnet to the board I'm getting the oh so detailed message "connection refused".
Using the method here and the options here I modified the busybox configuration per suggestion. When the board is booted up and logged in, if you execute: telnet, it spits out usage info and a quick directory check shows that telnet is installed to /usr/bin/telnet. My guess is that the telnet client is installed but the telnet server is not running?
I need to get telnetd to start manually at least so I know it will work with an init script in place. The second reference link there suggests that 'telnetd will not be started automatically though...' and that there will need to be an init script. How can I start telnetd manually for testing?
systemctl enable telnetd
returns: Unit telnetd.service could not be found
UPDATE
telnetd in located in /usr/sbin/telnetd. I was able to manually start the telnetd service for testing from there. After manually starting the service telnet login now works. looking into writing a systemd init script to auto start the telnetd service, so I suppose this issue is closed. unless anyone would like to offer up detailed telnet busybox configuration and setup steps as an answer to 'How to configure telnet service for yocto image'
update
Perhaps there is something more? I created a unit file that looks like this:
[Unit]
Description=auto start telnetd
[Service]
ExecStart=/usr/sbin/telnetd
[Install]
WantedBy=multi-user.target
on reboot, systemd indicates the process executed and succeeded:
systemctl status telnetd
.
.
.
Process: 466 ExecStart=/usr/sbin/telnetd (code=exited, status=0/SUCCESS)
.
.
.
The service is not running however. netstat -l does not list it and telnet login fails. Something I'm missing?
last update...i think
so following this post, I managed to get telnet.socket service to startup on reboot.
systemctl status telnet.socket
shows that it is running and listening on 23. Now however, when I try to remote in with telnet I'm getting
Connection closed by foreign host
Everything I've read so far has been talking about xinetd service (which I do not have...). What is confusing is that, if I just navigate to /usr/sbin/ and execute telnetd, the server is up and running and I can telnet into the board, so I do not believe I'm missing any utilities or services (like the above mentioned xinetd), but something is still not being configured correctly. any ideas?
Question: Is the sulley fuzz control supposed to update in real time?
background:
It apears that my procmon script is not recording crashes in the crashbin file. I have setup sulley fuzzing framework step by step with the install instructions however I am not able to see access violations within the fuzzer script output or the sulley web app. I am fuzzing a application given to me from a course and the application is crashing correctly. I have fuzzed multiple programs to test sulley and get many crashes however the debugger is not displaying access violations. I have sulley and paimei setup "perfectly" and can import all library's from each folder location and globally. here is a list of library's. My fuzz script is configured perfectly! All connections happen with all sulley scripts correctly and I get info, debug and warnings, I am using log level 10. My crashbin is not growing when the application crashes and I request any help to fix the issue.
scripts run on the fuzzed machine
python network_monitor.py -l 10 -d 0 -f "port 80" -P audits --port 26001
python process_monitor.py --port 26002 -l 10 -c audits/master_server.crashbin -p "application.exe"
pydasm,
pdbg
pcapy
impacket
sulley
tornado
flask
pedrpc
installation instructions
https://github.com/OpenRCE/sulley/wiki/Windows-Installation
following a guide I fuzzed the vulnserver LTER /.:AAA and below is an output of the PEDRPC results
As pythonanywhere is the one of best place to host python web app. And apps will be hosted as per wsgi.py configurations on it's own server. But what happens when I do something like this on its bash shell?
$ python manage.py runserver 127.0.0.1:9000
Performing system checks...
System check identified no issues (0 silenced).
April 28, 2016 - 15:29:48
Django version 1.9.5, using settings 'MyProject.settings'
Starting development server at http://127.0.0.1:9000/
Quit the server with CONTROL-C.
As you can see I had changed the port to :9000, so is there any way to access this or it's just meaningless as it's serving the app on served server service?
PythonAnywhere dev here. There's no way to access a server you run using manage.py runserver. It will try to bind to a local port, but that port isn't visible from outside the PythonAnywhere cluster.
[edit] Oh, and thank you for the kind words about PythonAnywhere!
I'm trying to deploy a play2 application with capistrano, but I can't figure out how to (re)start the play2 application after a successful deployment. Just triggering 'play start' will cause the process to be hanging waiting for me to press ctrl+D
I've created a start script in the play app root folder
#!/bin/bash
nohup bash -c "/var/lib/play2/play start &>> /tmp/myapp.log 2>&1" &> /dev/null &
It works great when I run this on the server. When I try to call this from my local machine over ssh it also works. But when I am using capistrano, it doesn't seem to do anything. My capistrano config looks like this:
namespace :deploy do
task :restart do
stop
sleep 1
start
end
task :start do
run "cd #{current_release}/trip-api && ./start.sh"
end
task :stop do
run "cd #{current_release}/trip-api && ./stop.sh"
end
end
What's the best way to start a play2 application on a remote machine? How to get it working with capistrano?
Have a look at play documentation on deploying your application on production
The recommended way is to package your app with
play clean compile stage
And then run it with
$ target/start
To stop it, have a look at the docs:
The server’s process id is displayed at bootstrap and written to the
RUNNING_PID file. To kill a running Play server, it is enough to send
a SIGTERM to the process to properly shutdown the application.
In this quickstart for Openshift, it shows another way to start play as a service and how to stop it.
basically you do something like this to start:
APP_COMMAND="${OPENSHIFT_REPO_DIR}target/start $PLAY_PARAMS "\
"-Dhttp.port=${OPENSHIFT_INTERNAL_PORT} "\
"-Dhttp.address=${OPENSHIFT_INTERNAL_IP} "\
"-Dconfig.resource=openshift.conf"
echo $APP_COMMAND &>> $LOG_FILE
nohup bash -c "${APP_COMMAND} &>> ${LOG_FILE} 2>&1" &> /dev/null &
and to stop it
pid=`cat RUNNING_PID`
echo "Stopping play application" >> $LOG_FILE
kill -SIGTERM $pid
There are few fresh topics about running application available at Google Groups:
Start an application as a background process
When deployed on Ubuntu 10.04 cant detach from console
It's good idea to follow or join them
I would suggest using runit. We are currently running a bunch of services in production and it works great.
It only involves creating a simple shell script named run, pointing runit to its containing directory and then start it. Services should not daemonize by themselves and runit controls pid files, etc.
There is a command ( sv ) to start, stop and query services. ( sv start|stop|status|restart yourapp ).
A cursory google search got me this http://rubygems.org/gems/capistrano-runit though I do not use capistrano at all so I can't vouch for it's usefulness.
http://smarden.org/runit/
The faq is the best place to start: http://smarden.org/runit/faq.html
In debian you just apt-get install runit and are good to go.
update-service --add /your/service/dir/ will register the service with runit.
On deployment we stop services, change binaries and start services; it is really simple.