You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/04/24 18:55:01 UTC

[1/2] incubator-trafficcontrol git commit: moves demo data out of seeds file into seeds_demo.sql and creates seed_demo() method

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 439f243b7 -> 40326a9d5


moves demo data out of seeds file into seeds_demo.sql and creates seed_demo() method


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/1047398d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/1047398d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/1047398d

Branch: refs/heads/master
Commit: 1047398d8076fd7074f9c71bec45f686b842cb27
Parents: 439f243
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Fri Apr 21 11:05:06 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Apr 24 12:54:37 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/db/admin.pl       | 12 ++++++++++--
 traffic_ops/app/db/seeds.sql      | 27 +++++++------------------
 traffic_ops/app/db/seeds_demo.sql | 36 ++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1047398d/traffic_ops/app/db/admin.pl
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/admin.pl b/traffic_ops/app/db/admin.pl
index 658ea01..bf6093e 100755
--- a/traffic_ops/app/db/admin.pl
+++ b/traffic_ops/app/db/admin.pl
@@ -180,10 +180,18 @@ sub migrate {
 }
 
 sub seed {
-	print "Seeding database.\n";
+	print "Seeding database w/ required data.\n";
 	local $ENV{PGPASSWORD} = $db_password;
 	if ( system("psql -h $host_ip -p $host_port -d $db_name -U $db_user -e < db/seeds.sql") != 0 ) {
-		die "Can't seed database\n";
+		die "Can't seed database w/ required data\n";
+	}
+}
+
+sub seed_demo {
+	print "Seeding database w/ demo data.\n";
+	local $ENV{PGPASSWORD} = $db_password;
+	if ( system("psql -h $host_ip -p $host_port -d $db_name -U $db_user -e < db/seeds_demo.sql") != 0 ) {
+		die "Can't seed database w/ demo data\n";
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1047398d/traffic_ops/app/db/seeds.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/seeds.sql b/traffic_ops/app/db/seeds.sql
index 5ee624a..43e18c0 100644
--- a/traffic_ops/app/db/seeds.sql
+++ b/traffic_ops/app/db/seeds.sql
@@ -13,6 +13,9 @@
 	limitations under the License.
 */
 
+
+-- THIS FILE INCLUDES STATIC DATA REQUIRED OF TRAFFIC OPS
+
 -- cdns
 insert into cdn (name, dnssec_enabled, domain_name) values ('ALL', false, '-') ON CONFLICT (name) DO NOTHING;
 
@@ -26,14 +29,6 @@ insert into job_status (name, description) values ('PENDING', 'Job is queued, bu
 insert into parameter (name, config_file, value) values ('ttl_max_hours', 'regex_revalidate.config', '672') ON CONFLICT (name, config_file, value) DO NOTHING;
 insert into parameter (name, config_file, value) values ('ttl_min_hours', 'regex_revalidate.config', '48') ON CONFLICT (name, config_file, value) DO NOTHING;
 insert into parameter (name, config_file, value) values ('maxRevalDurationDays', 'regex_revalidate.config', '90') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.url', 'global', 'https://tm.kabletown.net/') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.toolname', 'global', 'Traffic Ops') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.infourl', 'global', 'http://docs.cdnl.kabletown.net/traffic_control/html/') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.logourl', 'global', '/images/tc_logo.png') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.instance_name', 'global', 'kabletown CDN') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('tm.traffic_mon_fwd_proxy', 'global', 'http://tm.kabletown.net:81') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('geolocation.polling.url', 'CRConfig.json', 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCity.dat.gz') ON CONFLICT (name, config_file, value) DO NOTHING;
-insert into parameter (name, config_file, value) values ('geolocation6.polling.url', 'CRConfig.json', 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCityv6.dat.gz') ON CONFLICT (name, config_file, value) DO NOTHING;
 insert into parameter (name, config_file, value) values ('CacheStats', 'traffic_stats.config', 'bandwidth') ON CONFLICT (name, config_file, value) DO NOTHING;
 insert into parameter (name, config_file, value) values ('CacheStats', 'traffic_stats.config', 'maxKbps') ON CONFLICT (name, config_file, value) DO NOTHING;
 insert into parameter (name, config_file, value) values ('CacheStats', 'traffic_stats.config', 'ats.proxy.process.http.current_client_connections') ON CONFLICT (name, config_file, value) DO NOTHING;
@@ -57,14 +52,6 @@ insert into profile (name, description, type) values ('INFLUXDB', 'InfluxDb prof
 insert into profile (name, description, type) values ('RIAK_ALL', 'Riak profile for all CDNs', 'RIAK_PROFILE') ON CONFLICT (name) DO NOTHING;
 
 -- profile_parameters
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.url' and config_file = 'global' and value = 'https://tm.kabletown.net/') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.toolname' and config_file = 'global' and value = 'Traffic Ops') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.infourl' and config_file = 'global' and value = 'http://docs.cdnl.kabletown.net/traffic_control/html/') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.logourl' and config_file = 'global' and value = '/images/tc_logo.png') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.instance_name' and config_file = 'global' and value = 'kabletown CDN') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.traffic_mon_fwd_proxy' and config_file = 'global' and value = 'http://tm.kabletown.net:81') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation.polling.url' and config_file = 'CRConfig.json' and value = 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCity.dat.gz') ) ON CONFLICT (profile, parameter) DO NOTHING;
-insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation6.polling.url' and config_file = 'CRConfig.json' and value = 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCityv6.dat.gz') ) ON CONFLICT (profile, parameter) DO NOTHING;
 insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'TRAFFIC_STATS'), (select id from parameter where name = 'CacheStats' and config_file = 'traffic_stats.config' and value = 'bandwidth') ) ON CONFLICT (profile, parameter) DO NOTHING;
 insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'TRAFFIC_STATS'), (select id from parameter where name = 'CacheStats' and config_file = 'traffic_stats.config' and value = 'maxKbps') ) ON CONFLICT (profile, parameter) DO NOTHING;
 insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'TRAFFIC_STATS'), (select id from parameter where name = 'CacheStats' and config_file = 'traffic_stats.config' and value = 'ats.proxy.process.http.current_client_connections') ) ON CONFLICT (profile, parameter) DO NOTHING;
@@ -86,14 +73,14 @@ insert into status (name, description) values ('CCR_IGNORE', 'Server is ignored
 insert into status (name, description) values ('PRE_PROD', 'Pre Production. Not active in any configuration.') ON CONFLICT (name) DO NOTHING;
 
 -- roles
-insert into role (name, description, priv_level) values ('disallowed', 'Block all access', 0) ON CONFLICT (name) DO NOTHING;
-insert into role (name, description, priv_level) values ('read-only user', 'Read-Only user', 10) ON CONFLICT (name) DO NOTHING;
-insert into role (name, description, priv_level) values ('operations', 'Operations user', 20) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('admin', 'super-user', 30) ON CONFLICT (name) DO NOTHING;
-insert into role (name, description, priv_level) values ('portal', 'Portal User', 2) ON CONFLICT (name) DO NOTHING;
+insert into role (name, description, priv_level) values ('operations', 'Operations user', 20) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('migrations', 'database migrations user - DO NOT REMOVE', 20) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('federation', 'Role for Secondary CZF', 15) ON CONFLICT (name) DO NOTHING;
 insert into role (name, description, priv_level) values ('steering', 'Role for Steering Delivery Services', 15) ON CONFLICT (name) DO NOTHING;
+insert into role (name, description, priv_level) values ('read-only user', 'Read-Only user', 10) ON CONFLICT (name) DO NOTHING;
+insert into role (name, description, priv_level) values ('portal', 'Portal User', 2) ON CONFLICT (name) DO NOTHING;
+insert into role (name, description, priv_level) values ('disallowed', 'Block all access', 0) ON CONFLICT (name) DO NOTHING;
 
 -- tenants
 insert into tenant (name, active, parent_id) values ('root', true, null) ON CONFLICT DO NOTHING;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1047398d/traffic_ops/app/db/seeds_demo.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/seeds_demo.sql b/traffic_ops/app/db/seeds_demo.sql
new file mode 100644
index 0000000..afdb790
--- /dev/null
+++ b/traffic_ops/app/db/seeds_demo.sql
@@ -0,0 +1,36 @@
+/*
+
+	Licensed under the Apache License, Version 2.0 (the "License");
+	you may not use this file except in compliance with the License.
+	You may obtain a copy of the License at
+
+	    http://www.apache.org/licenses/LICENSE-2.0
+
+	Unless required by applicable law or agreed to in writing, software
+	distributed under the License is distributed on an "AS IS" BASIS,
+	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+	See the License for the specific language governing permissions and
+	limitations under the License.
+*/
+
+-- THIS FILE INCLUDES DEMO DATA. IT BUILDS UPON THE RECORDS INSERTED IN SEEDS.SQL
+
+-- parameters (demo)
+insert into parameter (name, config_file, value) values ('tm.url', 'global', 'https://tm.kabletown.net/') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('tm.toolname', 'global', 'Traffic Ops') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('tm.infourl', 'global', 'http://docs.cdnl.kabletown.net/traffic_control/html/') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('tm.logourl', 'global', '/images/tc_logo.png') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('tm.instance_name', 'global', 'kabletown CDN') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('tm.traffic_mon_fwd_proxy', 'global', 'http://tm.kabletown.net:81') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('geolocation.polling.url', 'CRConfig.json', 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCity.dat.gz') ON CONFLICT (name, config_file, value) DO NOTHING;
+insert into parameter (name, config_file, value) values ('geolocation6.polling.url', 'CRConfig.json', 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCityv6.dat.gz') ON CONFLICT (name, config_file, value) DO NOTHING;
+
+-- profile_parameters (demo)
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.url' and config_file = 'global' and value = 'https://tm.kabletown.net/') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.toolname' and config_file = 'global' and value = 'Traffic Ops') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.infourl' and config_file = 'global' and value = 'http://docs.cdnl.kabletown.net/traffic_control/html/') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.logourl' and config_file = 'global' and value = '/images/tc_logo.png') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.instance_name' and config_file = 'global' and value = 'kabletown CDN') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.traffic_mon_fwd_proxy' and config_file = 'global' and value = 'http://tm.kabletown.net:81') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation.polling.url' and config_file = 'CRConfig.json' and value = 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCity.dat.gz') ) ON CONFLICT (profile, parameter) DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation6.polling.url' and config_file = 'CRConfig.json' and value = 'http://cdn-tools.cdnl.kabletown.net/cdn/MaxMind/GeoLiteCityv6.dat.gz') ) ON CONFLICT (profile, parameter) DO NOTHING;


[2/2] incubator-trafficcontrol git commit: This closes #498.

Posted by da...@apache.org.
This closes #498.


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/40326a9d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/40326a9d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/40326a9d

Branch: refs/heads/master
Commit: 40326a9d53ba68b5c1d8fadf8e515fe8168c2381
Parents: 1047398
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Apr 24 12:54:53 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Apr 24 12:54:53 2017 -0600

----------------------------------------------------------------------

----------------------------------------------------------------------