ເບິ່ງທຸກຄຳສັ່ງ, ພາຣາມິເຕີ ແລະ ຕົວຢ່າງໄດ້ທີ່ ຄູ່ມືອ້າງອີງຄຳສັ່ງ th
ຕິດຕັ້ງ
# Linux, macOS
curl -fsSL https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.sh | sh
# Windows (PowerShell)
irm https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.ps1 | iexສະຄຣິບຈະດາວໂຫຼດ th ຈາກ GitHub ແລະ ກວດ checksum ກ່ອນຕິດຕັ້ງ ຖ້າມີ Go 1.23 ຂຶ້ນໄປຈະໃຊ້ go install github.com/mrzack99s/thailandhosting-cli/cmd/th@latest ກໍໄດ້
ເຂົ້າສູ່ລະບົບ
th auth login ຈະເປີດ Console ໃຫ້ກວດວ່າລະຫັດກົງກັບໃນ terminal ແລ້ວກົດ ອະນຸຍາດ ໃຊ້ໄດ້ 90 ມື້ ແລະ ສະແດງໃນ ບັນຊີ → ອຸປະກອນທີ່ເຂົ້າສູ່ລະບົບ ຕັ້ງ Project ແລະ Region ຄັ້ງດຽວດ້ວຍ th config set project … ແລະ th config set region …
Static Web ຈາກໂຟນເດີ
th static-site deploy docs ./dist # creates the site on the first deploy
th static-site releases docs
th static-site rollback docs previous
th static-site domains add docs www.example.comBuild ເວັບກ່ອນ (ເຊັ່ນ npm run build) ແລ້ວ deploy ໂຟນເດີຜົນລັບ ແຕ່ລະຄັ້ງເປັນ Release ທີ່ຍ້ອນກັບໄດ້ ແລະ ນັບຄືການ Publish ໃນແພັກເກັດຂອງທ່ານ
Object Storage
th object-storage buckets create my-bucket
th object-storage cp ./report.pdf th://my-bucket/reports/
th object-storage cp -r ./backups th://my-bucket/backups
th object-storage sync ./public th://my-bucket/site --delete
th object-storage ls th://my-bucket/reports/
th object-storage sign th://my-bucket/reports/report.pdf --expires 1hDatabase ແລະ Cache
th database create app-db --engine postgres
th database public app-db --enable --allow 203.0.113.7/32 # your IP
th database connect app-db # opens psql with the credentials
th database credentials app-db
th database backups create app-db
th cache create sessions --engine thcache
th cache connect sessions # opens redis-cliທີ່ຢູ່ພາຍໃນ (private) ໃຊ້ໄດ້ສະເພາະໃນ VPC ຂອງ Project ຖ້າຈະເຊື່ອມຈາກເຄື່ອງຂອງທ່ານ ໃຫ້ເປີດການເຂົ້າເຖິງຈາກພາຍນອກສຳລັບ IP ຂອງທ່ານກ່ອນ
Queue Service
th queue create jobs --visibility-timeout 60s
th queue send jobs '{"order": 1042}'
th queue receive jobs --max 10 --ack
th queue tail jobs # receive and acknowledge until Ctrl+CContainer ມີຄູ່ມືຂອງຕົວເອງ: Deploy ຈາກເຄື່ອງຂອງທ່ານ ຫຼື CI ດ້ວຍ th CLI
ໃຊ້ໃນ CI
- Container ແລະ Static Web: ສ້າງ API Key ທີ່ Integrations → API keys ໂດຍໃຫ້ສິດ Containers: deploy (
run:write) ຫຼື Static Web: deploy (static:write) ແລ້ວຕັ້ງເປັນTH_API_KEY - Object Storage ແລະ Queue Service: ສ້າງ Access key ໃນໜ້າຂອງບໍລິການນັ້ນ ແລ້ວຕັ້ງ
TH_OBJECT_STORAGE_KEY_ID/TH_OBJECT_STORAGE_SECRETຫຼືTH_QUEUE_KEY_ID/TH_QUEUE_SECRET
ເມື່ອເຂົ້າສູ່ລະບົບໃນເຄື່ອງຂອງທ່ານເອງ th ຈະສ້າງ key ຊົ່ວຄາວຂອງ Object Storage ຫຼື Queue ໃຫ້ເອງ (12 ຊົ່ວໂມງ ຕາມສິດຂອງທ່ານໃນ Project) ບໍ່ຕ້ອງສ້າງເອງ