Commit 800b7b0d authored by Luc Didry's avatar Luc Didry

Small changes and adding utilities files

* renaming ws-(client|server) scripts
* adding systemd service file
* adding nginx example file
parent d4c8b38a
......@@ -2,3 +2,5 @@ local/*
erco.conf
*.swp
exa.pid
script/hypnotoad.pid
!utilities/nginx/erco.conf
......@@ -20,7 +20,6 @@ doc:
$(AGLIO) -t $(AGLIO_THEME) -i $(API_MD) -o $(API_HTML)
test:
pgrep -f exabgp > $(ROOT_DIR)/exa.pid
$(CARTON) $(REAL_ERCO) test
dev:
......
#!/bin/bash
# vim:set sw=4 ts=4 sts=4 ft=sh expandtab:
# Get script real path
# Snippet from http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}"
while([ -h "${SCRIPT_PATH}" ])
do
cd "$(dirname "${SCRIPT_PATH}")"
SCRIPT_PATH="$(readlink "$(basename "${SCRIPT_PATH}")")"
done
cd "$(dirname "${SCRIPT_PATH}")" > /dev/null
REALPATH="$(pwd)";
popd > /dev/null
cd $REALPATH/../../
carton exec ./utilities/bin/exabgp-ws-client.pl
......@@ -49,7 +49,8 @@ my $prompt = '> ';
################
print <<EOF;
Welcome on ws-client.
Type 'help' to get some help, 'exit' or 'quit' to exit. Easy, isn't it ?
Type 'help' to get some help, 'exit' or 'quit' to exit.
Easy, isn't it?
EOF
while (defined(my $command = $term->readline($prompt))) {
......
#!/bin/bash
# vim:set sw=4 ts=4 sts=4 ft=sh expandtab:
trap '' SIGINT
# Get script real path
# Snippet from http://stackoverflow.com/questions/4774054/reliable-way-for-a-bash-script-to-get-the-full-path-to-itself
pushd . > /dev/null
SCRIPT_PATH="${BASH_SOURCE[0]}"
while([ -h "${SCRIPT_PATH}" ])
do
cd "$(dirname "${SCRIPT_PATH}")"
SCRIPT_PATH="$(readlink "$(basename "${SCRIPT_PATH}")")"
done
cd "$(dirname "${SCRIPT_PATH}")" > /dev/null
REALPATH="$(pwd)";
popd > /dev/null
cd $REALPATH/../../
export MOJO_LOG_LEVEL=info
export MOJO_LISTEN=http://127.0.0.1:3005
export MOJO_MODE=production
exec carton exec ./utilities/bin/exabgp-ws-server.pl daemon
......@@ -28,7 +28,7 @@ websocket '/' => sub {
$c->app->log->info($msg);
$ws->send($msg);
} else {
usleep 500;
usleep 750;
}
while (defined(my $msg = $io->getline)) {;
chomp $msg;
......@@ -36,7 +36,7 @@ websocket '/' => sub {
$ws->send($msg);
# Be sure it's the end of the answer
usleep 500 if ($io->eof);
usleep 750 if ($io->eof);
}
$io->close;
}
......
#!/bin/bash
# vim:set sw=4 ts=4 sts=4 ft=sh expandtab:
REALPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $REALPATH/../../
carton exec ./utilities/bin/ws-client.pl
#!/bin/bash
# vim:set sw=4 ts=4 sts=4 ft=sh expandtab:
trap '' SIGINT
REALPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $REALPATH/../../
export MOJO_LOG_LEVEL=info
export MOJO_LISTEN=http://127.0.0.1:3005
export MOJO_MODE=production
exec carton exec ./utilities/bin/ws-server.pl daemon
[Unit]
Description=Erco
Requires=network.target
After=network.target
[Service]
Type=simple
RemainAfterExit=yes
WorkingDirectory=/opt/erco/
PIDFile=/opt/erco/script/hypnotoad.pid
ExecStart=/usr/local/bin/carton exec hypnotoad script/erco -f
ExecStop=/usr/local/bin/carton exec hypnotoad -s script/erco
ExecReload=/usr/local/bin/carton exec hypnotoad script/erco
[Install]
WantedBy=multi-user.target
server {
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl;
# listen [::]:443 ssl;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
index index.html;
server_name _your_server_name_;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment