New post

Find

Announcement
· Oct 2, 2024

In-person Developer Meetup on Security - October 15, Cambridge, MA

Hi Community,
We invite you to join our next Developer Meetup in Cambridge, MA on October 15th, 2024.
This time we’ll focus on Data & Security. Our security experts will be sharing their insights and knowledge.

>> RSVP here <<

Agenda:

1️⃣ Security trends, attacks and threats. Practical tools and frameworks
by Mark-David McLaughlin, Director, Corporate Security, InterSystems

2️⃣ Zero Trust Architecture
by Jonathan Sue-Ho, Senior Security Engineer, InterSystems

⏱ Day and Time: October 15, 5:30 p.m. to 7:30 p.m.
📍CIC Venture Café in Cambridge, Massachusetts

Save your seat now!

Food, beverages, and networking opportunities will be provided as always.
Join our Discord channel to connect with developers from the InterSystems developer ecosystem.

Discussion (0)1
Log in or sign up to continue
Article
· Oct 2, 2024 14m read

Control IRIS database schema changes with Liquibase

In the modern world, the most valuable asset for companies is their data. Everything from business processes and applications to transactions is based on data which defines the success of the organization's operations, analysis, and decisions. In this scenario, the data structures need to be ready for frequent changes, yet in a managed and governed way. Otherwise, we will inevitably lose money, time, and quality of corporate solutions.
For a long time, data management and governance were solely based on the data itself, with excellent backup, restoration, ACID (Atomicity, Consistency, Isolation, and Durability) resources, authentication/authorization controls, logging, and tracing. However, since the business has become more dynamic and agile, changes in data structures have generated many outages and system breakdowns. To resolve this, DDL (Data Definition Language) source code management solutions were created. Two of those great solutions have become market references: Liquibase and Flyway. None of them, however, supported InterSystems IRIS until 2023, when Dmitry Maslennikov released a Liquibase extension for IRIS, making it possible to add IRIS DDLs to DevOps pipelines. The IRIS Liquibase extension is an open-source product, and it is currently published on https://openexchange.intersystems.com/package/liquibase-iris.
This article will detail what Liquibase is and how to use it to manage data structures together with the extension created by Dmitry, liquibase-iris.

What is Liquibase?

Liquibase is a database schema change management solution that enables you to revise and release database changes faster and safer from development to production. To start using Liquibase quickly and easily, you can write your migration scripts in SQL. To take advantage of database abstraction abilities that allow you to write changes and deploy them to different database platforms, you can specify database-agnostic changes in XML, JSON, or YAML(https://docs.liquibase.com/concepts/introduction-to-liquibase.html).

Liquibase Workflow


Changelogs

Liquibase uses SQL, XML, JSON, and YAML changelog files to list database changes in sequential order. Those database alterations have the format of changesets that contain Change Types, which are types of operations to apply to the database, e.g., adding a column or primary key. Context, label, and precondition changelog tags help us control precisely when a database modification was made and to which database environment it was deployed. (https://docs.liquibase.com/concepts/introduction-to-liquibase.html).

Liquibase properties file

To set the link between Liquibase and your database, you need to know the database connection information and parameters. Liquibase includes a properties file to store database connection information and parameters that rarely change. Setting those parameters as environment variables to handle sensitive database information or running them at the command prompt is an alternative option.

Liquibase commands

Liquibase runs six basic types of commands: update, rollback, snapshot, diff, status, and utility. When you use the update command to deploy your first alterations, Liquibase checks the database connection information, including credentials, database URL, and JDBC driver.

Database Changelog and Database Changelog Lock

When you deploy your changes, Liquibase creates two tables in your database: DATABASECHANGELOG and DATABASECHANGELOGLOCK.
The DATABASECHANGELOG table tracks deployed modifications for you to have a record. Liquibase compares the changesets in the changelog file with the DATABASECHANGELOG tracking table and deploys only new changesets.

DATABASECHANGELOGLOCK prevents multiple instances of Liquibase from updating the database simultaneously. It manages access to the DATABASECHANGELOG table during deployment and ensures that only one instance of Liquibase is updating the database.

Database management options

Liquibase offers many ways to manage your database changes:

  • Run the command-line client (CLI).
  • Use the Liquibase Java API and integrate Liquibase into your application to deploy database modifications on the application startup.
  • Integrate Liquibase into your build processes using Maven, Spring Boot, Ant, Jenkins, GitHub Actions, or other CI/CD tools.
  • Combine Liquibase with ephemeral environments in Docker.

Step-by-step instructions on Liquibase with IRIS

Install Liquibase

To employ Liquibase CLI, install Liquibase on your OS:
1. Install Java (if you do not have it yet).
2. Download Liquibase CLI (https://www.liquibase.com/download):

3. If necessary, you can download the Windows or Mac installer or simply get the zip file and extract it to any folder.
4. Add the Liquibase installation directory to your system PATH (when you use the Installer, the path is included automatically).
5. From a command line or terminal, type liquibase --version to verify that Liquibase has been installed successfully:



Set Liquibase for your IRIS project

We will use a sample to see Liquibase in action, so follow the next steps:
1. Do a git clone for the project intersystems-iris-dev-template (https://openexchange.intersystems.com/package/intersystems-iris-dev-temp...):

git clone https://github.com/intersystems-community/intersystems-iris-dev-template.git

2. Go to the folder intersystems-iris-dev-template and open the project on VSCode:

3. Open a new Terminal:

4. Run the project:

5. After the project has started, go to the Docker Desktop > Containers and expand intersystems-iris-dev-template; then get the host port for the superport 1972 (in my case it is 51418):

6. Create the file liquibase.properties in the root project folder with the following content (pay attention to the right port on the URL, in my case, it is 51418):

driver: com.intersystems.jdbc.IRISDriver
classpath: ./lib/intersystems-jdbc-3.8.4.jar
url: jdbc:IRIS://127.0.0.1:51418/USER
username: _SYSTEM
password: SYS
changeLogFile: db.changelog.xml

7. Create the file db.changelog.xml in the root project folder with the following content:
 

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
        http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
    <changeSet  id="1"  author="yuri">
        <createTable schemaName="dc_sample"  tableName="persons">
            <column  name="id"  type="int"  autoIncrement="true">
                <constraints  primaryKey="true"  nullable="false"/>
            </column>
            <column  name="firstname"  type="varchar(50)"/>
            <column  name="lastname"  type="varchar(50)">
                <constraints  nullable="false"/>
            </column>
            <column  name="state"  type="char(2)"/>
        </createTable>
    </changeSet>
    <changeSet  id="2"  author="yuri">
        <addColumn  schemaName="dc_sample" tableName="persons">
            <column  name="username"  type="varchar(8)"/>
        </addColumn>
    </changeSet>
    <changeSet  id="3"  author="yuri">
        <addLookupTable existingTableSchemaName="dc_sample"
            existingTableName="persons" newTableSchemaName="dc_sample"  existingColumnName="state"
            newTableName="state"  newColumnName="id"  newColumnDataType="char(2)"/>
    </changeSet>
</databaseChangeLog>

8. Using the terminal, execute the command liquibase update on the root folder:

9. Look at the results on the terminal:

All three defined changesets have run successfully.
 

10. Check out the results on Management Portal or on DBeaver:

11. Run the history command to review all the changes that were made:

Liquibase commands

In addition to the update command, the Liquibase is equipped with more than 40 different commands providing its users the ability to execute various database change management operations (source: https://docs.liquibase.com/commands/home.html).

Database update commands

Command Description
rollback It rolls the database back to the state it was in when the tag was applied.
rollback-sql This helper command produces the raw SQL Liquibase that will run when operating the rollbackByTag command.
rollback-to-date It rolls the database back to the state it was in at the given date/time.
rollback-to-date-sql This helper command allows you to inspect the SQL Liquibase will run while employing the rollback-to-date command.
rollback-count It rolls back the last <value> changesets.
rollback-count-sql It writes SQL to roll back the previous <value> changesets to STDOUT.
future-rollback-sql It writes SQL to roll back the database to the current state after the changes in the changelog have been applied.
future-rollback-count-sql It generates the SQL that Liquibase would use to sequentially revert the number of alterations associated with undeployed changesets that have been added to a changelog file.
future-rollback-from-tag-sql It produces the raw SQL Liquibase would need to roll back all undeployed modifications made up to the specified tag.

 

Database inspection commands

Command Description
diff It describes differences between two databases to standardize them.
diff JSON It allows you to compare two databases of the same or different types and use the output in a JSON format.
diff-changelog It adds any differences between the specified databases to a changelog. It can be appended in any supported changelog format.
generate-changelog It generates a changelog from a database when you add Liquibase to a new project. It is synonymous with snapshots except that it saves the output as XML in the changelog.
snapshot It gathers the current database schema and displays this information to STDOUT. There is also an option to save the schema in JSON format and later use that JSON snapshot as a comparison database.
snapshot-reference It captures the current state of the referenceURL database, which is the source database.

 

Change tracking commands

Command Description
history It lists all deployed changesets and their deploymentIDs.
status It outputs the count (or list, if --verbose) of changesets that have not been deployed.
unexpected-changesets It produces a list of changesets that were run in the database but do not exist in the current changelog.

All other commands are documented on the following webpage: https://docs.liquibase.com/commands/command-list.html.

Liquibase Change Types

A Change Type is a database-independent XML, YAML, or JSON formatted modification that you can specify to update your database with Liquibase. Change Types correspond to SQL statements applied to your database, e.g., CREATE TABLE.You determine the Change Type you wish to employ within a Changeset in your Changelog (source: https://docs.liquibase.com/change-types/home.html). This tutorial utilized XML change type. However, it is possible to work with YAML or JSON as well. Look at the samples below:

YAML change type

To use YAML-based changelogs, you must include snakeyaml-<version>.jar in your classpath. In the example below, the changelog contains changesets that do the following (source: https://docs.liquibase.com/concepts/changelogs/yaml-format.html):

  1. It creates a new person table with columns id, firstname, lastname, and state;
  2. It adds a new username column to the person table;
  3. It creates a lookup table state using data from a person.
databaseChangeLog:
- changeSet:
      id:  1
      author:  your.name
      labels: example-label
      context: example-context
      comment: example-comment
      changes:
       - createTable:
            tableName:  person
            columns:
              - column:
                  name:  id
                  type:  int
                  autoIncrement:  true
                  constraints:
                    primaryKey:  true
                    nullable:  false
              - column:
                  name:  name
                  type:  varchar(50)
                  constraints:
                    nullable:  false
              - column:
                  name:  address1
                  type:  varchar(50)
              - column:
                  name:  address2
                  type:  varchar(50)
              - column:
                  name:  city
                  type:  varchar(30)
- changeSet:
      id:  2
      author:  your.name
      labels: example-label
      context: example-context
      comment: example-comment
      changes:
       - createTable:
            tableName:  company
            columns:
              - column:
                  name:  id
                  type:  int
                  autoIncrement:  true
                  constraints:
                    primaryKey:  true
                    nullable:  false
              - column:
                  name:  name
                  type:  varchar(50)
                  constraints:
                    nullable:  false
              - column:
                  name:  address1
                  type:  varchar(50)
              - column:
                  name:  address2
                  type:  varchar(50)
              - column:
                  name:  city
                  type:  varchar(30)
- changeSet:
      id:  3
      author:  other.dev
      labels: example-label
      context: example-context
      comment: example-comment
      changes:
       - addColumn:
            tableName:  person
            columns:
              - column:
                  name:  country
                  type:  varchar(2)

JSON Change Type

When operating a JSON-based changelog file, you need to select one of the following ways to audit your database and execute alterations (source: https://docs.liquibase.com/concepts/changelogs/json-format.html):

  • Pass it as an argument in the command line during runtime:
liquibase update --changelog-file=example-changelog.json
  • Specify it in the Liquibase properties file:
changelog-file: ../example-changelog.json

You can also include other related properties in the properties file, e.g., searchPath, which defines the directories and .jar files to search for changelog files. If you have multiple files, they can be separated with commas. Check out the following sample:

{
    "databaseChangeLog": [
      {
        "changeSet": {
          "id": "1",
          "author": "yuri",
          "changes": [
            {
              "createTable": {
                "tableName": "person",
                "columns": [
                  {
                    "column": {
                      "name": "id",
                      "type": "int",
                      "autoIncrement": true,
                      "constraints": {
                        "primaryKey": true,
                        "nullable": false
                      },
                     
                    }
                  },
                  {
                    "column": {
                      "name": "firstname",
                      "type": "varchar(50)"
                    }
                  },
                  {
                    "column": {
                      "name": "lastname",
                      "type": "varchar(50)",
                      "constraints": {
                        "nullable": false
                      },
                     
                    }
                  },
                  {
                    "column": {
                      "name": "state",
                      "type": "char(2)"
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "changeSet": {
          "id": "2",
          "author": "robert",
          "changes": [
            {
              "addColumn": {
                "tableName": "person",
                "columns": [
                  {
                    "column": {
                      "name": "username",
                      "type": "varchar(8)"
                    }
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "changeSet": {
          "id": "3",
          "author": "carlos",
          "changes": [
            {
              "addLookupTable": {
                "existingTableName": "person",
                "existingColumnName": "state",
                "newTableName": "state",
                "newColumnName": "id",
                "newColumnDataType": "char(2)",
               
              }
            }
          ]
        }
      }
    ]
}

SQL Change Type

It is possible to operate SQL as a change type as well. However, database independence will not be guaranteed once product-specific SQL has been written (click the following link for more information: https://docs.liquibase.com/concepts/changelogs/sql-format.html). Take a look at the sample below:
 

--liquibase formatted sql
--changeset your.name:1 labels:example-label context:example-context
--comment: example comment
create table person (
    id int primary key auto_increment not null,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)
--rollback DROP TABLE person;
--changeset your.name:2 labels:example-label context:example-context
--comment: example comment
create table company (
    id int primary key auto_increment not null,
    name varchar(50) not null,
    address1 varchar(50),
    address2 varchar(50),
    city varchar(30)
)
--rollback DROP TABLE company;
--changeset other.dev:3 labels:example-label context:example-context
--comment: example comment
alter table person add column country varchar(2)
--rollback ALTER TABLE person DROP COLUMN country;


Using Liquibase on DevOps projects

You can also use Liquibase on DevOps projects. It means that whenever your database creation/modification source code is uploaded to GitHub or GitLab, you can run Liquibase to synchronize the new version with the target database. To do it (when you work with GitHub), you can use a Github action. To see a sample, examine the following link https://github.com/liquibase/liquibase-github-action-example. However, in a nutshell, you must create the folder /.github/workflows/yourfile.yml and write something similar to the code below:
 

on: [push]
jobs:
  test-liquibase-action:
    runs-on: ubuntu-latest
    name: Test Liquibase Action
    steps:
      - uses: actions/checkout@v2
      - uses: liquibase/liquibase-github-action@v2
        with:
          operation: 'update'
          changeLogFile: 'db.changelog.yml'
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          url: ${{ secrets.URL }}
Discussion (0)2
Log in or sign up to continue
Announcement
· Oct 2, 2024

Ganadores del Concurso de Herramientas de Desarrolladores 2024

Hola Comunidad,

¡Es hora de anunciar a los ganadores del Concurso de Herramientas para Desarrolladores!

Gracias a todos nuestros increíbles participantes que enviaron 17 aplicaciones 🔥

¡Es hora de anunciar a los ganadores!

Nominación de los expertos

🥇 1er lugar $5,000 son para iterm aplicación por @Dmitry Maslennikov

🥈 2do lugar y $3,000 son para sql-embeddings aplicación por @José Pereira, @Henry Pereira@Henrique Dias

🥉 3er y 4to lugar $1,125 para cada uno son para DX Jetpack for VS Code aplicación por @John Murrayiris-ccd-devtools aplicación por @Chi Nguyen-Rettig 

🏅 5to lugar $500 son para IPM in VS Code aplicación por @John Murray

🌟 $100 son para IOP REST Client Framework aplicación por @Antoine.Dh

🌟 $100 son para Irisheimer aplicación por @Zacchaeus Chok 

🌟 $100 son para db-management-tool aplicación por @Andrii Mishchenko 

🌟 $100 son para iris-DataViz aplicación por @Muhammad Waseem

🌟 $100 son para iris-dev-codeinspector aplicación por @Rodolfo Moreira dos Santos 

Nominación de la comunidad

🥇 1er lugar y $1,000 son para iterm aplicación por @Dmitry Maslennikov

🥈 2do lugar y $750 son para IRIS-Test-Data-Generator aplicación por @Dylan Cole

🥉 3er lugar y $500 son para sql-embeddings aplicación por @José Pereira, @Henry Pereira@Henrique Dias

🏅 4to lugar $300 son para IPM in VS Code aplicación por @John Murray

🏅 5to lugar $200 son para DX Jetpack for VS Code aplicación por @John Murray 

¡Nuestras más sinceras felicitaciones a todos los participantes y ganadores!

Uníos a la diversión la próxima vez ;)

2 Comments
Discussion (2)1
Log in or sign up to continue
Announcement
· Oct 1, 2024

InterSystems ウォーキング・チャレンジにぜひご参加ください!(USコミュニティ)

開発者の皆さん、こんにちは!

USコミュニティで現在開催しているいつもとちょっと違ったコーディングではないイベント:🚶‍♀️InterSystems ウォーキング・チャレンジ🚶‍♂️をご案内します!

(通勤通学でよく歩いている方、賞品Getのチャンスです!)

InterSystemsのウォーキング・チャレンジは、あなたの心を充電し、フィットネスを高めるのに役立ちます。 リューベックからリューネブルクまで、何世紀も前にヨーロッパを結んだ伝説の交易路「塩の道」を歩くバーチャルな旅に出かけましょう。

そして、トレッドミル、スマートウォッチ、メダルなどのエキサイティングな賞品をゲットしましょう!

👟🚶🧑‍🦼Lace Up, Step Out, and Code Better! 🔋💻💪

📅 期間:2024年9月23日~10月20日 11月8日まで(11月22日18時CETにこのチャレンジは終了します)

参加されたい方、以下詳細をご参照ください。

参加方法

アプリをダウンロードするか、Web版 を利用し、ミッションコード「SupplyChain」を入力すれば、好きな場所で自分のペースで、無料で旅を始めることができ、ウォーカー、ランナー、ホイーラーとして参加できます。イベントで使用するアプリ:My Virtual Missionと同期する歩数計などの機能を持つアプリ(Apple Health、Google Fit、Under Armourなど)を選択するだけで開始できます。

アプリを開始日から少し遅れて参加した場合は、デバイスからデータをさかのぼってアップロードすることができます。リーダーボードに積極的に参加し、あなたのアップダウンを共有することで、みんなのモチベーションを維持し、チャレンジモードにしていきましょう!

 

賞と賞品について

参加者には特別は賞品が用意されています。「塩の道」を完走した人にはメダルが授与され、さらにコンペティションにも参加できます。 リーダーボードの目標は、歩く、走る、または車椅子に乗って、できるだけ早く塩の道を完走することです。 参加者全員の個人タイムがアプリで計測されます。

完走タイムの上位10名は、さらに多くの賞を獲得することができます。

  • 1位:  APPLE Watch Series 10 GPS + Cellular 46 mm Smartwatch Aluminium Fluoroelastomer
  • 2位~10位: Sportstech Laufband sWalk Plus 2-in-1
  • 11位~30位: エレガントな水筒

(InterSystemsの契約社員も含めた社員も参加できますが、賞品を獲得する資格はありません。)

 

参加方法

  • ウェブ版をご利用の場合は、JOINボタンをクリックするだけでチャレンジに参加できます。 アプリを使用するには、Apple App StoreまたはGoogle Play StoreでMy Virtual Missionアプリをダウンロードしてください。 詳細情報を入力してサインアップした後、JOINリンクをもう一度クリックしてミッションにアクセスしてください。
  • 一歩一歩を大切にカウントするためには、My Virtual Missionを健康関連アプリと同期させる必要があります。 Apple Health、Google Fit、Under Armour、Garmin、FitBit、Strava、Adidas Runningなど、さまざまなサードパーティのフィットネストラッカーと接続できます。 接続はMy Virtual Missionアプリで管理できます:
    • My Virtual Mission アプリを開きます。
    • ホームスクリーンから画面右上にあるメニューをクリックします。
    • CONNECTIONS をクリックします。
    • ご希望のフィットネストラッカーを選択してください。 フィットネストラッカーを接続したら、VIEW MISSIONを選択してミッションページに移動します。画面右上のドロップダウンメニューからSETTINGSを選択します。 ウォーキング・ミッションへの投稿設定を更新することができます。
    • iPhoneの例ですが、ご参考も併せてご参照ください。(Androidをお持ちの方、もしよろしければ使い方を返信欄に投稿いただけると嬉しいです)
  • また、手動で走行距離を投稿することもできます: ミッションページの左下にある「+」アイコンをクリックします。MANUALLY POST A DISTANCEをクリックし、すべての情報と証明写真(例:トレッドミルの距離)を入力します。 ただし、リーダーボードに表示されるまでに時間がかかります。

健康維持、そして幸運を祈ります!

 

ご参考

以下、iPhoneでの操作図例です。My Virtual Missionアプリをインストールし、ミッションと健康関連アプリ(例はApple Health)との同期、そして歩いた距離のPOST例です。(自分でPOSTしないと反映されないのでご注意を!)

後は、スマホでJOINのページに移動して、以下の操作を行います。
    

  

Discussion (0)1
Log in or sign up to continue
Article
· Oct 1, 2024 2m read

第三十七章 结合加密和签名 - 安全标头元素的顺序

第三十七章 验证和解密入站消息

本主题介绍如何验证 IRIS Web 服务或 Web 客户端收到的消息中的安全元素(并自动解密任何加密内容)。

概述

IRIS 网络服务和网络客户端可以验证入站 SOAP 消息的 WS-Security 标头元素,以及自动解密入站消息。

IRIS Web 服务和 Web 客户端还可以处理已签名的 SAML 断言令牌并验证其签名。但是,验证 SAML 断言的详细信息是您的应用程序的责任。

如果使用安全策略,所有上述活动都是自动的。

在所有场景中,IRIS 都使用其根颁发机构证书集合;请参阅设置和其他常见活动。

验证 WS-Security 标头

要验证任何入站 SOAP 消息中包含的 WS-Security 标头元素,请执行以下操作:

Discussion (0)1
Log in or sign up to continue