The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

TaskPipe::Tool::Command_DeployTables - command to deploy taskpipe tables

PURPOSE

Deploy the database tables which are needed by taskpipe to operate - ie taskpipe global tables or cache tables for an individual project.

DESCRIPTION

If you are installing taskpipe from scratch, then you need to deploy global tables, which have shared usage between taskpipe processes. Ideally you should deploy these tables to a specific designated database, which only contains these global taskpipe tables. (Perhaps call this database taskpipe or taskpipe_global etc.) It is possible to have taskpipe global tables sit alongside other tables in the same database, but not recommended (use the table_prefix option to differentiate taskpipe related tables).

Running a taskpipe plan always involves using two databases - the global database (as above) and a database specfic to your project (the project database). Your project database will contain 2 groups of tables, cache and plan tables. The plan tables are tables specific to your project - so taskpipe cannot create these for you (sorry!). So deploying project tables really means cache tables will be deployed to your designated project database.

Global Database

TaskPipe uses a global database to manage jobs, threads and other information. You should run deploy tables once with --scope=global after running setup, to deploy global tables.

Make sure you have

  • Created the database where the tables will be deployed. In MySQL:

        CREATE DATABASE taskpipe_global;
  • Created a user and password for taskpipe to use to access your database, and given correct access permissions for taskpipe to interface with your database.

    In MySQL:

        CREATE USER 'taskpipe_user'@'localhost' IDENTIFIED BY 'somecomplexpassword';
        GRANT ALL PRIVILEGES ON taskpipe_global.* TO 'taskpipe_user'@'localhost';
  • Filled in the information about your database (database name, host, username, password) in the global configuration file (usually global.yml, found inside /global/conf in your taskpipe directory). If you setup taskpipe in /taskpipe in your home directory, then you can modify this with a text editor. E.g. using nano:

        nano ~/taskpipe/global/conf/global.yml

    Look for the TaskPipe::SchemaManager::Settings_Global section and change the values to suit your setup:

        ...    
        
        TaskPipe::SchemaManager::Settings_Global:
          host: localhost
          method: dbi
          module: TaskPipe::GlobalSchema
          name: taskpipe
          password: somecomplexpassword
          table_prefix: ''
          type: mysql
          username: taskpipe_user
    
        ...

    Note that module is the module taskpipe will use as a template for your tables. It is not recommended you change this.

deploy tables will deploy all tables with names that start with whatever you specify in table_prefix. It is recommended that you don't use the global database for any other purpose (ie you simply set it up and then leave it alone). In this case, the table prefix is not important, and you can leave it as an empty string (as above).

Once you have saved the global config file with the new settings, run <deploy tables>

    taskpipe deploy tables --scope=global

You should then generate the schema files taskpipe will use to interface with the new tables

    taskpipe generate schema --scope=global

See the help for generate schema for more information. For more information on setup run:

    taskpipe help setup

Project Database

deploy tables needs to be run each time you create a new project. First deploy the files associated with the project

    taskpipe deploy files --project=newproject

Next edit the project config that was created. If you used default directory settings, and you installed taskpipe into ~/taskpipe then you should find this file at ~/taskpipe/projects/newproject/conf/project.yml (remembering to change newproject to whatever name you called your project).

    nano ~/taskpipe/projects/newproject/conf/project.yml

Find the section TaskPipe::SchemaManager::Settings_Project and edit to suit your setup

    TaskPipe::SchemaManager::Settings_Project:
      host: localhost
      method: dbi
      module: TaskPipe::Schema
      name: newproject
      password: somecomplexpassword
      table_prefix: tp_
      type: mysql
      username: taskpipe_user

Remember the table prefix will differentiate cache tables (which deploy tables creates) from plan tables (which you will create yourself as part of your project).

Create the database you are going to use for the project. E.g. in MySQL

    CREATE DATABASE newproject;

and make sure your taskpipe user has permissions to the new database. E.g. in MySQL

    GRANT ALL PRIVILEGES ON newproject.* TO 'taskpipe_user'@'localhost';

Then run deploy tables

    taskpipe deploy tables --project=newproject

You should now be ready to start building your project.

OPTIONS

scope

Either global or project (deploys cache tables only).

sample

The name of the sample to use to deploy tables. This is only relevant when scope is project. When scope is global this will be ignored.

AUTHOR

Tom Gracey <tomgracey@gmail.com>

COPYRIGHT AND LICENSE

Copyright (c) Tom Gracey 2018

TaskPipe is free software, licensed under

    The GNU Public License Version 3