> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coregamehd.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Code

> command line สำหรับใช้ส่วนตัว

## 1) ปกิณกะคางามิ (blog.coregamehd.com)

<Info>รัน command line ที่เว็บ [https://flyctl.sh/shell](https://flyctl.sh/shell)</Info>

<AccordionGroup>
  <Accordion title="วิธีติดตั้ง ghost cms บน fly.io">
    รันคอมมานด์ดังต่อไปนี้บน Terminal

    ```
    # Prompt for app name
    read -p "Enter App Name: " appname </dev/tty && \
    # Heredoc wrapper for tidyness (starting now, because we can't seem to prompt for input within heredoc)
    bash << EOF
    # Inspect script first if you are leery of pipe-to-bash
    curl -L https://fly.io/install.sh | sh
    # This will open a browser, where you can enter a username and password, and your credit card (which is required even for free tier, for fraud prevention).
    flyctl auth signup
    # Create a directory for the project and enter it, since the next command will output a file
    mkdir ghost-flyio && cd ghost-flyio
    # Create an app -- using Ghost Dockerfile, Seattle region, and app name prompted for earlier -- but don't deploy it
    echo | flyctl launch --name $appname --image=ghost:5-alpine --region sea --no-deploy --org personal
    # Provision a volume for Ghost's content and SQLite Database.
    # Size can be up to 3GB and still fit in the free plan, but 1GB will be enough for starters.
    flyctl volumes create ghost_data --region sea --size 3 -a $appname
    # Install sed (stream editor), if it isn't already installed
    sudo apt install sed
    # Update the port to Ghost's default (2368)
    sed -i 's/internal_port = 8080/internal_port = 2368/g' fly.toml
    # Append info about where to find the persistent storage to fly.toml
    cat >> fly.toml << BLOCK
    [mounts]
    source="ghost_data"
    destination="/var/lib/ghost/content"
    BLOCK
    # Set Ghost url
    flyctl secrets set url=https://$appname.fly.dev
    # Since we're using SQLite, we need to set ghost to run in development mode
    flyctl secrets set -a $appname NODE_ENV=development
    # Put the SQLite DB somewhere where it doesn't get overwritten on redeploy...
    fly secrets set database__connection__filename=/var/lib/ghost/content/data/ghost-dev.db
    # Boom! We're airborne.
    flyctl launch
    # End our bash Heredoc
    EOF
    ```
  </Accordion>

  <Accordion title="วิธีตั้งค่า default url จาก xxx.fly.io เป็น custom domain ที่กำหนด">
    รันคอมมานด์ดังต่อไปนี้บน Terminal

    ```
    flyctl secrets set url=https://blog.coregamehd.com -a coregameblog
    ```

    * เปลี่ยน `https://blog.coregamehd.com` เป็น domain ที่ต้องการ
    * เปลี่ยน `coregameblog` เป็นชื่อโปรเจค
  </Accordion>

  <Accordion title="วิธีอัพเดต ghost cms เป็นเวอร์ชั่นใหม่">
    รันคอมมานด์ดังต่อไปนี้บน Terminal

    ```
    flyctl deploy --image=ghost:5-alpine -a coregameblog
    ```

    เปลี่ยน `coregameblog` เป็นชื่อโปรเจค
  </Accordion>
</AccordionGroup>

## 2) สารบัญคางามิ (docs.coregamehd.com)

วิธีรัน Mintlify บน local environment

1. ติดตั้ง mintlify cli ด้วยการรันคอมมานด์ดังต่อไปนี้ใน terminal (ทำแค่ครั้งแรกครั้งเดียว)

<CodeGroup>
  ```bash npm theme={null}
  npm i -g mintlify
  ```

  ```bash yarn theme={null}
  yarn global add mintlify
  ```
</CodeGroup>

2. cd ไปที่ directory ของโปรเจค จากนั้นรันคอมมานด์ดังต่อไปนี้

```
mintlify dev
```

เข้าไปที่ `http://localhost:3000` เพื่อดู preview

3. เมื่อทุกอย่างเสร็จสิ้น ให้ push ขึ้น github (main branch)
