ຄຳສັ່ງ th: ໃຊ້ທຸກບໍລິການຈາກ terminal

Deploy Container ແລະ Static Web, ສຳເນົາໄຟລ໌ຂຶ້ນ Object Storage, ເຊື່ອມຕໍ່ Database ແລະ Cache, ສົ່ງຂໍ້ຄວາມເຂົ້າ Queue ຈາກເຄື່ອງຂອງທ່ານ ຫຼື CI

ເບິ່ງທຸກຄຳສັ່ງ, ພາຣາມິເຕີ ແລະ ຕົວຢ່າງໄດ້ທີ່ ຄູ່ມືອ້າງອີງຄຳສັ່ງ th

ຕິດຕັ້ງ

Shell
# 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 ຈາກໂຟນເດີ

Shell
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.com

Build ເວັບກ່ອນ (ເຊັ່ນ npm run build) ແລ້ວ deploy ໂຟນເດີຜົນລັບ ແຕ່ລະຄັ້ງເປັນ Release ທີ່ຍ້ອນກັບໄດ້ ແລະ ນັບຄືການ Publish ໃນແພັກເກັດຂອງທ່ານ

Object Storage

Shell
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 1h

Database ແລະ Cache

Shell
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

Shell
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+C

Container ມີຄູ່ມືຂອງຕົວເອງ: 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) ບໍ່ຕ້ອງສ້າງເອງ

ຍັງແກ້ບໍ່ໄດ້? ໃຫ້ທີມງານຊ່ວຍ

ເປີດ ticket ຈາກໜ້າຈັດການ ບອກຊື່ເວັບ ຫຼື ບໍລິການ ສິ່ງທີ່ເຮັດ ແລະ ຂໍ້ຄວາມທີ່ເຫັນເທິງຈໍ ທີມງານຈະຕອບກັບໃນເລື່ອງດຽວກັນ ຕິດຕາມໄດ້ໃນບ່ອນດຽວ