Skip to content

Commit 9029341

Browse files
committed
feat(install): add production installer and service scripts
1 parent 6c31194 commit 9029341

10 files changed

Lines changed: 641 additions & 54 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ configs/config.ini
55
platforms/list.txt
66
platforms/available/*
77
*.sh
8+
!install.sh
9+
!manage.sh
810
credentials.json
911
logs/
1012
logos/*.svg
@@ -156,4 +158,4 @@ dmypy.json
156158
# Except for publisher.proto
157159
!publisher.proto
158160

159-
*_credentials.json
161+
*_credentials.json

INSTALL.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# Installation Guide
2+
3+
## Automated Installation
4+
5+
```bash
6+
sudo ./install.sh
7+
```
8+
9+
This will:
10+
11+
- Install system dependencies
12+
- Clone repository to `/opt/relaysms/relaysms-publisher`
13+
- Setup Python virtualenv
14+
- Compile gRPC protos
15+
- Install and enable systemd services
16+
17+
## Manual Installation
18+
19+
### Install Dependencies
20+
21+
```bash
22+
sudo apt update
23+
sudo apt install -y python3 python3-pip python3-venv python3-dev \
24+
build-essential libmysqlclient-dev git curl make
25+
```
26+
27+
### Clone Repository
28+
29+
```bash
30+
sudo git clone https://github.com/smswithoutborders/RelaySMS-Publisher.git \
31+
/opt/relaysms/relaysms-publisher
32+
cd /opt/relaysms/relaysms-publisher
33+
```
34+
35+
### Setup Python Environment
36+
37+
```bash
38+
python3 -m venv venv
39+
venv/bin/pip install --upgrade pip
40+
venv/bin/pip install -r requirements.txt
41+
```
42+
43+
### Build Application
44+
45+
```bash
46+
source venv/bin/activate
47+
make build-setup
48+
```
49+
50+
This will:
51+
52+
- Download vault proto files
53+
- Compile gRPC protos
54+
55+
### Configure Environment
56+
57+
```bash
58+
cp template.env .env
59+
vim .env
60+
```
61+
62+
Edit the `.env` file to configure:
63+
64+
- Database settings (MySQL or SQLite)
65+
- Vault gRPC connection settings
66+
- Server ports and hosts
67+
68+
### Initialize Runtime
69+
70+
```bash
71+
mkdir -p data
72+
set -a && source .env && set +a
73+
# Database will be created automatically on first run
74+
```
75+
76+
### Install Services
77+
78+
```bash
79+
sudo cp relaysms-publisher.target relaysms-publisher-*.service /etc/systemd/system/
80+
sudo systemctl daemon-reload
81+
sudo systemctl enable relaysms-publisher.target
82+
sudo systemctl start relaysms-publisher.target
83+
```
84+
85+
## Service Management
86+
87+
```bash
88+
./manage.sh start # Start all services
89+
./manage.sh stop # Stop all services
90+
./manage.sh restart # Restart all services
91+
./manage.sh status # Check status
92+
./manage.sh logs # View logs
93+
./manage.sh enable # Enable on boot
94+
./manage.sh disable # Disable on boot
95+
./manage.sh update # Update installation
96+
./manage.sh uninstall # Remove installation
97+
```
98+
99+
## Configuration
100+
101+
Edit `/opt/relaysms/relaysms-publisher/.env`:
102+
103+
### Server
104+
105+
Configure REST API and gRPC server hosts and ports:
106+
107+
```bash
108+
# REST API
109+
HOST=127.0.0.1
110+
PORT=9000
111+
112+
# gRPC Server
113+
GRPC_HOST=127.0.0.1
114+
GRPC_PORT=6000
115+
GRPC_SSL_PORT=6001
116+
```
117+
118+
### Vault Connection
119+
120+
Configure connection to RelaySMS Vault:
121+
122+
```bash
123+
VAULT_GRPC_HOST=localhost
124+
VAULT_GRPC_PORT=8000
125+
VAULT_GRPC_SSL_PORT=8001
126+
VAULT_GRPC_INTERNAL_PORT=8443
127+
VAULT_GRPC_INTERNAL_SSL_PORT=8444
128+
```
129+
130+
### Database
131+
132+
Choose between MySQL and SQLite:
133+
134+
**SQLite (Default):**
135+
136+
```bash
137+
SQLITE_DATABASE_PATH=data/publisher.sqlite
138+
# Leave MySQL settings empty
139+
```
140+
141+
**MySQL:**
142+
143+
```bash
144+
MYSQL_HOST=127.0.0.1
145+
MYSQL_USER=your_user
146+
MYSQL_PASSWORD=your_password
147+
MYSQL_DATABASE=relaysms_publisher
148+
# Leave SQLITE_DATABASE_PATH empty
149+
```
150+
151+
### Platform Adapters
152+
153+
Configure platform adapter directories:
154+
155+
```bash
156+
PLATFORMS_ADAPTERS_DIR=platforms/adapters
157+
PLATFORMS_ADAPTERS_VENV_DIR=platforms/adapters_venv
158+
PLATFORMS_ADAPTERS_ASSETS_DIR=platforms/adapters_assets
159+
```
160+
161+
For setting up platform adapters and their credentials, see:
162+
163+
- [Platforms Documentation](platforms/README.md)
164+
- Individual adapter READMEs in `platforms/adapters/*/README.md`
165+
166+
Example platform adapters:
167+
168+
- Gmail OAuth2: `platforms/adapters/gmail_oauth2/`
169+
- Twitter OAuth2: `platforms/adapters/twitter_oauth2/`
170+
- Telegram: `platforms/adapters/telegram_pnba/`
171+
- Slack OAuth2: `platforms/adapters/slack_oauth2/`
172+
- Bluesky OAuth2: `platforms/adapters/bluesky_oauth2/`
173+
- Mastodon OAuth2: `platforms/adapters/mastodon_oauth2/`
174+
175+
## Services
176+
177+
- `relaysms-publisher-rest.service` - REST API (default port 16000, configurable via `PORT` env)
178+
- `relaysms-publisher-grpc.service` - gRPC server (default port 6000, configurable via `GRPC_PORT` env)
179+
- `relaysms-publisher.target` - Service group
180+
181+
## File Locations
182+
183+
- Installation: `/opt/relaysms/relaysms-publisher/`
184+
- Configuration: `/opt/relaysms/relaysms-publisher/.env`
185+
- Database: `/opt/relaysms/relaysms-publisher/data/publisher.sqlite`
186+
- Service files: `/etc/systemd/system/relaysms-publisher*`
187+
188+
## External Dependencies
189+
190+
### RelaySMS Vault (Required)
191+
192+
The Publisher requires a running instance of RelaySMS Vault for authentication and token management.
193+
194+
**Installation:**
195+
196+
See [RelaySMS Vault Installation Guide](https://github.com/smswithoutborders/RelaySMS-Vault/blob/main/INSTALL.md)
197+
198+
Quick install:
199+
200+
```bash
201+
curl -fsSL https://raw.githubusercontent.com/smswithoutborders/RelaySMS-Vault/main/install.sh | sudo bash
202+
```
203+
204+
**Configuration:**
205+
206+
Ensure the Vault gRPC server is accessible and update the `VAULT_GRPC_*` variables in the Publisher's `.env` file accordingly.

0 commit comments

Comments
 (0)