Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
failover-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
certo
failover-proxy
Commits
2c73cec0
Commit
2c73cec0
authored
May 20, 2019
by
Yuri Aksenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added auto configure for proxy url
parent
f440080c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
13 deletions
+83
-13
Makefile
Makefile
+16
-2
failover-proxy
failover-proxy
+41
-0
failover-proxy-init
failover-proxy-init
+25
-0
failoverProxy.conf
failoverProxy.conf
+0
-10
nginx.conf
nginx.conf
+1
-1
No files found.
Makefile
View file @
2c73cec0
all
:
all
:
failover-proxy-config
rm
/etc/nginx/nginx.conf
install
-v
-Dm644
failoverProxy.conf /etc/nginx/failoverProxy.conf
#
install -v -Dm644 failoverProxy.conf /etc/nginx/failoverProxy.conf
install
-v
-Dm644
nginx.conf
/etc/nginx/nginx.conf
@echo
"$$FAILOVER_CONFIG"
>
/etc/config/proxy
install
-v
-Dm755
failover-proxy
/usr/share/easycwmp/functions/failover-proxy
install
-v
-Dm755
failover-proxy-init
/usr/sbin/failover-proxy-init
sed
-i
'/^\[Service\]$$/a ExecStartPre=/usr/sbin/failover-proxy-init'
/lib/systemd/system/nginx.service
failover-proxy-config
:
define
FAILOVER_CONFIG
config
proxy
'failover'
option
address
''
endef
export
FAILOVER_CONFIG
failover-proxy
0 → 100755
View file @
2c73cec0
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list
=
"
$prefix_list
$DMROOT
.Proxy."
entry_execute_method_list
=
"
$entry_execute_method_list
entry_execute_method_root_Proxy"
entry_execute_method_list_forcedinform
=
"
$entry_execute_method_list_forcedinform
entry_execute_method_root_Proxy"
entry_execute_method_root_Proxy
()
{
case
"
$1
"
in
""
|
"
$DMROOT
."
|
"
$DMROOT
.Proxy."
*
)
common_execute_method_obj
"
$DMROOT
.Proxy."
"0"
common_execute_method_param
"
$DMROOT
.Proxy.Address"
"1"
"get_address"
"set_address"
return
0
;
;;
esac
return
$E_INVALID_PARAMETER_NAME
;
}
#######################################
# Data model parameters functions #
#######################################
get_address
()
{
echo
`
$UCI_GET
proxy.failover.address
`
}
set_address
()
{
local
address
=
`
$UCI_GET
proxy.failover.address
`
if
[
"
$address
"
!=
"
$1
"
]
;
then
$UCI_SET
proxy.failover.address
=
"
$1
"
$UCI_COMMIT
failover-proxy-init
systemctl restart nginx
fi
}
failover-proxy-init
0 → 100755
View file @
2c73cec0
#!/bin/sh
UCI_GET
=
"/sbin/uci -q get"
ADDRESS
=
`
$UCI_GET
proxy.failover.address
`
generate_config
()
{
#ADDRESS="10.1.1.1;10.1.1.2;10.1.1.3"
IFS
=
";"
read
-a
ADDRESSES
<<<
"
$ADDRESS
"
length
=
${#
ADDRESSES
[*]
}
config
=
"location / {proxy_intercept_errors on;proxy_pass
${
ADDRESSES
[0]
}
;error_page 403 404 = @fallback1;}"
for
((
i
=
1
;
i<
$length
-1
;
i++
))
;
do
config
=
"
$config
location @fallback
$i
{proxy_intercept_errors on;proxy_pass "
config
=
"
$config
${
ADDRESSES
[
$i
]
}
"
config
=
"
$config
;error_page 403 404 = @fallback
$((
i+1
))
;}"
done
config
=
"
$config
location @fallback
$i
{proxy_pass
${
ADDRESSES
[-1]
}
;}"
}
generate_config
if
[
!
-z
$ADDRESS
]
;
then
cat
<<
EOF
> /run/failoverProxy.conf
$config
EOF
fi
failoverProxy.conf
deleted
100644 → 0
View file @
f440080c
location
/ {
proxy_intercept_errors
on
;
proxy_pass
http
://
rgw
.
ceph
.
iszf
.
irk
.
ru
;
error_page
403
404
= @
fallback
;
}
location
@
fallback
{
proxy_pass
http
://
rgw
.
ceph
.
badary
.
iszf
.
irk
.
ru
;
}
nginx.conf
View file @
2c73cec0
...
...
@@ -16,7 +16,7 @@ http {
recursive_error_pages
on
;
include
failoverProxy.conf
;
include
/run/
failoverProxy.conf
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment