This is a simple Messages(iOS)-like client (frontend & backend) for gammu-smsd
with storage in postgres
. It lets you view your inbox and send/reply to SMS.
For more info on using gammu-smsd
on a Raspberry Pi 0 see this blogpost.
To use Basic Auth, uncomment GAMMU_CLIENT_USER
and GAMMU_CLIENT_PASSWORD
in either .env
or docker-compose.yml
depending on how you deploy this.
If you already have gammu running with a postgres backend you can deploy this to any server capable of accessing that postgres instance.
It's also possible to just run the server
for an simple API.
The server exposes 2 endpoints:
GET /api/sms
- Fetch all SMSesPOST /api/sms
- Send an SMS
You can run both client and server directly with npm
. For that you need to have an existing instance of Postgres.
# Setup .env
cp server/.env.example server/.env
nano server/.env
# Install deps
npm install
# To run server & client
npm start
cd client
# Install deps
npm install
# Build static files, then you can start the server with SERVE_STATIC=1
npm run build
# To run client dev-server (hot reloading etc)
npm start
For a fresh install of gammu-smsd
with no current postgres storage, set this up then configure gammu-smsd to use this database.
This won't work on a Raspberry Pi Zero/1!
# Start db
docker-compose up -d db
# Setup db
cat support/gammu.sql | docker-compose exec -T db psql -U smsd smsd
# Start client
docker-compose up -d web
Since these are armv6
, using Docker takes some effort. I haven't been able to get docker-compose
to work for example.
It's possible(?) to clone this repo and build the image directly on the rpi0 but it takes ages.
My preferred method is to build it on macOS/Linux and export the image as a tar.
If you have npm
installed, it's possible to fetch all dependencies locally and then build the image.
On your local machine
# Build the armv6 image and save it to tar
./build_arm.sh
# Pass a hostname to transfer the file as well like:
./build_arm.sh -d host:/home/pi
# If you have NPM installed locally you can build the frontend
# and fetch node_modules, then copy them into the image (faster)
./build_arm.sh -l
On your pi
# Load the transfered tar
docker load -i gammu-client-armv6.tar
If you have a database running for gammu already, make sure it's accessible by ip and edit the DATABASE_URL
below
docker run -d --rm --name gammu-client \
-p 5000:5000 \
-e DATABASE_URL=postgres://smsd:smsd@10.0.0.1:5432/smsd \
gammu-client:armv6
If you don't have a postgres already, run it in a container!
docker network create gammu
docker volume create gammu-db
docker run -d --rm --name gammu-db \
--network=gammu \
-v gammu-db:/var/lib/postgresql/data \
-e POSTGRES_DB=smsd \
-e POSTGRES_USER=smsd \
-e POSTGRES_PASSWORD=smsd \
arm32v6/postgres:10.6-alpine
docker run -d --rm --name gammu-client \
-p 5000:5000 \
--network=gammu \
-e DATABASE_URL=postgres://smsd:smsd@gammu-db:5432/smsd \
gammu-client:armv6
# Setup db schema
docker exec gammu-client cat gammu.sql | docker exec -i gammu-db psql -U smsd smsd
After creating the containers you need to configure your gammu-smsd
to use postgres.
# /etc/gammu-smsdrc
[smsd]
logfile = /var/log/gammu-smsd.log
service = sql
driver = native_pgsql
host = localhost
user = smsd
password = smsd
database = smsd
Depending on your version of gammu-smsd
you might need to change the value of Version
in the database gammu
.
The schema used in the docker container is version 17.
# Enter the container
docker exec -it gammu-db psql -U smsd
# Delete new version and insert older
smsd=# delete from gammu where "Version" = 17;
smsd=# insert into gammu ("Version") values (16);
- Fork it ( https://github.com/joenas/gammu-client/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- joenas joenas - creator, maintainer