mirror of
https://github.com/TxtDot/documentation.git
synced 2024-11-25 06:16:22 +03:00
Self-hosting guide
This commit is contained in:
parent
afcbbce0bf
commit
eb689aeb7b
1 changed files with 94 additions and 0 deletions
94
docs/selfhost.md
Normal file
94
docs/selfhost.md
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# Self-Hosting
|
||||||
|
|
||||||
|
## Without Docker
|
||||||
|
|
||||||
|
Install Node and NPM:
|
||||||
|
```bash
|
||||||
|
# Debian, Ubuntu
|
||||||
|
sudo apt install nodejs npm
|
||||||
|
# CentOS
|
||||||
|
sudo yum install nodejs
|
||||||
|
# Arch
|
||||||
|
sudo pacman -S nodejs npm
|
||||||
|
# Alpine
|
||||||
|
doas apk add nodejs npm
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a user for txtdot, log in:
|
||||||
|
```bash
|
||||||
|
# Not Alpine (coreutils)
|
||||||
|
sudo useradd -r -m -s /sbin/nologin -U txtdot
|
||||||
|
sudo -u txtdot -i
|
||||||
|
|
||||||
|
# Alpine (busybox)
|
||||||
|
doas addgroup -S txtdot
|
||||||
|
doas adduser -h /home/txtdot -s /sbin/nologin -G txtdot -S -D txtdot
|
||||||
|
doas -u txtdot bash
|
||||||
|
```
|
||||||
|
|
||||||
|
Clone the repo:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/txtdot/txtdot.git src
|
||||||
|
```
|
||||||
|
|
||||||
|
Install packages, compile TS:
|
||||||
|
```bash
|
||||||
|
cd src
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
Manually start the server to check if it works (Ctrl+C to exit):
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
Log out from txtdot account: `exit`
|
||||||
|
|
||||||
|
### Add txtdot to autostart
|
||||||
|
Either using systemd unit file:
|
||||||
|
```bash
|
||||||
|
wget https://github.com/TxtDot/txtdot/blob/main/txtdot.service
|
||||||
|
sudo chown root:root txtdot.service
|
||||||
|
sudo chmod 755 txtdot.service
|
||||||
|
sudo mv txtdot.service /etc/systemd/system/
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable txtdot
|
||||||
|
sudo systemctl start txtdot
|
||||||
|
```
|
||||||
|
|
||||||
|
Or using OpenRC script:
|
||||||
|
```bash
|
||||||
|
wget -O txtdot https://github.com/TxtDot/txtdot/blob/main/txtdot.init
|
||||||
|
doas chown root:root txtdot
|
||||||
|
doas chmod 755 txtdot
|
||||||
|
doas mv txtdot /etc/init.d/
|
||||||
|
doas rc-update add txtdot
|
||||||
|
doas rc-service txtdot start
|
||||||
|
```
|
||||||
|
|
||||||
|
Or using crontab:
|
||||||
|
```bash
|
||||||
|
sudo crontab -u txtdot -e
|
||||||
|
# The command will open an editor
|
||||||
|
# Add this line to the end of the file:
|
||||||
|
@reboot sleep 10 && cd /home/txtdot/src && npm run start
|
||||||
|
# Save the file and exit
|
||||||
|
```
|
||||||
|
|
||||||
|
## With Docker
|
||||||
|
|
||||||
|
Docker Engine and Docker Compose are required.
|
||||||
|
|
||||||
|
Note that built images are not provided via Docker Hub.
|
||||||
|
If you can't or don't want to build them on your server
|
||||||
|
and don't want to setup a CI/CD system,
|
||||||
|
[let us know](https://github.com/txtdot/txtdot/issues),
|
||||||
|
we'll consider setting up a GitHub Actions workflow.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/txtdot/txtdot.git
|
||||||
|
cd txtdot
|
||||||
|
docker compose build
|
||||||
|
docker compose up -d
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue