th static-site

Deploy a built folder as a Static Web site, roll back to an earlier release, connect your own domain and follow Git builds.

About

Static Web serves the files your build makes: HTML, CSS, JavaScript and images. Each th static-site deploy uploads a folder as a new release and makes it live; earlier releases stay so you can roll back. The first deploy of a new name creates the site.

  • Build first (for example npm run build) and deploy the output folder, the one that holds index.html (often dist, build or out).
  • Every file in the folder is uploaded (.gitignore is not read), except .git, .DS_Store and paths listed in a .thignore file. Up to 20,000 files and 500 MB (100 MB compressed) per deploy.
  • Sites connected to Git in the Console build on our side; th static-site builds starts and follows those builds.

More in the help centre: How Static Web works.

How-to guides

Deploy a folder

  1. Build your site.
  2. Run th static-site deploy NAME DIR. The first time, NAME becomes the site’s URL name (3–41 characters of a-z, 0-9 and -).
  3. th prints the release and the site’s URL.
Shell
npm run build && th static-site deploy my-site dist

Roll back a release

Shell
th static-site releases my-site
th static-site rollback my-site previous

* marks the live release. Use a release ID instead of previous to go back further.

Use your own domain

  1. Run th static-site domains add my-site www.example.com. It prints the DNS records to create: a CNAME to the site and a TXT record at _thailandhosting.www.example.com that proves you own the domain.
  2. Create the records at your DNS host. For an apex domain (example.com) use your DNS host’s ALIAS/ANAME or CNAME flattening.
  3. Run th static-site domains verify my-site www.example.com. Once the TXT record is found, the domain serves the site over HTTPS.

Commands

CommandDescription
th static-site deployUploads a built folder (default ".") as the next release of a Static Web site.
th static-site listLists the Static Web sites of the Project.
th static-site describeShows a Static Web site: URL, source, active release and latest build.
th static-site releasesLists a Static Web site's releases, newest first.
th static-site rollbackMakes an earlier release live again.
th static-site domains addAdds a custom domain and prints the DNS records that prove you own it.
th static-site domains verifyChecks the domain's TXT record and turns the domain on.
th static-site domains listLists a Static Web site's custom domains.
th static-site domains removeRemoves a custom domain from the site.
th static-site builds listLists the Git builds of a Static Web site, newest first.
th static-site builds logPrints a Git build's log.
th static-site builds triggerStarts a Git build of the site's branch.
th static-site deleteDeletes a Static Web site with all its releases and domains.

th static-site deploy

Uploads a built folder (default ".") as the next release of a Static Web site.

Syntax

Shell
th static-site deploy NAME [DIR]

The site is created first when NAME does not exist yet (NAME becomes its URL name: 3–41 characters a-z, 0-9 and -), in --region or the default region.

Every file in DIR is uploaded — .gitignore is not read, since build output is often gitignored — except .git, .DS_Store and paths listed in a .thignore file in DIR. Up to 20,000 files, 500 MB (100 MB compressed) per deploy.

Examples

Build, then deploy the dist folder

Shell
npm run build && th static-site deploy my-site dist

Deploy ./public as the site docs, created in bkk

Shell
th static-site deploy docs ./public --region bkk

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
DIROptionalThe folder to upload (default: the current folder).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site list

Lists the Static Web sites of the Project.

Syntax

Shell
th static-site list

Examples

List the Project’s sites

Shell
th static-site list

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site describe

Shows a Static Web site: URL, source, active release and latest build.

Syntax

Shell
th static-site describe NAME

Examples

URL, source, live release and latest build

Shell
th static-site describe my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site releases

Lists a Static Web site's releases, newest first.

Syntax

Shell
th static-site releases NAME

* marks the live one.

Examples

List releases; * marks the live one

Shell
th static-site releases my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site rollback

Makes an earlier release live again.

Syntax

Shell
th static-site rollback NAME RELEASE|previous

"previous" is the release before the live one.

Examples

Go back one release

Shell
th static-site rollback my-site previous

Make a specific release live

Shell
th static-site rollback my-site <release-id>

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
RELEASE|previousRequiredA release ID from th static-site releases, or previous for the release before the live one.

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site domains add

Adds a custom domain and prints the DNS records that prove you own it.

Syntax

Shell
th static-site domains add NAME DOMAIN

Examples

Add a domain and print its DNS records

Shell
th static-site domains add my-site www.example.com

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
DOMAINRequiredA custom domain such as www.example.com.

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site domains verify

Checks the domain's TXT record and turns the domain on.

Syntax

Shell
th static-site domains verify NAME DOMAIN

Examples

Check the TXT record and turn the domain on

Shell
th static-site domains verify my-site www.example.com

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
DOMAINRequiredA custom domain such as www.example.com.

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site domains list

Lists a Static Web site's custom domains.

Syntax

Shell
th static-site domains list NAME

Examples

List the site’s domains

Shell
th static-site domains list my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site domains remove

Removes a custom domain from the site.

Syntax

Shell
th static-site domains remove NAME DOMAIN [--quiet]

Examples

Remove a domain

Shell
th static-site domains remove my-site www.example.com

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
DOMAINRequiredA custom domain such as www.example.com.

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site builds list

Lists the Git builds of a Static Web site, newest first.

Syntax

Shell
th static-site builds list NAME

Examples

List Git builds

Shell
th static-site builds list my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site builds log

Prints a Git build's log.

Syntax

Shell
th static-site builds log NAME BUILD [--follow]

BUILD is its ID, its number (#3 or 3) or "latest".

Examples

Follow the newest build

Shell
th static-site builds log my-site latest --follow

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).
BUILDRequiredA Git build: its ID, its number (#3 or 3) or latest.

Parameters

NameTypeDefaultDescription
--followflagKeep printing until the build finishes

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site builds trigger

Starts a Git build of the site's branch.

Syntax

Shell
th static-site builds trigger NAME

Examples

Build the site’s branch now

Shell
th static-site builds trigger my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑

th static-site delete

Deletes a Static Web site with all its releases and domains.

Syntax

Shell
th static-site delete NAME [--quiet]

--quiet skips the prompt.

Examples

Delete the site, its releases and domains

Shell
th static-site delete my-site

Positional arguments

NameDescription
NAMERequiredThe site’s URL name (3–41 characters of a-z, 0-9 and -).

Global parameters

This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.

Back to top ↑