Partner Logo German Cancio – WP4-install LCFG HOW-TO - n° 1 How to write LCFGng components for EDG 10/2002

Slides:



Advertisements
Similar presentations
Configuration management
Advertisements

Database System Concepts and Architecture
German Cancio – WP4 developments Partner Logo WP4-install plans WP6 meeting, Paris project conference
ASIS et le projet EU DataGrid (EDG) Germán Cancio IT/FIO.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
The EDG Testbed Introduction and Setup The European DataGrid Project Team
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
NGOP J.Fromm K.Genser T.Levshina M.Mengel V.Podstavkov.
Apache : Installation, Configuration, Basic Security Presented by, Sandeep K Thopucherela, ECE Department.
Automating Linux Installations at CERN G. Cancio, L. Cons, P. Defert, M. Olive, I. Reguero, C. Rossi IT/PDP, CERN presented by G. Cancio.
NDT Tools Tutorial: How-To setup your own NDT server Rich Carlson Summer 04 Joint Tech July 19, 2004.
Module 16: Software Maintenance Using Windows Server Update Services.
16.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 16: Examining Software Update.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Partner Logo German Cancio – WP4-install LCFG HOW-TO - n° 1 WP4 hands-on workshop: EDG LCFGng exercises
WP4-install task report WP4 workshop Barcelona project conference 5/03 German Cancio.
Conditions and Terms of Use
Module 13: Maintaining Software by Using Windows Server Update Services.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
EDG LCFGng: concepts Fabric Management Tutorial - n° 2 LCFG (Local ConFiGuration system)  LCFG is originally developed by the.
1 Linux in the Computer Center at CERN Zeuthen Thorsten Kleinwort CERN-IT.
October, Scientific Linux INFN/Trieste B.Gobbo – Compass R.Gomezel - T.Macorini - L.Strizzolo INFN - Trieste.
Olof Bärring – WP4 summary- 6/3/ n° 1 Partner Logo WP4 report Status, issues and plans
quattor NCM components introduction tutorial German Cancio CERN IT/FIO.
EDG WP4: installation task LSCCW/HEPiX hands-on, NIKHEF 5/03 German Cancio CERN IT/FIO
Languages for Large Scale System Configuration John Hawkins Laboratory for the Foundations of Computer Science University of Edinburgh.
Partner Logo DataGRID WP4 - Fabric Management Status HEPiX 2002, Catania / IT, , Jan Iven Role and.
UCY HPCL Introduction to the CrossGrid Testbed George Tsouloupas UCY HPCL.
Olof Bärring – WP4 summary- 4/9/ n° 1 Partner Logo WP4 report Plans for testbed 2
1 Chapter Overview Publishing Resources in Active Directory Service Redirecting Folders Using Group Policies Deploying Applications Using Group Policies.
ISetup – A Guide/Benefit for the Functional User! Mohan Iyer January 17 th, 2008.
Partner Logo German Cancio – WP4-install LCFG HOW-TO - n° 1 LCFGng configuration examples Updated 10/2002
EDG Testbed installation and configuration with LCFGng Maite Barroso - WP4
1 The new Fabric Management Tools in Production at CERN Thorsten Kleinwort for CERN IT/FIO HEPiX Autumn 2003 Triumf Vancouver Monday, October 20, 2003.
Quattor-for-Castor Jan van Eldik Sept 7, Outline Overview of CERN –Central bits CDB template structure SWREP –Local bits Updating profiles.
German Cancio – WP4 developments Partner Logo System Management: Node Configuration & Software Package Management
Deployment work at CERN: installation and configuration tasks WP4 workshop Barcelona project conference 5/03 German Cancio CERN IT/FIO.
20-May-2003HEPiX Amsterdam EDG Fabric Management on Solaris G. Cancio Melia, L. Cons, Ph. Defert, I. Reguero, J. Pelegrin, P. Poznanski, C. Ungil Presented.
G. Cancio, L. Cons, Ph. Defert - n°1 October 2002 Software Packages Management System for the EU DataGrid G. Cancio Melia, L. Cons, Ph. Defert. CERN/IT.
Ariel Garcia LCG cluster installation, EGEE training, Ariel Garcia - IWR LCG Cluster Installation Forschungszentrum Karlsruhe in der Helmholtz-Gemeinschaft.
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
6 th Annual Focus Users’ Conference 6 th Annual Focus Users’ Conference Import Testing Data Presented by: Adrian Ruiz Presented by: Adrian Ruiz.
Linux Security. Module 13 – Linux Security ♦ Overview Linux is more prone today to security loopholes and attacks, both inside and outside the network.
SPMA & SWRep: Basic exercises HEPiX hands-on, NIKHEF 5/03 German Cancio
Olof Bärring – WP4 summary- 4/9/ n° 1 Partner Logo WP4 report Plans for testbed 2 [Including slides prepared by Lex Holt.]
22nd April 2002 Steve Traylen, RAL, 1 LCFG Installation Steve Traylen. LCFG – A tool for installation and configuration. UK HEP SYSMAN,
M.Biasotto, CERN, 5 november Fabric Management Massimo Biasotto, Enrico Ferro – INFN LNL.
C. Aiftimiei, E. Ferro / January LCFGng server installation Cristina Aiftimiei, Enrico Ferro INFN-LNL.
J.P. Wellisch, CERN/EP/SFT SCRAM Information on SCRAM J.P. Wellisch, C. Williams, S. Ashby.
E. Ferro, CNAF, april Enrico Ferro INFN-LNL Installation of a LCFG server.
German Cancio – WP4 developments Partner Logo WP4-install progress CERN, 19/6/2002 for WP4-install.
Maite Barroso - 10/05/01 - n° 1 WP4 PM9 Deliverable Presentation: Interim Installation System Configuration Management Prototype
Yannick Patois - Datagrid Software Repository Presentation - March, n° 1 Datagrid Software Repository Presentation CVS, packages and automatic.
Linux Operations and Administration
The EDG Testbed The European DataGrid Project Team
15-Feb-02Steve Traylen, RAL WP6 Test Bed Report1 RAL/UK WP6 Test Bed Report Steve Traylen, WP6 PPGRID/RAL, UK
The EDG Testbed The European DataGrid Project Team
EGEE is a project funded by the European Union under contract IST Installation and configuration of gLite services Robert Harakaly, CERN,
Quattor tutorial Introduction German Cancio, Rafael Garcia, Cal Loomis.
Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney.
Partner Logo Olof Bärring, WP4 workshop 10/12/ n° 1 (My) Vision of where we are going WP4 workshop, 10/12/2002 Olof Bärring.
Maite Barroso – WP4 Workshop – 10/12/ n° 1 -WP4 Workshop- Developers’ Guide Maite Barroso 10/12/2002
SCDB Update Michel Jouvin LAL, Orsay March 17, 2010 Quattor Workshop, Thessaloniki.
Open Science Grid Configuring RSV OSG Resource & Service Validation Thomas Wang Grid Operations Center (OSG-GOC) Indiana University.
The European DataGrid Project Team
WP4-install status update
German Cancio CERN IT .quattro architecture German Cancio CERN IT.
The EU DataGrid Fabric Management Services
Web Application Development Using PHP
Presentation transcript:

Partner Logo German Cancio – WP4-install LCFG HOW-TO - n° 1 How to write LCFGng components for EDG 10/2002

German Cancio – WP4-install LCFG HOW-TO - n° 2 Overview LCFG – short reminder Slides stolen from Enrico and Massimo / INFN Writing LCFGng Components for EDG usage Examples Documentation and links

German Cancio – WP4-install LCFG HOW-TO - n° 3 LCFG – short reminder

German Cancio – WP4-install LCFG HOW-TO - n° 4 WP4 & LCFG u LCFG is originally developed by the Computer Science Department of Edinburgh University u Handles automated installation, configuration and management of machines u Basic features: n automatic installation of O.S. n installation/upgrade/removal of all (rpm-based) software packages n centralized configuration and management of machines n extendible to configure and manage custom application software

German Cancio – WP4-install LCFG HOW-TO - n° 5 A collection of agents read configuration parameters and either generate traditional config files or directly manipulate various services Abstract configuration parameters for all nodes stored in a central repository ldxprof Load Profile Generic Component Profile Object rdxprof Read Profile LCFG Objects Local cache Client nodes Web Server HTTP XML Profile LCFG Config Files Make XML Profile Server LCFG diagram +inet.services telnet login ftp +inet.allow telnet login ftp sshd +inet.allow_telnet ALLOWED_NETWORKS +inet.allow_login ALLOWED_NETWORKS +inet.allow_ftp ALLOWED_NETWORKS +inet.allow_sshd ALL +inet.daemon_sshd yes auth.users myckey +auth.userhome_mickey /home/mickey +auth.usershell_mickey /bin/tcsh +inet.services telnet login ftp +inet.allow telnet login ftp sshd +inet.allow_telnet ALLOWED_NETWORKS +inet.allow_login ALLOWED_NETWORKS +inet.allow_ftp ALLOWED_NETWORKS +inet.allow_sshd ALL +inet.daemon_sshd yes auth.users myckey +auth.userhome_mickey /home/mickey +auth.usershell_mickey /bin/tcsh Config files , /home/MickeyMouseHome /bin/tcsh , /home/MickeyMouseHome /bin/tcsh XML profiles Profile Object inet auth /etc/services /etc/inetd.conf /etc/hosts.allow in.telnetd : , in.rlogind : , in.ftpd : , sshd : ALL /etc/hosts.allow in.telnetd : , in.rlogind : , in.ftpd : , sshd : ALL /etc/shadow /etc/group /etc/passwd.... mickey:x:999:20::/home/Mickey:/bin/tcsh.... /etc/passwd.... mickey:x:999:20::/home/Mickey:/bin/tcsh....

German Cancio – WP4-install LCFG HOW-TO - n° 6 LCFG configuration (I) u Most of the configuration data are common for a category of nodes (e.g. diskservers, computing nodes) and only a few are node-specific (e.g. hostname, IP-address)  Using the cpp preprocessor it is possible to build a hierarchical structure of config files containing directives like #define, #include, #ifdef, comments with /* */, etc... u The configuration of a typical LCFG node looks like this: #define HOSTNAME pc239 /* Host specific definitions */ #include "site.h" /* Site specific definitions */ #include "linuxdef.h" /* Common linux resources */ #include "client.h" /* LCFG client specific resources */

German Cancio – WP4-install LCFG HOW-TO - n° 7 LCFG configuration (II) From "site.h" #define LCFGSRV grid01 #define URL_SERVER_CONFIG #define LOCALDOMAIN.lnl.infn.it #define DEFAULT_NAMESERVERS [...] From "linuxdef.h" update.interfaces eth0 update.hostname_eth0 HOSTNAME update.netmask_eth0 NETMASK [...] From "client.h" update.disks hda update.partitions_hda hda1 hda2 update.pdetails_hda1 free / update.pdetails_hda2 128 swap auth.users mickey auth.usercomment_mickey Mickey Mouse auth.userhome_mickey /home/Mickey [...]

German Cancio – WP4-install LCFG HOW-TO - n° 8 LCFG: configuration changes u Server-side: when the config files are modified, a tool (mkxprof) recreates the new xml profile for all the nodes affected by the changes n this can be done manually or with a daemon periodically checking for config changes and calling mkxprof n mkxprof can notify via UDP the nodes affected by the changes u Client-side: another tool (rdxprof) downloads the new profile from the server n usually activated by an LCFG component at boot n can be configured to work as s daemon periodically polling the server s daemon waiting for notifications s started by cron at predefined times

German Cancio – WP4-install LCFG HOW-TO - n° 9 LCFGng components for EDG usage

German Cancio – WP4-install LCFG HOW-TO - n° 10 LCFG: what’s a component? u Component == object u It's a Perl script (also shell scripts accepted for historic reasons) n We recommend to phase out shell components. n A backwards compatibility module allows to import old-style components without any modifications.  Each component provides a Configure() method invoked on startup or when configuration changes u A simple and typical component behaviour: n Started when notified of a configuration change n Loads its configuration (locally cached) n Configures the appropriate services, by translating config parameters into a traditional config file and reloading a service if necessary (e.g. restarting a init.d service).

German Cancio – WP4-install LCFG HOW-TO - n° 11 LCFG: custom components  LCFG provides components to manage the configuration of services of a machine: inet, auth, nfs, cron,... u Admins can build new custom components to configure and manage their own applications: n define your custom “resources” (configuration parameters) n Write a script containing standard methods with your custom code. n Include in your script a generic library, which contains the definition of common function used by all components (config loading, log, output,...) u For simple components usually just a few lines of code

German Cancio – WP4-install LCFG HOW-TO - n° 12 Writing LCFG components for EDG u Software written for EDG should be portable to whatever farm management system is used.  It is therefore recommended to use whenever possible, standard SysV procedures for managing services: init.d scripts and chkconfig.  LCFG should not be used for replacing existing SysV init.d functionality! u LCFG should be used for n retrieving configuration information from the CDB and recreate local config files Restarting services if needed via init.d scripts ( restart/reload ) Enabling/disabling SysV services to match the configuration DB’s contents (using chkconfig )

German Cancio – WP4-install LCFG HOW-TO - n° 13 LCFG component methods for EDG Only method to implement:  Configure(): Reconfigures the service and notifies running processes. u Methods not recommended for EDG, but available in LCFGng: n Start(), Stop(), Run(), Suspend(), Resume()

German Cancio – WP4-install LCFG HOW-TO - n° 14 EDG / LCFG component template (I) #!/usr/bin/perl -w package = qw(LCFG::Component); use strict; use LCFG::Component; use LCFG::Config; # EDG specific sub { my ($self,$res) my $config=LCFG::Config->new($res); my $age=$config->getValue('/persons/John/age'); $self->Fail( "too young") unless ($age>18); } new LCFG::MyComp() -> Dispatch();

German Cancio – WP4-install LCFG HOW-TO - n° 15 LCFG component template (II)  Configure() method: # Do the configuration sub { my ($self,$res) my $config=LCFG::Config->new($res); # do whatever is neccesary to reconfigure your service }

German Cancio – WP4-install LCFG HOW-TO - n° 16 LCFG component template (IV)  The specific part in the configure() method will usually contain three steps: 1. Access my resources via a special API (NVA API – next slide) my $config=NVA::Config->new(); my $arch=$config->getValue('/system/architecture’); $self->Fail (“not supported") unless ($arch eq ‘i386’); 2. Generate (or update) config file open (MYCONFIG,’/etc/myconfig’); … close(MYCONFIG) 3. Reload/restart a service if neccessary if ($changed) { system(‘/sbin/service myservice reload’); … }

German Cancio – WP4-install LCFG HOW-TO - n° 17 NVA API configuration access library (EDG only) New component configuration access library u This library allows true hierarchical configuration structure access on the client side u Implements a subset of the Node View Access API (v.1) n n Implemented only for Perl components. u Most popular methods: n $value=$config->getValue (‘/my/path/in/config’); #access value n $element=$config->getElement($path); #configuration element n while ($element->isNextElement()) { # iterations over element lists my $newel=$element->getNextElement();

German Cancio – WP4-install LCFG HOW-TO - n° 18 EDG relevant built-in standard functions  : prints out a [FAIL] message and exits  prints out [WARNING] message  prints out [OK] message  Adds message to logfile (see also the LCFG/Component.pm file)

German Cancio – WP4-install LCFG HOW-TO - n° 19 Configuration information (I) Configuration information is stored on the LCFG server in two types of files: 1.The resource definition files (.def) 2.The normal.h & machine configuration files.

German Cancio – WP4-install LCFG HOW-TO - n° 20 Configuration information (II) 1. The.def files contain default resource information: mycomp.def /* EDG LCFG mycomponent: default resources */ /* schema version always=1 */ schema1 /* defined resources and defaults */ myconfig1 myconfig2defaultvalue2

German Cancio – WP4-install LCFG HOW-TO - n° 21 Configuration information (III) 2. The normal.h & machine config files, where the default configuration is enhanced/overwritten: mycomponent. mycomp.myconfig1whatevervalue mycomp.myconfig2whateverothervalue Some special resources have to be declared for including a component to be deployed: # add to profile (always needed) EXTRA(profile.components)mycomp # define XML profile version (always set to 1) profile.version_mycomp1 # start on boot time (if required) EXTRA(boot.services)mycomp

German Cancio – WP4-install LCFG HOW-TO - n° 22 Hierarchical configurations (I) u Sometimes, key-value pairs are not sufficient for the required configurations. n For example: arrays or lists u LCFG has a complex server side mechanism for mapping hierarchical structures into key-value pairs… u Table with person names, ages, and phone numbers (.def age_$ phone_$ persons age_$ phone_$

German Cancio – WP4-install LCFG HOW-TO - n° 23 Hierarchical configurations (II) Now we want to add the following to the node config:  John, 35, and Phil, 21, The node config file will look like: mycomp.persons John Phil mycomp.age_John 35 mycomp.phone_John mycomp.age_Phil21 mycomp.phone_Phil54321 The /persons/John/age, /persons/John/phone, /persons/Phil/age, /persons/Phil/phone resources will be accessible to the client via the NVA API.

German Cancio – WP4-install LCFG HOW-TO - n° 24 Hierarchical configurations (III) The component accessing the info needs to do: my $personlist=$config->getElement(‘/persons’); while($personlist->isNextElement()) { my $person=$personlist->getNextElement(); my $phone=$config->getElement(‘/persons/’.$person.’/phone’); my $age=$config->getElement(‘/persons/’.$person.’/age’); print CONFIG “name: $i – age: $age – phone: $phone\n”; }

German Cancio – WP4-install LCFG HOW-TO - n° 25 Hierarchical Configurations (IV) u Note that there is no limit in the nesting of resources (lists of lists are possible as well as lists of lists of lists) n There are some examples (eg. demo NVA API component) n However it is complex using the mkxprof language. Release 3 developments will include integration with the ‘pan’ HLDL language.

German Cancio – WP4-install LCFG HOW-TO - n° 26 Some tips u Avoid dumping configuration files literally into the configline_$ configlines … configline_01 FARM=MOOH_BAR configline_02MILK_NODE=COW_ u This leads to some problems, eg. when you overwrite values for host specific values How do you know that configline_324 is still the line you wanted to change? u Rather use a template configuration file shipped with the component RPM n Substitute relevant entries in the template cf file n Use the built-in template processor for this (see next slide). u Keep explicit configuration information in the LCFG config files.

German Cancio – WP4-install LCFG HOW-TO - n° 27 Template processor u A template substitution processor allows for fast generation of config files u Special marked entries allow to substitute specific entries by LCFGng resources. u Example template file for resources in red: # # Myconfig configuration file # # directory where database management files are stored databaseDirectory = # directory where temporary files are stored tmpDataDirectory = # directory where lock files are stored lockDirectory = u The template processor is called using LCFG::Template::Substitute ( ‘/mypath/templatefile', ‘/mypath/myconfigfile', $fake, $res );

German Cancio – WP4-install LCFG HOW-TO - n° 28 Example (I) Edg-lcfg-syslog – configures /etc/syslog.conf.def add_$ Additions add_$ Resources defined on server: syslog.additions monitoring kernel syslog.add_monitoring local3.* |/var/obj/tmp/monitor.fifo syslog.add_kernel kern.* /var/log/kernel.log

German Cancio – WP4-install LCFG HOW-TO - n° 29 Example (II) Component: Configure() method. First part: template generation sub { my my $config=LCFG::Config->new($res); my $syslogconf='/etc/syslog.conf'; my $status = LCFG::Template::Substitute ( '/usr/lib/lcfg/conf/syslog/template', '/var/obj/conf/syslog/config', 0, $res ); unless (defined($status)) { $self->Fail( "failed to create config file (see logfile)"); }

German Cancio – WP4-install LCFG HOW-TO - n° 30 Example (III) Component: Configure() method. Second part: add missing resources # extra values from 'additions', using NVA API my $additions=$config->getElement('/additions'); while ($additions->isNextElement()) { my $add=$additions->getNextElement(); my $add_el=$config->getElement('/additions/'.$add.'/add'); } if (scalar { open (CFG, '>>/var/obj/conf/syslog/config') || $self->Fail('cannot open config file (see logfile)'); print CFG close (CFG) || $self->Fail('cannot close config file (see logfile)'); }

German Cancio – WP4-install LCFG HOW-TO - n° 31 Example (IV) Component: Configure() method. Third part: copy config file, restart service # copy over to definitive location if files are different if (system("/usr/bin/cmp -s $syslogconf /var/obj/conf/syslog/config")){ $self->LogMessage("updating config file"); system('cp -f '.$syslogconf.' '.$syslogconf.'.old'); system('cp -f /var/obj/conf/syslog/config '.$syslogconf) && $self->Fail("copying template to $syslogconf: ". $?); # restart service if (system('/sbin/service syslog restart')) { $self->Fail('init.d syslog restart failed: '. $?); } } return 1; #OK }

German Cancio – WP4-install LCFG HOW-TO - n° 32 Packaging components u In order to generate components in RPM, SRPM, and tar format, the component has to be packaged according to some guidelines. n Read the COMPONENTS-HOWTO for details and links u If you want to test/develop/package your components without CVS access, you should copy the following from fabric_mgt/edg-lcfg: n Makefile edg-lcfg-config directory u Create a directory below the makefile, called edg-lcfg- u Populate it with the following files (take eg. edg-lcfg-syslog as template) n CHANGES, ChangeLog, LICENSE, MAINTAINER, Makefile, README, README.BUILD, config.mk, specfile,.cin,.def.cin,.pod.cin u Use the make ‘devpack’ and ‘devrpm’ targets for generating the tar and RPM packages, respectively. u Once your package is ready, contact WP4 for getting it added to CVS.

German Cancio – WP4-install LCFG HOW-TO - n° 33 Documentation and links u LCFGng ‘out of the box’: u EDG components and extensions: Check on the EDG CVS repository, -> fabric_mgt/edg-lcfg u EDG configuration access API (NVA API v1.0): n n edg-lcfg-nvaapi library module at the EDG CVS repository u Documentation (HOW-TO): n lcfg/COMPONENTS-HOWTO lcfg/COMPONENTS-HOWTO u WP4-install homepage: