-
Notifications
You must be signed in to change notification settings - Fork 11
VPS
ninja03 edited this page Sep 18, 2021
·
12 revisions
OS: CentOS Stream8
# yum install git
# git clone https://github.com/codeforkosen/Kakomimasu.git
# curl -fsSL https://deno.land/x/install/install.sh | sh
# vi .bash_profile
export DENO_INSTALL="/root/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
# yum install nginx
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# dnf install certbot
# dnf install python3-certbot-nginx
# dnf install nginx
# certbot certonly -d kakomimasu.website -d practice.kakomimasu.website -d viewer.kakomimasu.website
1を選択
# certbot --nginx
# systemctl start nginx
# firewall-cmd --add-service=http --permanent
# firewall-cmd --add-service=https --permanent
# firewall-cmd --reload
# vi /etc/nginx/nginx.conf
upstream deno {
server 127.0.0.1:8880;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name practice.kakomimasu.website; # managed by Certbot
# root /usr/share/nginx/html;
location / {
proxy_pass http://deno;
}
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# nohup deno run -A apiserver.ts &
# vi /etc/systemd/system/kakomimasu.service
[Unit]
Description = Kakomimasu apiserver
Documentation = https://github.com/codeforkosen/Kakomimasu
After = network.target
[Service]
Environment = PATH=/root/.deno/bin
ExecStart = /root/.deno/bin/deno run -A /root/Kakomimasu/apiserver/apiserver.ts
Restart=always
[Install]
WantedBy = multi-user.target
# systemctl daemon-reload
# systemctl start kakomimasu
サービス起動
# systemctl start kakomimasu
* サービス停止
# systemctl stop kakomimasu
* サービス再起動
# systemctl restart kakomimasu
* サービス状態確認
# systemctl status kakomimasu
* ログ閲覧(最初から)
# journalctl -u kakomimasu
* ログ閲覧(最後から)
# journalctl -u kakomimasu -e
* ログ閲覧(リアルタイム)
# journalctl -u kakomimasu -f
Next.js
# curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
# sudo yum install nodejs
# npm install
# npm build
vi /etc/systemd/system/kakomimasu-viewer.service
[Unit]
Description = Kakomimasu viewer
Documentation = https://github.com/kakomimasu/viewer
After = network.target
[Service]
WorkingDirectory=/root/viewer
ExecStart = npm run start
Restart=always
[Install]
WantedBy = multi-user.target