Lorex L. Yang
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
3
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
FHIR 伺服器建置指南 === [TOC] ## 說明 FHIR 有非常多伺服器端的實作,這邊使用的是 HAPI FHIR。這是一套由加拿大醫療研究組織 UHN 開發的 FHIR 伺服器,有一個還不錯用的前端管理介面,並且是 Open Source Project。 ## 範例實作架構 ### 如果你有多台主機... ![](https://i.imgur.com/HkqOaRc.png) ### 如果你只有一台主機... ![](https://i.imgur.com/aGiEmCl.png) ## 安裝 CentOS 8 CentOS 8 目前還在 Pre-Release 階段,不過已經相當穩定,軟體版本也比較新,可以投入在正式環境上使用。如果還是不放心的話,可以安裝 CentOS 7 就好。 CentOS 8 下載連結:http://isoredirect.centos.org/centos/8-stream/isos/x86_64/CentOS-Stream-x86_64-dvd1.iso 因為安裝方法跟安裝其他 OS 一樣,就懶得寫了,請自行安裝在實體伺服器上。 ## 建置 MariaDB Server ### 安裝 MariaDB 是 MySQL 的 Open Source Alternative Solution,截至目前的穩定版本是 10.4 版,直接上 repo 然後安裝就好。 首先新增 repo 檔案: ```bash= $ vim /etc/yum.repos.d/mariadb.repo ``` 然後貼入以下內容: ```bash= # MariaDB 10.4 CentOS repository list - created 2019-12-17 04:08 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos8-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 ``` 然後安裝 Sever 後啟動: ```bash= # 新的 CentOS 8 跟 Fedora 一樣都改用 dnf 作為套件管理員 # 不習慣的話也可以繼續用 yum,效果是一樣的 # 安裝服務,並使用我們剛剛新增的 source repo 抓套件 $ sudo dnf install boost-program-options $ sudo dnf install MariaDB-server MariaDB-client --disablerepo=AppStream # 啟動服務 $ sudo systemctl start mariadb # 設定開機自動啟動 $ sudo systemctl enable mariadb ``` 啟動後可以使用以下指令確認服務是否正確開啟: ```bash= $ sudo systemctl status mariadb ``` 看到 ==**Active: active(running)**== 代表成功了 ![](https://i.imgur.com/Pq2xMAt.png) ### 初次設定 先進行初次設定: ```bash= $ sudo mysql_secure_installation Enter current password for root (enter for none): <初次啟動密碼為空,直接 enter 就好> ``` 然後照著畫面指示操作,改完密碼整路 ==Y== 到底,就完成初始化設定了。 ### 新增資料庫 先登入資料庫: ```bash= # 登入 MariaDB server # 第一次登入通常使用者名稱使用 root 就好 # 本機登入的話,主機 IP 輸入 localhost $ mysql -h <主機IP> -u <使用者名稱> -p Enter Password: <輸入密碼> ``` 新增使用者: ```sql= CREATE USER '<使用者名稱>'@'<FHIR 伺服器 IP>' IDENTIFIED BY '<密碼>'; ``` 新增資料庫並設定預設使用 utf8 編碼: ```sql= CREATE DATABASE <資料庫名稱> CHARACTER SET utf8 COLLATE utf8_general_ci; ``` 將資料庫權限給使用者: ```sql= GRANT ALL PRIVILEGES ON <資料庫名稱>.* TO '<使用者名稱>'@'<FHIR 伺服器 IP>' IDENTIFIED BY '<密碼>'; ``` 套用更新: ```sql= FLUSH PRIVILEGES; ``` ## 建置 Docer CE HAPI FHIR 是使用 Java 寫成的,如果會自己架環境的話也可以直接安裝在 Jetty Server 上,考量到操作難易度與易用性問題,這邊會將 HAPI FHIR 封裝成 Docker Image 並跑在 Docker CE 上面。 ### 安裝 Docker 目前有分要錢的 EE 跟社群版的 CE,我們安裝 CE 版本的就可以了。 新增 Repo 檔案: ```bash= $ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo ``` 然後安裝並啟動服務: ```bash= # 安裝服務 $ sudo dnf install docker-ce --nobest -y # 啟動服務 $ sudo systemctl start docker # 設定開機自動啟動 $ sudo systemctl enable docker ``` ### 測試 Docker 是否正確啟用 直接跑 hello world image 就好了: ```bash= $ sudo docker run hello-world ``` 出現執行畫面就代表成功了 ![](https://i.imgur.com/Vk9LaOQ.png) ## 建置 FHIR Server ### 前置作業 安裝 git 與編譯環境後抓 HAPI FHIR Repo: ```bash= # 安裝 git $ sudo dnf install epel-release $ sudo dnf install git # 安裝編譯環境 $ sudo dnf install java-8-openjdk-devel $ sudo dnf install maven # 抓 repo $ git clone https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git ``` ### 配置組態 #### 配置 Dockerfile 組態 ```bash= $ vim hapi-fhir-jpaserver-starter/Dockerfile ``` 將內容取代為以下設定: ```dockerfile= FROM jetty:9-jre8-alpine USER jetty:jetty ADD ./target/hapi-fhir-jpaserver.war /var/lib/jetty/webapps/root.war EXPOSE 8080 # 可自訂監聽 Port ``` #### 配置 FHIR Server 組態 打開組態檔: ```bash= $ vim hapi-fhir-jpaserver-starter/src/main/resources/hapi.properties ``` 找到以下設定然後編輯: ```bash= fhir_version=R4 server_address=<伺服器位址> datasource.driver=com.mysql.jdbc.Driver datasource.url=jdbc:mysql://<資料庫位址>:3306/<資料庫名稱> hibernate.dialect=org.hibernate.dialect.MySQL5Dialect datasource.username=<資料庫帳號> datasource.password=<資料庫密碼> ``` ## 執行 編譯後包成 docker image: ```bash= # 編譯 $ mvn clean package # 包成 Docker Image # 記得最後面的 . 要打 $ docker build -t <Image 名稱> . ``` 從包好的 Image 建立一個 Instance: ```bash= # 如果剛剛 Dockerfile 有改監聽 port,就要把 8080 改掉 $ docker run -d -p <外部 Port>:8080 <Image 名稱> # 例如把伺服器開在主機的 3000 Port 上 $ docker run -d -p 3000:8080 hapifhir/r4 ``` Docker CE 會回傳一組 ID,即代表這個 Instance 的 Container ID。 建置完成後,打開 **http://<Server IP>:<外網 Port>**,看到以下介面即代表成功: ![](https://i.imgur.com/3H7iCY1.png) 另外也可以透過以下指令監看輸出: ```bash= # 附加至 Container 內查看 $ docker attach <Container ID> # 如果不知道 Container ID 也可以用以下指令查看 $ docker ps ```

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully