<commit_before>--
-- fgapiserver_db.sql
--
-- Copyright (c) 2015:
-- I<NAME> (INFN), Italy
-- Consorzio COMETA (COMETA), Italy
--
-- See http://www.infn.it and and http://www.consorzio-cometa.it for details on
-- the copyright holders.
--
-- 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.
--
-- Script that creates the GridEngine based apiserver
--
-- Author: <EMAIL>
--
drop database if exists fgapiserver;
create database fgapiserver;
grant all on fgapiserver.* TO 'fgapiserver'@'%' IDENTIFIED BY "fgapiserver_password";
grant all on fgapiserver.* TO 'fgapiserver'@'localhost' IDENTIFIED BY "fgapiserver_password";
use fgapiserver;

-- Application
create table application (
    id           int unsigned not null auto_increment
   ,name         varchar(256)
   ,description  varchar(256)
   ,creation     datetime
   ,enabled      boolean default false
   ,primary key(id)
);

insert into application (id,name,description,creation,enabled) 
values (1,"hostname","hostname tester application",now(),true);
insert into application (id,name,description,creation,enabled)
values (2,"SayHello","A more complex app using I/O Sandboxing",now(),true);

-- Application parameters
create table application_parameter (
    app_id        int unsigned not null
   ,param_id      int unsigned not null
   ,pname         varchar(64) not null
   ,pvalue        varchar(256)
   ,primary key(app_id,param_id)
   ,foreign key (app_id) references application(id)
);

-- Parameters for application helloworld
-- App 1
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,1,'jobdesc_executable','/bin/hostname');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,2,'jobdesc_arguments','-f');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,3,'jobdesc_output','stdout.txt');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,4,'jobdesc_error','stderr.txt');
-- App 2
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,1,'jobdesc_executable','/bin/bash');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,2,'jobdesc_arguments','sayhello.sh');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,3,'jobdesc_output','sayhello.out');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,4,'jobdesc_error','sayhello.err');

-- Application files
create table application_file (
    app_id        int unsigned not null
   ,file_id       int unsigned not null -- progressive file number for each application
   ,file          varchar(256) not null -- name of the application file
   ,path          varchar(256) not null -- full path to the application file
   ,override      boolean default false -- true if this file overrides user uploads
   ,primary key(app_id,file_id)
   ,foreign key (app_id) references application(id)
);

-- Files associated to application sayhello
insert into application_file (app_id,file_id,file,path,override) values (2,1,'sayhello.sh' ,'/Users/Macbook/Documents/fgapiserver/apps/sayhello',false);
insert into application_file (app_id,file_id,file,path,override) values (2,2,'sayhello.txt','/Users/Macbook/Documents/fgapiserver/apps/sayhello',false);

-- Infrastructure
create table infrastructure (
    id           int unsigned not null auto_increment
   ,app_id       int unsigned not null
   ,name         varchar(256) not null
   ,description  varchar(256) not null
   ,creation     datetime not null
   ,enabled      boolean default false not null
   ,primary key(id,app_id)
   ,foreign key(app_id) references application(id)
   ,index(app_id)
);

-- Infrastructure parameter
create table infrastructure_parameter (
    infra_id     int unsigned not null
   ,param_id     int unsigned not null 
   ,pname        varchar(64) not null
   ,pvalue       varchar(256) not null
   ,primary key(infra_id,param_id)
   ,foreign key(infra_id) references infrastructure(id)
);

-- Infra for helloworld app@csgfsdk
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (1,1,"hello@csgfsdk","hostname application csgfsdk (SSH)",now(),true);
-- Infra for sayhello app@csgfsdk
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (1,2,"sayhello@csgfsdk","sayhello application csgfsdk (SSH)",now(),true);
-- Infra for sayhello app@nebula
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (2,2,"sayhello@nebula","hostname application csgfsdk (rOCCI)",now(),false);
-- Infra for helloworld app@eumed
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (3,1,"hello@eumed","hostname application eumed (wms)",now(),true);

-- Parameters for infrastructure helloworld@csgfsdk (SSH)
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,1,'jobservice','ssh://192.168.127.12');
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,2,'username','jobtest');
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,3,'password','<PASSWORD>');
<commit_msg>disabling as default WMS (make troubles with fg TestVMs)<commit_after>--
-- fgapiserver_db.sql
--
-- Copyright (c) 2015:
-- Istituto Nazionale di Fisica Nucleare (INFN), Italy
-- Consorzio COMETA (COMETA), Italy
--
-- See http://www.infn.it and and http://www.consorzio-cometa.it for details on
-- the copyright holders.
--
-- 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.
--
-- Script that creates the GridEngine based apiserver
--
-- Author: <EMAIL>
--
drop database if exists fgapiserver;
create database fgapiserver;
grant all on fgapiserver.* TO 'fgapiserver'@'%' IDENTIFIED BY "fgapiserver_password";
grant all on fgapiserver.* TO 'fgapiserver'@'localhost' IDENTIFIED BY "fgapiserver_password";
use fgapiserver;

-- Application
create table application (
    id           int unsigned not null auto_increment
   ,name         varchar(256)
   ,description  varchar(256)
   ,creation     datetime
   ,enabled      boolean default false
   ,primary key(id)
);

insert into application (id,name,description,creation,enabled) 
values (1,"hostname","hostname tester application",now(),true);
insert into application (id,name,description,creation,enabled)
values (2,"SayHello","A more complex app using I/O Sandboxing",now(),true);

-- Application parameters
create table application_parameter (
    app_id        int unsigned not null
   ,param_id      int unsigned not null
   ,pname         varchar(64) not null
   ,pvalue        varchar(256)
   ,primary key(app_id,param_id)
   ,foreign key (app_id) references application(id)
);

-- Parameters for application helloworld
-- App 1
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,1,'jobdesc_executable','/bin/hostname');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,2,'jobdesc_arguments','-f');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,3,'jobdesc_output','stdout.txt');
insert into application_parameter (app_id,param_id,pname,pvalue) values (1,4,'jobdesc_error','stderr.txt');
-- App 2
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,1,'jobdesc_executable','/bin/bash');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,2,'jobdesc_arguments','sayhello.sh');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,3,'jobdesc_output','sayhello.out');
insert into application_parameter (app_id,param_id,pname,pvalue) values (2,4,'jobdesc_error','sayhello.err');

-- Application files
create table application_file (
    app_id        int unsigned not null
   ,file_id       int unsigned not null -- progressive file number for each application
   ,file          varchar(256) not null -- name of the application file
   ,path          varchar(256) not null -- full path to the application file
   ,override      boolean default false -- true if this file overrides user uploads
   ,primary key(app_id,file_id)
   ,foreign key (app_id) references application(id)
);

-- Files associated to application sayhello
insert into application_file (app_id,file_id,file,path,override) values (2,1,'sayhello.sh' ,'/Users/Macbook/Documents/fgapiserver/apps/sayhello',false);
insert into application_file (app_id,file_id,file,path,override) values (2,2,'sayhello.txt','/Users/Macbook/Documents/fgapiserver/apps/sayhello',false);

-- Infrastructure
create table infrastructure (
    id           int unsigned not null auto_increment
   ,app_id       int unsigned not null
   ,name         varchar(256) not null
   ,description  varchar(256) not null
   ,creation     datetime not null
   ,enabled      boolean default false not null
   ,primary key(id,app_id)
   ,foreign key(app_id) references application(id)
   ,index(app_id)
);

-- Infrastructure parameter
create table infrastructure_parameter (
    infra_id     int unsigned not null
   ,param_id     int unsigned not null 
   ,pname        varchar(64) not null
   ,pvalue       varchar(256) not null
   ,primary key(infra_id,param_id)
   ,foreign key(infra_id) references infrastructure(id)
);

-- Infra for helloworld app@csgfsdk
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (1,1,"hello@csgfsdk","hostname application csgfsdk (SSH)",now(),true);
-- Infra for sayhello app@csgfsdk
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (1,2,"sayhello@csgfsdk","sayhello application csgfsdk (SSH)",now(),true);
-- Infra for sayhello app@nebula
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (2,2,"sayhello@nebula","hostname application csgfsdk (rOCCI)",now(),false);
-- Infra for helloworld app@eumed
insert into infrastructure (id,app_id,name,description,creation,enabled)
values (3,1,"hello@eumed","hostname application eumed (wms)",now(),false);

-- Parameters for infrastructure helloworld@csgfsdk (SSH)
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,1,'jobservice','ssh://192.168.127.12');
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,2,'username','jobtest');
insert into infrastructure_parameter (infra_id,param_id,pname,pvalue) values (1,3,'password','<PASSWORD>');

{'fraction_non_alphanumeric': 0.11223047013078827, 'fraction_numerical': 0.015022976316719689, 'mean_word_length': 4.922030350601779, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3903398', 'n_tokens_mistral': 3527, 'n_tokens_neox': 3412, 'n_words': 980}