Skip to content

Commit f96760e

Browse files
authored
Merge pull request #206 from b-tsao/silent-install
Silent installation files
2 parents f7c3d84 + c5af786 commit f96760e

File tree

6 files changed

+471
-0
lines changed

6 files changed

+471
-0
lines changed

silent_install/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Silently installing VS Code and Db2 Developer Extension
2+
3+
The information in this readme describes how to use the provided sample files to deploy an instance of Microsoft Visual Studio Code (VS Code) that has been preconfigured with IBM Db2 for z/OS Developer Extension to one or more Windows client machines.
4+
5+
Extensions are normally packaged as a vsix artifact and these vsix artifact are typically installed manually into VS Code. The purpose of this silent installation is to automate this installation process consistently across an environment.
6+
7+
---
8+
9+
**IMPORTANT:** The script, sample json files, and instructions are provided only as an example of how you can automate the installation of VS Code and Db2 Developer Extension. Use them as a reference to create an automated installation process for your specific purposes.
10+
11+
---
12+
13+
**CAUTION:** Running the script that is provided in this package will replace any existing VS Code installations with a clean VS Code environment that includes only Db2 for z/OS Developer Extension. Users who have an existing VS Code environment will lose their VS Code environment including all the extensions that they have installed and all customizations that they have made. Handling installations in which users are already using VS Code will require more complex scripting and is outside the scope of these materials.
14+
15+
## Components involved in the installation
16+
17+
This installation process involves several sample files that you will customize for your environment and several external components that you will need to obtain on your own. You must include all components listed in this section when you create your installation package.
18+
19+
The provided sample files include:
20+
21+
- A Powershell script (setup.ps1) for installing and configuring VS Code and Db2 Developer Extension on Windows
22+
23+
- settings.json, which controls the VS Code settings for Db2 Developer Extension on each client machine
24+
25+
- connections.json, which you can use to specify the Db2 connections that you want to create on each client machine
26+
27+
- tuning_services_servers.json and tuning_associations.json, which you can use to add a tuning services server and to associate a tuning profile with a Db2 connection
28+
29+
Components that you need to obtain or provide include:
30+
31+
- The VS Code installer, which you can download from https://code.visualstudio.com/download.
32+
33+
- The Db2 for z/OS Developer Extension vsix artifact, which you can download from https://github.com/IBM/db2forzosdeveloperextension-about/releases
34+
35+
- A valid jcc license
36+
37+
## Before you begin
38+
39+
- Make sure that Java is installed on each client machine that you intend to deploy VS Code and Db2 Developer Extension.
40+
41+
- If you intend to use Db2 Developer Extension to analyze and tune SQL statements, ensure that SQL Tuning Services has been installed and that a connection to the SQL Tuning Services server is available.
42+
43+
## Instructions
44+
45+
1. Download the VS Code installer and the Db2 Developer Extension vsix artifact from the locations identified in the “Components involved in the installation section” and obtain the jcc license file for your organization. Save these files in the same folder as the setup.ps1 script and sample json files.
46+
47+
2. Edit setup.ps1 and set the following variables:
48+
49+
- Set the `InstallerPath` variable to the folder where you saved the installation files.
50+
51+
- Set the `JccLicensePath` variable to the name of your Db2 for z/OS JCC driver license.
52+
53+
At the time of this writing, the values for the `VSCodeInstallerName` and `VSCodeExtensionName` variables were current. These values will need to be updated when newer versions of the installer or extension are released.
54+
55+
3. Optional: Specify any Db2 connections, SQL Tuning Services servers, and tuning profile associations that you want to predefine on client workstations.
56+
57+
**IMPORTANT:** The connections.json, tuning_services_servers.json, and tuning_associations.json files are provided as examples of the settings for these items. However, instead of modifying these files directly, it is recommended that you copy the relevant files from an existing Db2 Developer Extension installation on which the connections, tuning servers, and tuning profile information have already been defined. By default, this information is stored in the following files:
58+
59+
- `<VSCode_location_path>/globalStorage/ibm.db2forzosdeveloperextension/connections.json`
60+
- `<VSCode_location_path>/globalStorage/ibm.db2forzosdeveloperextension/tuning_services/tuning_services_servers.json`
61+
- `<VSCode_location_path>/globalStorage/ibm.db2forzosdeveloperextension/tuning_services/tuning_associations.json`
62+
63+
4. Customize the sample settings.json file with any VS Code settings for Db2 Developer Extension that you want to apply as defaults across your environment. See https://code.visualstudio.com/docs/editor/extension-marketplace#_configuring-extensions for an explanation of VS Code settings.
64+
65+
The sample setting.json file contains the following parameters:
66+
67+
- `db2forzosdeveloperextension.db2sqlservice.dependencies` specifies the path to where Db2z jcc license is available.
68+
69+
- `db2forzosdeveloperextension.java.home` specifies the path to where JAVA_HOME is available.
70+
71+
- `db2forzosdeveloperextension.db2sqlservice.port` specifies the port that is used exclusively for inter-process communication (IPC), which means that no traffic must go through a firewall.
72+
73+
- `db2forzosdeveloperextension.db2sqlservice.debugger.sessionManagerPort` specifies the port that needs to be available for traffic inbound via client machine firewall.
74+
75+
**Note:** These four settings, as well as additional Db2 Developer Extension settings, can be modified manually after the extension has been installed. To do so, click the **Manage** icon at the lower left corner of the VS Code window, then click **Settings > Extension > IBM Db2 for z/OS Developer Extension**.
76+
77+
5. Make sure that the script, sample json files, VS Code installer, and Db2 Developer Extension vsix artifact are in the same folder.
78+
79+
6. The script is now ready to run. Deploy it using whatever mechanism you use to perform silent installations.
80+
81+
After the script completes sucessfully on each client workstation, users should be able to open VS Code and see that Db2 Developer Extension is installed. If you defined Db2 connection information and SQL Tuning Services information, users should see this information in the primary side bar of the Db2 Developer Extension interface.
82+
83+
## Troubleshooting
84+
85+
This section documents some common installation problems and potential solutions:
86+
87+
- The following error indicates that your system is not enabled to run scripts:
88+
89+
```
90+
.\setup.ps1 : File C:\Users\Administrator\Downloads\setup\setup.ps1 cannot be loaded because running scripts is disabled on this system.
91+
```
92+
93+
If so, run the `Set-ExecutionPolicy RemoteSigned` command and then rerun setup.ps1. After you run the script, run the `Set-ExecutionPolicy Restricted` command to revert to the previous security setting.
94+
95+
- If you receive the following error message:
96+
97+
```
98+
Access to the registry key
99+
100+
'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.
101+
102+
To change the execution policy for the default (LocalMachine) scope,
103+
start Windows PowerShell with the "Run as administrator" option.
104+
105+
To change the execution policy for the current user,
106+
run "Set-ExecutionPolicy -Scope CurrentUser".
107+
```
108+
109+
Run the `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser` command.

silent_install/connections.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"16160e89-8ce2-45d0-9045-fda49e87a11d": {
3+
"name": "Db2zHost/LOCATION",
4+
"server": "Db2zHost",
5+
"port": "446",
6+
"location": "LOCATION",
7+
"authType": "REGULAR",
8+
"savePassword": false,
9+
"traceLevel": 0,
10+
"traceFileAppend": false,
11+
"tuningProfileToggle": true,
12+
"jdbcProperties": {
13+
"ExampleJdbcProp": "ExampleJdbcVal"
14+
}
15+
}
16+
}

silent_install/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"db2forzosdeveloperextension.db2sqlservice.dependencies": "C:\\Users\\Administrator\\Documents\\lib\\*",
3+
"db2forzosdeveloperextension.java.home": "C:\\Program Files\\Java\\jre1.8.0_431",
4+
"db2forzosdeveloperextension.db2sqlservice.port": "3000-3050",
5+
"db2forzosdeveloperextension.db2sqlservice.debugger.sessionManagerPort": "4555-4605"
6+
}

0 commit comments

Comments
 (0)