ホーム 記事一覧 ブック DH週間トピックス 検索 このサイトについて
English
AlfrescoをDockerで起動し、REST APIでレコード管理のライフサイクルを体験する

AlfrescoをDockerで起動し、REST APIでレコード管理のライフサイクルを体験する

概要 本記事では、Alfresco Governance Services Community Edition(以下AGS)の最新版(25.3.0)をDockerで起動し、REST APIを使ってレコード管理の一連のライフサイクルを体験します。 具体的には、以下の業務シナリオを想定します。 シナリオ: 契約書管理 業務部門が契約書を作成・登録する レコード管理者がレコードとして宣言し、ファイルプランに分類する 保持スケジュール(Retention Schedule)を設定する 契約終了後、カットオフ(現用→非現用)を実行する 保持期間(3年)の経過後、廃棄する 訴訟対応が発生した場合、ホールド(凍結)により廃棄を停止する 以下の前回の記事をベースに、最新版での構築手順とAPIの使い方を紹介します。 https://zenn.dev/nakamura196/articles/8da7161ff3df30 環境 acs-deployment: v10.2.0(2026年2月リリース) Alfresco Governance Repository Community: 25.3.0 Alfresco Governance Share Community: 25.3.0 Alfresco Search Services: 2.0.17 Traefik: 3.6 PostgreSQL: 16.5 セットアップ リポジトリのクローン git clone https://github.com/Alfresco/acs-deployment cd acs-deployment git checkout v10.2.0 cd docker-compose compose fileの作成 community-compose.yamlをベースに、Governance Services用のcompose fileを作成します。変更点は以下の3つです。 1. イメージの差し替え サービス 変更前 変更後 alfresco alfresco/alfresco-content-repository-community:25.3.0 alfresco/alfresco-governance-repository-community:25.3.0 share alfresco/alfresco-share:25.3.0 alfresco/alfresco-governance-share-community:25.3.0 2. 認証チケットのタイムアウト対策(後述) ...

Alfrescoのファイルに対して、Archivematicaを使ってAIPを作成する

Alfrescoのファイルに対して、Archivematicaを使ってAIPを作成する

概要 Alfrescoのファイルに対して、Archivematicaを使ってAIPを作成する方法の一例です。 以下が成果物のデモ動画です。 https://youtu.be/7WCO7JoMnWc システム構成 今回は以下のようなシステム構成とします。複数のクラウドサービスを利用していることに特に意味はありません。 Alfrescoは、以下の記事を参考に、Azure上に構築したものを使用します。 Archivematicaとオブジェクトストレージはmdx.jpを使用し、分析環境はGakuNin RDMを使用します。 オブジェクトストレージへのファイルアップロード Alfrescoからファイルをダウンロード Alfrescoからのファイルダウンロードにあたっては、REST APIを使用します。 https://docs.alfresco.com/content-services/6.0/develop/rest-api-guide/ OpenAPIに準拠しており、以下などを参考にしました。 https://api-explorer.alfresco.com/api-explorer/ 例えば以下により、Alfrescoのユーザ名とパスワード、およびホスト名を環境変数から読み込み、メタデータの取得やコンテンツのダウンロードを行うことができました。 # %% ../nbs/00_core.ipynb 3 from dotenv import load_dotenv import os import requests from base64 import b64encode # %% ../nbs/00_core.ipynb 4 class ApiClient: def __init__(self, verbose=False): """Alfresco API Client Args: verbose (bool): デバッグ情報を出力するかどうか """ self.verbose = verbose # .envの読み込み load_dotenv(override=True) # 環境変数の取得 self.user = os.getenv('ALF_USER') self.password = os.getenv('ALF_PASSWORD') self.target_host = os.getenv('ALF_TARGET_HOST') self._debug("環境変数の設定:", { "user": self.user, "password": "*" * len(self.password) if self.password else None, "target_host": self.target_host }) # Basic認証のヘッダーを作成 credentials = f"{self.user}:{self.password}" encoded_credentials = b64encode(credentials.encode()).decode() self.headers = { 'accept': 'application/json', 'authorization': f'Basic {encoded_credentials}' } self._debug("ヘッダーの設定:", { "accept": self.headers['accept'], "authorization": "Basic ***" }) def _debug(self, message: str, data: dict = None): """デバッグ情報を出力する Args: message (str): メッセージ data (dict, optional): 追加のデータ """ if self.verbose: print(f"🔍 {message}") if data: for key, value in data.items(): print(f" - {key}: {value}") def get_nodes_nodeId(self, node_id: str): """ノードIDでノード情報を取得する Args: node_id (str): ノードID Returns: dict: ノード情報 """ url = f"{self.target_host}/alfresco/api/-default-/public/alfresco/versions/1/nodes/{node_id}" self._debug("APIリクエスト:", {"url": url}) try: response = requests.get( url, headers=self.headers, timeout=float(30) ) response.raise_for_status() return response.json() except requests.exceptions.Timeout: self._debug("エラー:", {"type": "timeout", "message": "リクエストがタイムアウトしました"}) return None except requests.exceptions.RequestException as e: self._debug("エラー:", {"type": "request", "message": str(e)}) return None def get_nodes_nodeId_content(self, node_id: str, output_path: str): """ノードのコンテンツを取得する Args: node_id (str): ノードID output_path (str): 出力パス """ url = f"{self.target_host}/alfresco/api/-default-/public/alfresco/versions/1/nodes/{node_id}/content" self._debug("APIリクエスト:", { "url": url, "output_path": output_path }) response = requests.get(url, headers=self.headers) binary_data = response.content os.makedirs(os.path.dirname(output_path), exist_ok=True) with open(output_path, "wb") as file: file.write(binary_data) self._debug("ファイル保存完了:", { "size": len(binary_data), "path": output_path }) オブジェクトストレージにファイルをアップロード boto3と、オブジェクトストレージのENDPOINT_URL、ACCESS_KEY、SECRET_KEYおよびBUCKET_NAMEなどを使用して、ファイルのアップロード(とダウンロード)を行います。 ...

Alfresco Governance Services Community Editionを起動する

Alfresco Governance Services Community Editionを起動する

概要 以下のマニュアルを参考に、Alfresco Governance Services Community Editionのインストールを試みましたので、備忘録です。 https://support.hyland.com/r/Alfresco/Alfresco-Governance-Services-Community-Edition/23.4/Alfresco-Governance-Services-Community-Edition 参考 同様の取り組みとして、以下があります。こちらも参考にしてください。 https://irisawadojo.blogspot.com/2020/11/72alfresco2.html 仮想マシン 以下のマシンをAzureの仮想マシンとして作成しました。 イメージ: Ubuntu Server 24.04 LTS - Gen2 VM アーキテクチャ: x64 サイズ: Standard D2ads v6 (2 vcpu 数、8 GiB のメモリ) 8080ポートを使用するために、ポートを開けておきます。 Dockerのインストール Dockerをインストールします。 sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg # Docker の公式 GPG キーを追加 sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null sudo chmod a+r /etc/apt/keyrings/docker.asc # Docker のリポジトリを追加 echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update # Docker をインストール sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # sudo なしで Docker を実行 sudo usermod -aG docker $USER newgrp docker # Docker の動作確認 docker run hello-world インストール 以下の「Install using Docker Compose」を使用します。 ...