InterSystems IRIS shared environment using git source control with server-side editing in VS Code.
We will be using git-source-control. You can find more information on Git for Shared Development Environments.
Run the container we will use as our IRIS shared instance:
docker-compose up -d
In the instance, you will find:
- Namespaces:
DEV
(development),PROD
(production). - User:
developer1
/test
Setup IRIS server-side editing in VS Code.
The code in your shared environment will be edited this way.
- Open VS Code
- Install InterSystems ObjectScript Extension Pack
- Click on InterSystems icon
- Add a Server configuration workshop-git-shared-iris
- Open Server
- Edit Dev namespace
- Edit Prod namespace
- Save as VS Code workspace. Save it to a file called "test.code-workspace"
The contents of the file will be something like this:
{
"folders": [
{
"name": "workshop-iris-shared-git:DEV",
"uri": "isfs://workshop-iris-shared-git:dev/"
},
{
"name": "workshop-iris-shared-git:PROD",
"uri": "isfs://workshop-iris-shared-git:prod/"
}
]
}
Now you can access the code of both IRIS namespaces from your VS Code workspace.
Create a new repository in your GitHub account. You will use this repository to store the code for DEV and PROD.
You can name it something like iris-shared-repo
.
You will set up Git for Shared Environments package in InterSystems IRIS.
It is already installed, but you could install it simply running:
zpm "install git-source-control"
Open a InterSystems terminal in VS Code so you can run the next sections:
Run Git for Shared Environments setup:
do ##class(SourceControl.Git.API).Configure()
- Path to git executable:
/usr/bin/git
- Local git repo root folder:
/home/irisowner/repo/DEV/
- Path to private key file for SSH remotes; if file does not exist, later prompts will help set it up with proper ownership:
/home/irisowner/.ssh/id_ed25519
- Default value for the remaining settings
You will be asked if you want to create an SSH key pair. This key will be needed to connect to your GitHub repository securely using SSH.
- Create an SSH key pair?
Yes
- Copy the Public Key for your generated SSH key pair
Public key (for use as "deploy key", etc.):
ssh-ed25519 <somekey> developer1@bf3016a8ae64
- Add the Public key to your GitHub https://github.com/settings/keys so you authorize connections using that key.
Last step of setup let us you choose what do you want to do with the directory we have just specified:
1) Initialize empty repo
2) Clone...
3) Do nothing
No git repo exists in /home/irisowner/repo/DEV/. Choose an option:
Choose 2) Clone and enter the SSH URL of your GitHub repository. This should be something like:
[email protected]:<your-github-user-name>/iris-shared-repo.git
Run a similar setup but for PROD namespace:
zn "PROD"
do ##class(SourceControl.Git.API).Configure()
- Path to git executable:
/usr/bin/git
- Local git repo root folder:
/home/irisowner/repo/PROD/
- Path to private key file for SSH remotes; if file does not exist, later prompts will help set it up with proper ownership:
/home/irisowner/.ssh/id_ed25519
- Default value for the remaining settings
- When you connect to DEV namespace, new Git options will appear in VS Code command line.
- You can also open Git UI.
- We are going to create a local
dev
branch and add a new class:
- After pushing
dev
branch to GitHub remote, create a Pull Request so changes will be merged intomain
branch.
Now you can connect to your PROD namespace and pull changes from main
branch: