IBM UrbanCode PHP CLI Tool - Setup
To run any of the commands provided by UrbanCode PHP CLI , a few steps are needed in order to make the scripts work properly
Setup configuration
In order to make the script work, a valid configuration is needed. This will be used for connecting to the UrbanCode Deploy server and to setup some default values that will be used when executing CLI commands.
You can either use the Setup Wizard, or manual setup, steps listed below.
Setup wizard
The easiest and fastest way to configure UrbanCode PHP CLI is to run the setup script, which will automatically set the values in the configuration file. If you want to manually edit the configuration file, please check section Manual Setup.
Run the setup script and follow the instruction in the console:
cd $uCommand
./setup
Setup script will prompt the user for:
- Server weburl (without htttps and port)
- Port (Default: 8443)
- Username (User email)
- Password
- JAVA_HOME (Default: $JAVA_HOME for the current environment)
- Authtoken (If missing, a new one will be generated)
Script will also check that
Java is installed
- PHP for CLI is installed
- There is a valid connection to the UrbanCode Deploy server
Manual setup
You can manually edit your configuration with your UrbanCode Deployserver information:
vi $uCommand/config/ucd.config.php
Required configuration
The configuration needs to be updated based on the need of the user and on the action that needs to be executed.
Weburl is the url of the UrbanCode Deployserver the tool will work on. It includes the port and http(s).
$config[weburl] = https://example.com:8443; // URL for uDeploy server (with port)
Java_home is the path of the Java binaries used to run the tool
$config[java_home] = ; // specify the path for java binaries
Then you set the username of the user that is running the various actions on the server. Provide here a user with sufficient permissions to run all the required tasks. This is your own user name, e.g. johnsmith@ie.ibm.com.
$config[username] = ; // Your username for uDeploy
Login with tokens
Its possible to login using an authtoken generated by an administrator from the web UI under [UrbanCode Deployserver url]/#security/tokens
Generate a token
To generate an authtoken for your UrbanCode Deploy you need to login to the web UI as an administrator user.
If your account doesnt have administrator permissions, please contact the administrator of your UrbanCode Deploy server to get the followin steps done.
Navigate to [UrbanCode Deployserver url]/#security/tokens and click on Create New Token
In the dialog box, fill the form selecting
- user the token is generated for
- and expiration date and time in the future
- a description
- (OPTIONAL) the IP address allowed to login with that particular authtoken. If Allowed IPs field is left blank, all IPs will be allowed to use the token
Set token in the configuration
Once the token is generated, get it from the list available in [UrbanCode Deploy server url]/#security/tokens, and set it in ucd.config.php
$config[authtoken] = ; // AuthToken for udclient
Please bear mind to use a token correspondingto the user set in the configuration and that is not expired.
Login with password (DEPRECATED)
If you have already set up tokens as the login method, you can skip to Optional configuration. Otherwise, its possible to login with username and password. This is not a secure way to do login, since the password will be hardcoded unencrypted in the configuration file.
$config[password] = {Your_Password}``; // Your password
You can either encode username and password using Base64 encoding. This is still not a secure way to login, since Base64 is easily reversible and your password will be exposed.
Login with Base64 encoding requires you to encode username and password in the following format:
$config[password] = ; // This should be empty
$config[b64_login] = base64_encode( {YOUR_USERNAME}:{YOUR\_PASSWORD}
);
Login with cookies (DEPRECATED)
If you have already set up tokens or password as the login method, you can skip to Optional configuration. Otherwise you can also login using cookies, but this will require some additional steps.
Login to your UrbanCode Deployserver and save the cookies
curl -k -u [username] [UrbanCode Deploy server url:port] -c $WORKSPACE/ucdcookie.txt
Then edit the config so to have blank password and the correct cookie file
$config[password] = ; // This should be empty
$config[cookie_file] = $WORKSPACE/ucdcookie.txt;
Optional configuration
This configuration is not required for UrbanCode PHP CLI to run correctly, but it allows you to customise it for your needs.
$config[application] = ; // Application youre working on
$config[environment] = ; // Your Environment
$config[output] = ; // For backup function where to save exported files
$config[udcpath] = ; // Path where udclient java tool is saved. If blank, will take default
$config[silent] = false; // If true, no message is printed in the console
$config[json_check] = false; // If true, run a scan of exported files and verify that are valid JSON
$config[apply_impersonation] = ; // If true, apply impersonation
Back to … | Latest Version | IBM UrbanCode PHP CLI Tool | |||||
---|---|---|---|---|---|---|---|
All Plugins | Deploy Plugins | 6.714879 | Readme | Overview | Usage | Steps | Downloads |