mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Added haproxy files
This commit is contained in:
parent
3c01159451
commit
ec3646dcbe
4 changed files with 145 additions and 4 deletions
106
haproxy/files/haproxy.cfg
Normal file
106
haproxy/files/haproxy.cfg
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# Example configuration file for HAProxy 1.3, refer to the url below for
|
||||
# a full documentation and examples for configuration:
|
||||
# http://haproxy.1wt.eu/download/1.3/doc/configuration.txt
|
||||
|
||||
|
||||
# Global parameters
|
||||
global
|
||||
|
||||
# Log events to a remote syslog server at given address using the
|
||||
# specified facility and verbosity level. Multiple log options
|
||||
# are allowed.
|
||||
#log 10.0.0.1 daemon info
|
||||
|
||||
# Specifiy the maximum number of allowed connections.
|
||||
maxconn 32000
|
||||
|
||||
# Raise the ulimit for the maximum allowed number of open socket
|
||||
# descriptors per process. This is usually at least twice the
|
||||
# number of allowed connections (maxconn * 2 + nb_servers + 1) .
|
||||
ulimit-n 65535
|
||||
|
||||
# Drop privileges (setuid, setgid), default is "root" on OpenWrt.
|
||||
uid 0
|
||||
gid 0
|
||||
|
||||
# Perform chroot into the specified directory.
|
||||
#chroot /var/run/haproxy/
|
||||
|
||||
# Daemonize on startup
|
||||
daemon
|
||||
|
||||
nosplice
|
||||
# Enable debugging
|
||||
#debug
|
||||
|
||||
# Spawn given number of processes and distribute load among them,
|
||||
# used for multi-core environments or to circumvent per-process
|
||||
# limits like number of open file descriptors. Default is 1.
|
||||
#nbproc 2
|
||||
|
||||
|
||||
# Example HTTP proxy listener
|
||||
listen my_http_proxy
|
||||
|
||||
# Bind to port 81 and 444 on all interfaces (0.0.0.0)
|
||||
bind :81,:444
|
||||
|
||||
# We're proxying HTTP here...
|
||||
mode http
|
||||
maxconn 2
|
||||
|
||||
http-response add-header Keep-Alive 3000
|
||||
http-response add-header Connection keep-alive
|
||||
|
||||
# Simple HTTP round robin over two servers using the specified
|
||||
# source ip 192.168.1.1 .
|
||||
balance leastconn
|
||||
server juci localhost:80 source localhost
|
||||
|
||||
option http-server-close
|
||||
timeout http-keep-alive 3000
|
||||
|
||||
# Serve an internal statistics page on /stats:
|
||||
stats enable
|
||||
stats uri /stats
|
||||
|
||||
# Enable HTTP basic auth for the statistics:
|
||||
stats realm HA_Stats
|
||||
stats auth username:password
|
||||
|
||||
|
||||
# Example SMTP proxy listener
|
||||
listen my_smtp_proxy
|
||||
|
||||
# Disable this instance without commenting out the section.
|
||||
disabled
|
||||
|
||||
# Bind to port 26 and 588 on localhost
|
||||
bind 127.0.0.1:26,127.0.0.1:588
|
||||
|
||||
# This is a TCP proxy
|
||||
mode tcp
|
||||
|
||||
# Round robin load balancing over two servers on port 123 forcing
|
||||
# the address 192.168.1.1 and port 25 as source.
|
||||
balance roundrobin
|
||||
#use next line for transparent proxy, so the servers can see the
|
||||
#original ip-address and remove source keyword in server definition
|
||||
#source 0.0.0.0 usesrc clientip
|
||||
server server01 192.168.1.10:123 source 192.168.1.1:25
|
||||
server server02 192.168.1.20:123 source 192.168.1.1:25
|
||||
|
||||
|
||||
# Special health check listener for integration with external load
|
||||
# balancers.
|
||||
listen local_health_check
|
||||
|
||||
# Listen on port 60000
|
||||
bind :60000
|
||||
|
||||
# This is a health check
|
||||
mode health
|
||||
|
||||
# Enable HTTP-style responses: "HTTP/1.0 200 OK"
|
||||
# else just print "OK".
|
||||
#option httpchk
|
||||
8
haproxy/files/haproxy.hotplug
Normal file
8
haproxy/files/haproxy.hotplug
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$ACTION" = add ]; then
|
||||
|
||||
/etc/init.d/haproxy enabled && \
|
||||
/etc/init.d/haproxy start
|
||||
fi
|
||||
|
||||
25
haproxy/files/haproxy.init
Normal file
25
haproxy/files/haproxy.init
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
|
||||
START=99
|
||||
STOP=80
|
||||
|
||||
SERVICE_USE_PID=1
|
||||
|
||||
HAPROXY_BIN="/usr/sbin/haproxy"
|
||||
HAPROXY_CONFIG="/etc/haproxy.cfg"
|
||||
HAPROXY_PID="/var/run/haproxy.pid"
|
||||
|
||||
start() {
|
||||
service_start $HAPROXY_BIN -q -D -f "$HAPROXY_CONFIG" -p "$HAPROXY_PID"
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill -9 $(cat $HAPROXY_PID | tr "\n" " ")
|
||||
service_stop $HAPROXY_BIN
|
||||
}
|
||||
|
||||
reload() {
|
||||
$HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID | tr "\n" " ")
|
||||
#$HAPROXY_BIN -D -q -f $HAPROXY_CONFIG -p $HAPROXY_PID -sf $(cat $HAPROXY_PID)
|
||||
}
|
||||
|
|
@ -93,7 +93,7 @@ static const struct blobmsg_policy host_policy[__HOST_MAX] = {
|
|||
[IP_ADDR] = { .name = "ipaddr", .type = BLOBMSG_TYPE_STRING },
|
||||
[MAC_ADDR] = { .name = "macaddr", .type = BLOBMSG_TYPE_STRING },
|
||||
};
|
||||
|
||||
/*
|
||||
enum {
|
||||
PIN,
|
||||
__PIN_MAX,
|
||||
|
|
@ -102,7 +102,7 @@ enum {
|
|||
|
||||
static const struct blobmsg_policy pin_policy[__PIN_MAX] = {
|
||||
[PIN] = { .name = "pin", .type = BLOBMSG_TYPE_STRING },
|
||||
};
|
||||
};*/
|
||||
/* END POLICIES */
|
||||
|
||||
pthread_t tid[1];
|
||||
|
|
@ -1737,7 +1737,7 @@ static struct ubus_method router_object_methods[] = {
|
|||
UBUS_METHOD_NOARG("boardinfo", quest_board_info),
|
||||
UBUS_METHOD("quest", quest_router_specific, quest_policy),
|
||||
UBUS_METHOD_NOARG("networks", quest_router_networks),
|
||||
UBUS_METHOD_NOARG("dslstats", dslstats_rpc),
|
||||
//UBUS_METHOD_NOARG("dslstats", dslstats_rpc),
|
||||
UBUS_METHOD("client", quest_router_network_clients, network_policy),
|
||||
UBUS_METHOD_NOARG("clients", quest_router_clients),
|
||||
UBUS_METHOD_NOARG("clients6", quest_router_clients6),
|
||||
|
|
@ -1766,6 +1766,7 @@ static struct ubus_object router_object = {
|
|||
/* END OF ROUTER OBJECT */
|
||||
|
||||
/* WPS OBJECT */
|
||||
/* MOVED to juci
|
||||
|
||||
static int
|
||||
wps_status(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
|
|
@ -1963,6 +1964,7 @@ static struct ubus_object wps_object = {
|
|||
.methods = wps_object_methods,
|
||||
.n_methods = ARRAY_SIZE(wps_object_methods),
|
||||
};
|
||||
*/
|
||||
/* END OF WPS OBJECT */
|
||||
|
||||
static void
|
||||
|
|
@ -2022,7 +2024,7 @@ quest_ubus_init(const char *path)
|
|||
quest_ubus_add_fd();
|
||||
|
||||
quest_add_object(&router_object);
|
||||
quest_add_object(&wps_object);
|
||||
//quest_add_object(&wps_object);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue