RelaySMS Gateway Server is the online router that receives messages from gateway clients and directs them to users' chosen internet platforms.
Note
Ensure all system dependencies are installed before running setup scripts.
For development, use the provided scripts:
source scripts/quick-setup.sh && ./scripts/quick-start.sh
-
quick-setup
:- Creates a Python virtual environment (if missing)
- Installs Python dependencies
- Sets up a
.env
file - Exports environment variables
- Downloads the
publisher
andbridge
Protobuf files. (viamake publisher-proto
andmake bridge-proto
respectively) - Compiles gRPC protos (via
make grpc-compile
)
-
quick-start
:- Launches the REST server, IMAP Listener, and the FTP Server.
Warning
This setup is for development only. Do not use in production.
- Database: MySQL (≥ 8.0.28), MariaDB, or SQLite
- Python: ≥ 3.8.10
- Virtual Environments: Python venv
sudo apt update
sudo apt install python3-dev libmysqlclient-dev apache2 apache2-dev make libapache2-mod-wsgi-py3
-
Clone the repository:
git clone https://github.com/smswithoutborders/RelaySMS-Gateway-Server.git cd RelaySMS-Gateway-Server
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
-
Compile gRPC protos:
make grpc-compile
docker build -t relaysms-gateway-server .
Tip
For long-term development, you may want to run the container in detached mode (-d
) and view logs with:
docker logs -f <container_id_or_name>
docker run --rm \
--env-file .env \
-p 5000:5000 -p 5001:5001 \
-p 2222:2222 -p 60000-65000:60000-65000 \
-v $(pwd)/ftp_file_store:/gateway_server/ftp_file_store \
relaysms-gateway-server
Tip
- To run in detached mode:
Then view logs with:
docker run -d \ --name relaysms-gateway-server \ --env-file .env \ -p 5000:5000 -p 5001:5001 \ -p 2222:2222 -p 60000-65000:60000-65000 \ -v $(pwd)/ftp_file_store:/gateway_server/ftp_file_store \ relaysms-gateway-server
docker logs -f relaysms-gateway-server
Configure via environment variables, either in your shell or a .env
file.
To load from .env
:
set -a
source .env
set +a
Or set individually:
export HOST=localhost
export PORT=5000
# etc.
SSL_SERVER_NAME
: SSL certificate server name (default:localhost
)HOST
: REST server host (default:localhost
)PORT
: REST server port (default:5000
)SSL_PORT
: REST SSL port (default:5001
)SSL_CERTIFICATE
,SSL_KEY
,SSL_PEM
: SSL file paths (optional)
PUBLISHER_GRPC_HOST
: Publisher gRPC server host (default:127.0.0.1
)PUBLISHER_GRPC_PORT
: Publisher gRPC server port (default:6000
)
BRIDGE_GRPC_HOST
: Bridge gRPC server host (default:127.0.0.1
)BRIDGE_GRPC_PORT
: Bridge gRPC server port (default:10000
)
ORIGINS
: Allowed CORS origins (default:[]
)
MYSQL_HOST
: MySQL host (default:127.0.0.1
)MYSQL_USER
: MySQL usernameMYSQL_PASSWORD
: MySQL passwordMYSQL_DATABASE
: MySQL database (default:relaysms_gateway_server
)SQLITE_DATABASE_PATH
: SQLite file path (default:gateway_server.db
)
IMAP_SERVER
: IMAP server hostnameIMAP_PORT
: IMAP server port (default:993
)IMAP_USERNAME
: IMAP usernameIMAP_PASSWORD
: IMAP passwordMAIL_FOLDER
: Mail folder to monitor (default:INBOX
)
FTP_USERNAME
: FTP usernameFTP_PASSWORD
: FTP passwordFTP_IP_ADDRESS
: FTP server IP address (default:localhost
)FTP_PORT
: FTP server port (default:2222
)FTP_PASSIVE_PORTS
: FTP passive port range (default:60000-65000
)FTP_READ_LIMIT
: FTP read limit in bytes (default:51200
)FTP_WRITE_LIMIT
: FTP write limit in bytes (default:51200
)FTP_MAX_CON
: Maximum FTP connections (default:256
)FTP_MAX_CON_PER_IP
: Maximum FTP connections per IP (default:5
)FTP_DIRECTORY
: FTP directory path (default:ftp_file_store
)
SMTP_ALLOWED_EMAIL_ADDRESSES
: Allowed email addresses for SMTPDISABLE_BRIDGE_PAYLOADS_OVER_HTTP
: Disable bridge payloads over HTTP (default:false
)
LOG_LEVEL
: Logging level (default:info
)
- REST API Resources:
- Gateway Client CLI
- Fork the repository
- Create a feature branch:
git checkout -b feature-branch
- Commit your changes
- Push to your branch
- Open a pull request
Licensed under the GNU General Public License (GPL). See LICENSE for details.