Ngoc Phuong
Ngoc Phuong
1599 views2 comments

Tetua getting started

Installation

Tetua provide binary packages for easy setting up and running a blog, these are supported plattform:

To run a Tetua blog, you have to download and and execute the binary.
The current version is v0.0.5-alpha so if you want to deploy a blog, the process is as following:

Download and extract the binary

mkdir -p /home/myblog
wget https://github.com/ngocphuongnb/tetua/releases/download/v0.0.3-alpha/tetua_0.0.3-alpha_Linux_x86_64.tar.gz
tar -xvf tetua_0.0.5-alpha_Linux_x86_64.tar.gz

Create the config file

./tetua init

The config file will be created in the current directory:

{
 "app_env": "production",
 "app_key": "{APP_KEY}",
 "app_port": "3000",
 "db_dsn": "",
 "github_client_id": "",
 "github_client_secret": "",
 "db_query_logging": false
}

These fields are required:

  • app_key: the key to encrypt the data
  • db_dsn: the database connection string
  • github_client_id: the client id for github
  • github_client_secret: the client secret for github

You can skip this initialization step by specifying the environment variables:

  • APP_KEY
  • DB_DSN
  • GITHUB_CLIENT_ID
  • GITHUB_CLIENT_SECRET

The full config file is as bellow:

{
	"app_env": "production",
	"app_key": "{app_key}",
	"app_token_key": "token",
	"app_port": "3000",
	"app_theme": "default",
	"db_dsn": "root:123@tcp(127.0.0.1:3306)/myblog?charset=utf8mb4&collation=utf8mb4_unicode_ci&parseTime=true",
	"github_client_id": "{github_client_id}",
	"github_client_secret": "{github_client_secret}",
	"cookie_uuid": "uuid",
	"show_tetua_block": false,
	"db_query_logging": false,
	"storage": {
		"default_disk": "local_public",
		"disks": [
			{
				"name": "local_public",
				"driver": "local",
				"root": "./public",
				"base_url": "http://localhost:3000/storage/",
				"provider": "local",
			}, {
				"name": "do_public",
				"driver": "s3",
				"root": "./files",
				"base_url": "cdn.myapp.local/files",
				"provider": "DigitalOcean",
				"endpoint": "sfo3.digitaloceanspaces.com",
				"region": "sfo3",
				"bucket": "myblock",
				"access_key_id": "{access_key_id}",
				"secret_access_key": "{secret_access_key}",
				"acl": "public-read"
			}
		]
	}
}

All the environment variables that Tetua use are:

APP_ENV
APP_KEY
APP_TOKEN_KEY
APP_PORT
APP_THEME
DB_DSN
DB_QUERY_LOGGING
GITHUB_CLIENT_ID
GITHUB_CLIENT_SECRET
ROOT_DIR
PUBLIC_DIR
PRIVATE_DIR
COOKIE_UUID
SHOW_TETUA_BLOCK

Create the Admin account

./tetua setup -u admin -p password

Run the server

./tetua run

Result

 ┌───────────────────────────────────────────────────┐
 │                  Tetua Community                  │
 │                   Fiber v2.30.0                   │
 │               http://127.0.0.1:3000               │
 │       (bound on host 0.0.0.0 and port 3000)       │
 │                                                   │
 │ Handlers ........... 553  Processes ........... 1 │
 │ Prefork ....... Disabled  PID ............. 30014 │
 └───────────────────────────────────────────────────┘


Discussion (2)

Ngoc Phuong
Ngoc Phuong  May 18, 2022 00:25 UTC

@ego008 thank you!

ego008
ego008  May 17, 2022 12:13 UTC

Really nice work! 👍

LoginRegisterTopics