ivan tsai
    • 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
    • Invite by email
      Invitee

      This note has no invitees

    • 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
    • Note Insights New
    • 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 Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
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
  • Invite by email
    Invitee

    This note has no invitees

  • 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 官方文件配置 基本上配置方法與快速配置相似可參閱[官方文件](https://hub.docker.com/r/domjudge/domserver/) # DOMjudge server 需與judgehost image搭配使用 # 所需的 container MairaDB container --- 在啟用DOMserver之前,請先確保已經建立MySQL/MairaDB資料庫,或者簡單的跟著操作使用MariaDB docker container。 **因為DOMserver啟用後會將資料寫進資料庫,若未先安裝資料庫資料會無法寫入。** 透過以下指令可以簡單地建立一個 MairaDB container: ``` docker run -it --name dj-mariadb -e MYSQL_ROOT_PASSWORD=rootpw -e MYSQL_USER=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_DATABASE=domjudge -p 13306:3306 mariadb --max-connections=1000 ``` 說明 : ```c= docker run -it "執行docker container" --name dj-mariadb "給container名稱" -e MYSQL_ROOT_PASSWORD=rootpw "root password設定" -e MYSQL_USER=domjudge "user name設定" -e MYSQL_PASSWORD=djpw "user password設定" -e MYSQL_DATABASE=domjudge "資料庫名稱" -p 13306:3306 mariadb "host port : container port 之間的 mapping" --max-connections=1000 "最大連線數設定" ``` 因為有設定 host 的 port ,為了方便操作資料庫也可以使用 MySQL GUI(phpmyadmin等) 如果要在移除container後保存MySQL的資料,可以參照[MariaDB](https://hub.docker.com/_/mariadb)的Docker Hub獲取更多資訊。 DOMserver container --- 如果你使用的系統是Linux,請先確保啟用了cgroup,可以參考此[文件](https://www.domjudge.org/docs/manual/main/install-judgehost.html#linux-control-groups) Windows或是macOS系統的docker實際上已經使用了有設置cgroup選項的小型Linux VM 可以透過以下指另行直domserver: ``` docker run --link dj-mariadb:mariadb -it -e MYSQL_HOST=mariadb -e MYSQL_USER=domjudge -e MYSQL_DATABASE=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_ROOT_PASSWORD=rootpw -p 12345:80 --name domserver domjudge/domserver:latest ``` 說明: ```c= docker run --link dj-mariadb:mariadb "取用mairadb service" -it -e MYSQL_HOST=mariadb "以下為資料庫基本資料設定" -e MYSQL_USER=domjudge -e MYSQL_DATABASE=domjudge -e MYSQL_PASSWORD=djpw -e MYSQL_ROOT_PASSWORD=rootpw -p 12345:80 "host port : container port" --name domserver "container name" domjudge/domserver:latest "latest 可替換成特定版本" ``` 上面的命令將啟動container並設置資料庫,並使用supervisord啟動nginx和PHP_FPM 啟動 domserver 時應該會顯示 admin和judgehost用戶的初始密碼,但如果沒有,可以使用以下命令來檢索密碼: ``` docker exec -it domserver cat /opt/domjudge/domserver/etc/initial_admin_password.secret docker exec -it domserver cat /opt/domjudge/domserver/etc/restapi.secret ``` 可以透過訪問https://localhost:12345/上的Web介面並以管理員身分登入 若無法登入admin,可以參考重置密碼的[文件](https://www.domjudge.org/docs/manual/main/config-basic.html#resetting-the-password-for-a-user) 記下judgehost的密碼,在配置judgehost container時使用,可以透過web介面編輯judgehost的密碼 #### 環境變量 domserver container支援以下環境變量: - ```CONTAINER_TIMEZONE```(默認為Europe/Amsterdam):允許您更改容器內使用的時區。 - ```MYSQL_HOST(默認為mariadb)```:設置要連接到 MySQL 的主機。可以是主機名或 IP。Docker 將為您添加的任何容器添加主機名--link,因此在上面的範例中,MariaDB 容器將在主機名下使用mariadb。 - ```MYSQL_USER(默認為domjudge)```:設置用於連接 MySQL 的用戶。 - ```MYSQL_PASSWORD```(默認為domjudge):設置用於連接 MySQL 的密碼。 - ```MYSQL_ROOT_PASSWORD```(默認為domjudge):設置用於連接 MySQL 的 root 密碼。 - ```MYSQL_DATABASE```(默認為domjudge):設置要使用的資料庫。 - ```DJ_DB_INSTALL_BARE```(默認為0):設置為1對資料庫執行 abare-install而不是普通的install。 - ```FPM_MAX_CHILDREN```(默認為40):要生成的最大 PHP FPM 子級數。 #### 透過檔案更改密碼 為了不透過環境變量指命敏感資訊,變量```MYSQL_PASSWORD_FILE```和```MYSQL_ROOT_PASSWORD_FILE```可用於設置文件的路徑以從中讀取密碼。這適合與docker compose 的 [secrets](https://docs.docker.com/compose/compose-file/#secrets-configuration-reference)一起使用: ```c= ... services: domserver: image: domjudge/domserver:${DOMJUDGE_VERSION} secrets: - domjudge-mysql-pw ... environment: MYSQL_PASSWORD_FILE: /run/secrets/domjudge-mysql-pw "填入密碼檔案路徑" ... ``` #### command 該```domserver```容器支持一些command,可以用以下語法執行command: ``` docker exec -it domserver [command] ``` 如果容器名稱有另外命名非為```domserver```,請記得在command中修改 還可以使用以下command: - ```nginx-access-log```:tail nginx的訪問日誌。 - ```nginx-error-log```:tail nginx的錯誤日誌。 - ```symfony-log```: 對於使用 Symfony(即 6.x 及更高版本)的 DOMjudge,追蹤 symfony log檔。 也可以透過執行```docker exec -it domserver bash```獲取容器的bash shell 若要重新啟動任何service,可以執行以下command: ``` docker exec -it domserver supervisorctl restart [service] ``` 其中的service之一是```nginx```或是```php``` Judgehost container --- 要執行單個judgehost container請執行以下command: ``` docker run -it --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --name judgehost-0 --link domserver:domserver --hostname judgedaemon-0 -e DAEMON_ID=0 domjudge/judgehost:latest ``` 說明: ```c= docker run -it --privileged "賦予執行root的權限" -v /sys/fs/cgroup:/sys/fs/cgroup:ro "volume mount的direction" --name judgehost-0 "名稱" --link domserver:domserver "與domserver做連結" --hostname judgedaemon-0 "hostname" -e DAEMON_ID=0 "judgedaemon id" domjudge/judgehost:latest "judgehost image版本,可自行替換" ``` 以上指令會將judgehost鎖定於執行機器上的第一個CPU核心 如果 Judgedaemon 因任何原因停止,應該能夠在啟動 Judgehost 的 shell 中看到它產生的錯誤。 如果要重新啟動judgehost,請執行```docker start judgehost-0```,其中```judgehost-0```是您```--name```在```docker run```命令中傳遞給的值。 #### 環境變量 ```judgehost```容器支援以下環境變量: - ```CONTAINER_TIMEZONE```(默認為Europe/Amsterdam):允許您更改容器內使用的時區。 - ```DOMSERVER_BASEURL```(默認為http://domserver/):可以找到 domserver 的基本 URL。Judgehost 使用它來連接到 API。不要自己添加api,因為容器會幫你! - ```JUDGEDAEMON_USERNAME```(默認為judgehost):用於連接 API 的用戶名。 - ```JUDGEDAEMON_PASSWORD```(默認為password):用於連接 API 的密碼。這應該是容器啟動judgehost時為用戶顯示的密碼domserver。與 mysql 密碼一樣,您也可以設置JUDGEDAEMON_PASSWORD_FILE為包含密碼的路徑。 - ```DAEMON_ID```(默認為0):用於此判斷judgedaemon的judgedaemon ID。如果您在一台(實體)機器上啟動多個 Judgehosts,請確保每個主機都有不同的DAEMON_ID. - ```DOMJUDGE_CREATE_WRITABLE_TEMP_DIR```(默認 top 0):如果設置為 1,則會為提交創建一個可寫的臨時目錄。這僅適用於 DOMjudge 版本 >= 6.1。 - ```RUN_USER_UID_GID```(默認為62860):將提交的用戶的 UID/GID。確保您的主機操作系統上未使用此 UID/GID 。 Image source --- 以上所需的資源image檔皆可以在[domjudge-packaging Github project](https://github.com/DOMjudge/domjudge-packaging/tree/master/docker)找到

    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