Run your own server
A server for yourself
Set up a personal server, connect the app, and add your content.
Set up the server
Download and unzip the server kit. Run every command below from inside the bastion-server folder it unpacks to.
Create the storage and your account. Use a short lowercase name:
python3 bastionctl.py --root ./data init python3 bastionctl.py --root ./data user add aliceCreate the server's identity keys. Make them once and keep them. They are how the server keeps the same identity every time it restarts. The app remembers that identity and refuses to connect if it changes.
mkdir -p hostkeys ssh-keygen -t ed25519 -f hostkeys/ssh_host_ed25519_key -N "" ssh-keygen -t rsa -b 4096 -f hostkeys/ssh_host_rsa_key -N ""Write the account files and start the server:
python3 bastionctl.py --root ./data accounts write --dir . docker compose up -d --force-recreatePrint your connection card. Replace the address with your server's:
python3 bastionctl.py --root ./data card --user alice --host 192.168.1.50
The card lists everything the app needs: host, port, user, password, root path and the server's key fingerprint. It contains a password, so treat it like one.
Connect the app
- In the BASTION app, open Sync, then + Add Server.
- Leave the protocol on SFTP and type in the card exactly as printed. The user name and the root path are case-sensitive.
- Change Port to the one on the card. The form starts at 22; a server set up from the kit uses 2222. This is the field people most often miss.
- Choose Save Server. The first server you save becomes the default.
- Arm the Network Gate and choose Sync Now.
- The first time, the app shows Verify Server Identity with the server's key fingerprint. Check that it matches the one on your card, then choose Trust & Sync. The sync then starts by itself.
See Connect to a server for the form in detail.
Add your content
Copy files into your storage on the server, in the folder for their kind. The app downloads them on its next sync. Folder names are lowercase.
| Folder | What goes in it |
|---|---|
data/users/alice/library/ |
Books and documents: PDF, EPUB, MOBI, TXT. A folder inside library/ becomes a category in the app. |
data/users/alice/maps/ |
Offline map packs (.mbtiles) and overlays from other tools (.kml, .kmz, .geojson, .cot). Keep other files out. |
data/users/alice/apps/ |
Android app installers (.apk). They appear in the app under SYNCED APPS. This is also where a BASTION module goes: download it from the Download page and copy it here. |
data/users/alice/tools/ |
Data that BASTION modules share, such as EXCHECK's code table. The app manages it: leave it alone. |
Your assistance reports are uploaded by the app to data/users/alice/reports/.
Things to know:
- If a file doesn't arrive, the account probably can't read it. That happens when the file was copied in as another user, such as root. Restart the server with
docker compose up -d --force-recreate; it hands every file in your storage back to your account when it starts. - To replace a file, give the new one a new name, or make sure it is newer than the old one. A replacement with the same name, the same size and an older date is not noticed.
- A replaced book is a new book. If the new file's content is different, the device ends up holding both the old book and the new one. Delete the old one in the Library.
- Deleting a file on the server does not remove it from your devices.
- Categories come from folders. A book in
library/Medical/First_Aid/is filed under both: First_Aid is its primary category and Medical a secondary one.
Add another person
Each person gets their own account and their own storage. Nobody can see anyone else's.
python3 bastionctl.py --root ./data user add bravo
python3 bastionctl.py --root ./data accounts write --dir .
docker compose up -d --force-recreate
python3 bastionctl.py --root ./data card --user bravo --host 192.168.1.50
Reaching the server from outside your network
On your own network, devices connect to the server's local address. To sync from elsewhere, the server has to be reachable from the internet, which is a decision about your network rather than about BASTION. If you open it up:
- forward only port 2222 to the server;
- keep the account passwords the admin tool generated; they are long and random;
- keep the machine and Docker updated.
Then print a new card with the outside address in --host.