pango-xdemo

command module
v0.0.0-...-eb2148f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2024 License: MIT Imports: 2 Imported by: 0

README

XDemo

Linux

install golang (1.21)
sudo yum -y install golang

or

wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
tar -xzvf go1.21.6.linux-amd64.tar.gz
sudo mv go /opt/
sudo ln -s /opt/go/bin/go /usr/bin/go
build
./build.sh
deploy
export LOG_SLACK_WEBHOOK=https://hooks.slack.com/services/...

./deploy.sh
install as system service
sudo useradd xdemo

echo '
[Unit]
Description=Pango Xdemo
After=syslog.target network.target local-fs.target

[Service]
Type=simple
WorkingDirectory=/app/xdemo
ExecStart=/app/xdemo/xdemo
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
User=xdemo
Group=xdemo

[Install]
WantedBy=multi-user.target
' | sudo tee /usr/lib/systemd/system/xdemo.service

sudo systemctl daemon-reload
sudo systemctl enable xdemo
sudo systemctl start xdemo

Windows

install golang (1.21)

download https://go.dev/dl/go1.21.6.windows-amd64.zip and extract it.

get goversioninfo
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
build
build.bat
deploy
SET LOG_SLACK_WEBHOOK=https://hooks.slack.com/services/...

deploy.bat
init mysql database (not supported yet)
CREATE USER 'xdemo'@'%' IDENTIFIED BY 'xdemo';
CREATE DATABASE xdemo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL PRIVILEGES ON xdemo.* TO 'xdemo'@'%';
init postgresql database
CREATE USER xdemo PASSWORD 'xdemo';
CREATE DATABASE xdemo WITH OWNER=xdemo ENCODING='UTF-8';
GRANT ALL ON DATABASE xdemo TO xdemo;
install as windows service

Run As Administrator

xdemo.exe install

apache proxy setting

<VirtualHost *:80 *:443>
	ServerName xdemo.local

	<If "%{HTTPS} == 'on'">
		RequestHeader set X-Forwarded-Proto "https"
		RequestHeader set X-Forwarded-Port  "443"
	</If>

	DocumentRoot /app/xdemo/web
	<Directory /app/xdemo/web>
		AllowOverride All
		Options FollowSymLinks Indexes
		Require all granted
	</Directory>

	AllowEncodedSlashes NoDecode

	ProxyTimeout      300
	ProxyRequests     Off
	ProxyPreserveHost On

	ProxyPass         /         http://localhost:6060/ nocanon retry=0
	ProxyPassReverse  /         http://localhost:6060/ nocanon
</VirtualHost>

nginx proxy setting

server {
	listen       80;
	listen       443 ssl;
	server_name  xdemo.local;

	charset utf-8;

	client_max_body_size 0;

	location / {
		proxy_pass              http://localhost:6060;
		proxy_http_version      1.1;
		proxy_set_header        X-Real-IP $remote_addr;
		proxy_set_header        X-Forwarded-Proto $scheme;
		proxy_set_header        X-Forwarded-Port  $server_port;
		proxy_set_header        X-Forwarded-For   $proxy_add_x_forwarded_for;
		proxy_set_header        Host $http_host;
		proxy_request_buffering off;
		proxy_buffering         off;
		proxy_connect_timeout   10;
		proxy_send_timeout      10;
		proxy_read_timeout      600;
	}
}

OpenSearch

DELETE xdemo_applog

PUT xdemo_applog
{
	"mappings": {
		"properties": {
			"time": {
				"type": "date",
				"format": "date_time"
			}
		}
	}
}

GET xdemo_applog

GET xdemo_applog/_search
{
	"query": {
		"match_all": {}
	}
}

POST xdemo_applog/_delete_by_query
{
	"query": {
		"match_all": {}
	}
}
DELETE xdemo_access

PUT xdemo_access
{
	"mappings": {
		"properties": {
			"time": {
				"type": "date",
				"format": "date_time"
			}
		}
	}
}

GET xdemo_access

GET xdemo_access/_search
{
	"query": {
		"match_all": {}
	}
}

POST xdemo_access/_delete_by_query
{
	"query": {
		"match_all": {}
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL