forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created install scripts and RPM builds
- Loading branch information
1 parent
f9885a3
commit cfc92db
Showing
18 changed files
with
597 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"listen_port": LISTEN_PORT, | ||
"secret": "352d20ee67be67f6340b4c0605b044b7", | ||
"template_path": "/opt/tyk-gateway/templates", | ||
"tyk_js_path": "/opt/tyk-gateway/js/tyk.js", | ||
"use_db_app_configs": false, | ||
"app_path": "/opt/tyk-gateway/apps", | ||
"middleware_path": "/opt/tyk-gateway/middleware", | ||
"storage": { | ||
"type": "redis", | ||
"host": "REDIS_HOST", | ||
"port": REDIS_PORT, | ||
"username": "", | ||
"password": "REDIS_PASSWORD", | ||
"database": 0, | ||
"optimisation_max_idle": 500, | ||
"optimisation_max_active": 800 | ||
}, | ||
"enable_analyti`s": false, | ||
"analytics_config": { | ||
"type": "csv", | ||
"csv_dir": "/tmp", | ||
"mongo_url": "", | ||
"mongo_db_name": "", | ||
"mongo_collection": "", | ||
"purge_delay": -1, | ||
"ignored_ips": [] | ||
}, | ||
"health_check": { | ||
"enable_health_checks": true, | ||
"health_check_value_timeouts": 60 | ||
}, | ||
"optimisations_use_async_session_write": true, | ||
"allow_master_keys": false, | ||
"policies": { | ||
"policy_source": "file", | ||
"policy_record_name": "policies" | ||
}, | ||
"hash_keys": true, | ||
"suppress_redis_signal_reload": false, | ||
"close_connections": true, | ||
"local_session_cache": { | ||
"disable_cached_session_state": true | ||
}, | ||
"uptime_tests": { | ||
"disable": false, | ||
"config": { | ||
"enable_uptime_analytics": false, | ||
"failure_trigger_sample_size": 3, | ||
"time_wait": 300, | ||
"checker_pool_size": 50 | ||
} | ||
}, | ||
"hostname": "TYK_GATEWAY_DOMAIN", | ||
"enable_custom_domains": true, | ||
"enable_jsvm": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"listen_port": LISTEN_PORT, | ||
"secret": "352d20ee67be67f6340b4c0605b044b7", | ||
"template_path": "/opt/tyk-gateway/templates", | ||
"tyk_js_path": "/opt/tyk-gateway/js/tyk.js", | ||
"use_db_app_configs": true, | ||
"app_path": "/opt/tyk-gateway/apps", | ||
"middleware_path": "/opt/tyk-gateway/middleware", | ||
"storage": { | ||
"type": "redis", | ||
"host": "REDIS_HOST", | ||
"port": REDIS_PORT, | ||
"username": "", | ||
"password": "REDIS_PASSWORD", | ||
"database": 0, | ||
"optimisation_max_idle": 500, | ||
"optimisation_max_active": 800 | ||
}, | ||
"enable_analyti`s": true, | ||
"analytics_config": { | ||
"type": "mongo", | ||
"csv_dir": "/tmp", | ||
"mongo_url": "MONGO_URL", | ||
"mongo_db_name": "", | ||
"mongo_collection": "tyk_analytics", | ||
"purge_delay": 5, | ||
"ignored_ips": [] | ||
}, | ||
"health_check": { | ||
"enable_health_checks": true, | ||
"health_check_value_timeouts": 60 | ||
}, | ||
"optimisations_use_async_session_write": true, | ||
"allow_master_keys": false, | ||
"policies": { | ||
"policy_source": "mongo", | ||
"policy_record_name": "tyk_policies" | ||
}, | ||
"hash_keys": true, | ||
"suppress_redis_signal_reload": false, | ||
"close_connections": true, | ||
"local_session_cache": { | ||
"disable_cached_session_state": true | ||
}, | ||
"uptime_tests": { | ||
"disable": false, | ||
"config": { | ||
"enable_uptime_analytics": true, | ||
"failure_trigger_sample_size": 3, | ||
"time_wait": 300, | ||
"checker_pool_size": 50 | ||
} | ||
}, | ||
"hostname": "TYK_GATEWAY_DOMAIN", | ||
"enable_custom_domains": true, | ||
"enable_jsvm": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
echo "Init local setup to domain: $1" | ||
sudo /opt/tyk-gateway/install/setup.sh --dashboard=1 --listenport=8080 --redishost=localhost --redisport=6379 --domain=$1 --mongo=mongodb://localhost/tyk_analytics |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
systemctl --system daemon-reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Tyk API Gateway | ||
|
||
[Service] | ||
Type=simple | ||
User=root | ||
Group=root | ||
ExecStart=/opt/tyk-gateway/tyk --conf=/opt/tyk-gateway/tyk.conf | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
user="root" | ||
group="root" | ||
chroot="/" | ||
chdir="/" | ||
nice="" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
#!/bin/sh | ||
# Init script for tyk-gateway | ||
# Maintained by | ||
# Generated by pleaserun. | ||
# Implemented based on LSB Core 3.1: | ||
# * Sections: 20.2, 20.3 | ||
# | ||
### BEGIN INIT INFO | ||
# Provides: tyk-gateway | ||
# Required-Start: $remote_fs $syslog | ||
# Required-Stop: $remote_fs $syslog | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: | ||
# Description: no description given | ||
### END INIT INFO | ||
|
||
PATH=/sbin:/usr/sbin:/bin:/usr/bin | ||
export PATH | ||
|
||
name=tyk-gateway | ||
program=/opt/tyk-gateway/tyk | ||
args='--conf=/opt/tyk-gateway/tyk.conf' | ||
pidfile="/var/run/$name.pid" | ||
|
||
[ -r /etc/default/$name ] && . /etc/default/$name | ||
[ -r /etc/sysconfig/$name ] && . /etc/sysconfig/$name | ||
|
||
trace() { | ||
logger -t "/etc/init.d/tyk-gateway" "$@" | ||
} | ||
|
||
emit() { | ||
trace "$@" | ||
echo "$@" | ||
} | ||
|
||
start() { | ||
|
||
# Ensure the log directory is setup correctly. | ||
[ ! -d "/var/log/" ] && mkdir "/var/log/" | ||
chown "$user":"$group" "/var/log/" | ||
chmod 755 "/var/log/" | ||
|
||
|
||
# Setup any environmental stuff beforehand | ||
|
||
|
||
# Run the program! | ||
|
||
chroot --userspec "$user":"$group" "$chroot" sh -c " | ||
cd \"$chdir\" | ||
exec \"$program\" $args | ||
" >> /var/log/tyk-gateway.stdout 2>> /var/log/tyk-gateway.stderr & | ||
|
||
# Generate the pidfile from here. If we instead made the forked process | ||
# generate it there will be a race condition between the pidfile writing | ||
# and a process possibly asking for status. | ||
echo $! > $pidfile | ||
|
||
emit "$name started" | ||
return 0 | ||
} | ||
|
||
stop() { | ||
# Try a few times to kill TERM the program | ||
if status ; then | ||
pid=$(cat "$pidfile") | ||
trace "Killing $name (pid $pid) with SIGTERM" | ||
kill -TERM $pid | ||
# Wait for it to exit. | ||
for i in 1 2 3 4 5 ; do | ||
trace "Waiting $name (pid $pid) to die..." | ||
status || break | ||
sleep 1 | ||
done | ||
if status ; then | ||
emit "$name stop failed; still running." | ||
else | ||
emit "$name stopped." | ||
fi | ||
fi | ||
} | ||
|
||
status() { | ||
if [ -f "$pidfile" ] ; then | ||
pid=$(cat "$pidfile") | ||
if ps -p $pid > /dev/null 2> /dev/null ; then | ||
# process by this pid is running. | ||
# It may not be our pid, but that's what you get with just pidfiles. | ||
# TODO(sissel): Check if this process seems to be the same as the one we | ||
# expect. It'd be nice to use flock here, but flock uses fork, not exec, | ||
# so it makes it quite awkward to use in this case. | ||
return 0 | ||
else | ||
return 2 # program is dead but pid file exists | ||
fi | ||
else | ||
return 3 # program is not running | ||
fi | ||
} | ||
|
||
force_stop() { | ||
if status ; then | ||
stop | ||
status && kill -KILL $(cat "$pidfile") | ||
fi | ||
} | ||
|
||
|
||
case "$1" in | ||
force-start|start|stop|force-stop|restart) | ||
trace "Attempting '$1' on tyk-gateway" | ||
;; | ||
esac | ||
|
||
case "$1" in | ||
force-start) | ||
PRESTART=no | ||
exec "$0" start | ||
;; | ||
start) | ||
status | ||
code=$? | ||
if [ $code -eq 0 ]; then | ||
emit "$name is already running" | ||
exit $code | ||
else | ||
start | ||
exit $? | ||
fi | ||
;; | ||
stop) stop ;; | ||
force-stop) force_stop ;; | ||
status) | ||
status | ||
code=$? | ||
if [ $code -eq 0 ] ; then | ||
emit "$name is running" | ||
else | ||
emit "$name is not running" | ||
fi | ||
exit $code | ||
;; | ||
restart) | ||
|
||
stop && start | ||
;; | ||
*) | ||
echo "Usage: $SCRIPTNAME {start|force-start|stop|force-start|force-stop|status|restart}" >&2 | ||
exit 3 | ||
;; | ||
esac | ||
|
||
exit $? |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
description "no description given" | ||
start on filesystem or runlevel [2345] | ||
stop on runlevel [!2345] | ||
|
||
respawn | ||
umask 022 | ||
#nice | ||
#chroot / | ||
chdir / | ||
#limit core <softlimit> <hardlimit> | ||
#limit cpu <softlimit> <hardlimit> | ||
#limit data <softlimit> <hardlimit> | ||
#limit fsize <softlimit> <hardlimit> | ||
#limit memlock <softlimit> <hardlimit> | ||
#limit msgqueue <softlimit> <hardlimit> | ||
#limit nice <softlimit> <hardlimit> | ||
#limit nofile <softlimit> <hardlimit> | ||
#limit nproc <softlimit> <hardlimit> | ||
#limit rss <softlimit> <hardlimit> | ||
#limit rtprio <softlimit> <hardlimit> | ||
#limit sigpending <softlimit> <hardlimit> | ||
#limit stack <softlimit> <hardlimit> | ||
setuid root | ||
setgid root | ||
console log # log stdout/stderr to /var/log/upstart/ | ||
|
||
|
||
exec /opt/tyk-gateway/tyk --conf=/opt/tyk-gateway/tyk.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
echo "Installing init scripts..." | ||
|
||
SYSTEMD="/lib/systemd/system" | ||
UPSTART="/etc/init" | ||
SYSV1="/etc/init.d" | ||
SYSV2="/etc/rc.d/init.d/" | ||
DIR="/opt/tyk-gateway/install" | ||
|
||
if [ -d "$SYSTEMD" ]; then | ||
echo "Found Systemd" | ||
cp $DIR/inits/systemd/system/tyk-gateway.service /lib/systemd/system/tyk-gateway.service | ||
fi | ||
|
||
if [ -d "$UPSTART" ]; then | ||
echo "Found upstart" | ||
cp $DIR/inits/upstart/conf/tyk-gateway.conf /etc/init/ | ||
fi | ||
|
||
if [ -d "$SYSV1" ]; then | ||
echo "Found SysV1" | ||
cp $DIR/inits/sysv/etc/default/tyk-gateway /etc/default/tyk-gateway | ||
cp $DIR/inits/sysv/etc/init.d/tyk-gateway /etc/init.d/tyk-gateway | ||
|
||
fi | ||
|
||
if [ -d "$SYSV2" ]; then | ||
echo "Found Sysv2" | ||
cp $DIR/inits/sysv/etc/default/tyk-gateway /etc/default/tyk-gateway | ||
cp $DIR/inits/sysv/etc/init.d/tyk-gateway /etc/rc.d/init.d/tyk-gateway | ||
fi |
Oops, something went wrong.