Skip to content

Commit 9bdd157

Browse files
committed
docs: update README to reflect changes in v0.1.0
1 parent 0d57d85 commit 9bdd157

1 file changed

Lines changed: 175 additions & 57 deletions

File tree

README.md

Lines changed: 175 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,79 @@
11
# Linkora Sync-Server
2-
A self-hosted sync server designed for individual use and built for single-user setups, keeping your Linkora apps in sync.
2+
3+
A self-hosted sync server designed for individual use and built for single-user setups, keeping your Linkora apps in
4+
sync. Now with built-in HTTPS support and compatibility with the Linkora browser extension for comprehensive syncing.
5+
6+
-----
37

48
## Key Features
5-
- **Delta-Sync**: Only transfers changed data for efficiency
6-
- **Two-Way Sync**: Changes flow in both directions between the server and clients
7-
- **Real-Time Updates**: Live updates via WebSocket connections
8-
- **Last-Write-Wins**: If multiple devices update the same data, the latest write wins the conflict
9-
- **Multi-Database Support**: Works with MySQL, PostgreSQL, SQLite, and other SQL databases supported by [JetBrains Exposed](https://github.com/JetBrains/Exposed)
10-
- **Deployment Options**: Local JAR, Docker containers, or cloud hosting
9+
10+
- **Delta-Sync**: Only transfers changed data for efficiency.
11+
- **Two-Way Sync**: Changes flow in both directions between the server and clients.
12+
- **Real-Time Updates**: Live updates via WebSocket connections.
13+
- **Last-Write-Wins**: If multiple devices update the same data, the latest write wins the conflict.
14+
- **Secure HTTPS**: Secure connections are supported by automatically generating self-signed certificates and keystore
15+
files.
16+
- **Browser Extension Support**: Works with the Linkora browser extension for seamless web activity synchronization.
17+
- **Multi-Database Support**: Works with MySQL, PostgreSQL, SQLite, and other SQL databases supported
18+
by [JetBrains Exposed](https://github.com/JetBrains/Exposed).
19+
- **Flexible Deployment**: Local JAR, Docker containers, or cloud hosting.
20+
21+
-----
1122

1223
## Quick Start
1324

1425
### Prerequisites
15-
**For JAR deployment:**
16-
- Java 11 or later
1726

18-
**For Docker deployment:**
19-
- Docker (handles all dependencies, no Java installation required)
27+
For JAR deployment:
28+
29+
- **Java 11 or later**
30+
31+
For Docker deployment:
32+
33+
- **Docker** (handles all dependencies, no Java installation required)
34+
35+
Supported Databases:
2036

21-
**Supported Databases:**
2237
- **Tested**: MySQL, PostgreSQL, SQLite
2338
- **Untested**: Other databases supported by [JetBrains Exposed](https://github.com/JetBrains/Exposed)
2439

25-
**Warning**: Untested databases may have compatibility issues. I recommend sticking to MySQL, PostgreSQL, or SQLite for the best experience.
40+
**Warning**: Untested databases may have compatibility issues. Sticking to MySQL, PostgreSQL, or SQLite is recommended
41+
for the best experience.
42+
43+
### Getting Started with HTTPS
44+
45+
The server automatically handles HTTPS setup by generating self-signed certificates and keystore files on its first run.
46+
This means you get secure connections out-of-the-box without manual certificate configuration. These server-signed
47+
certificates have a validity period of 365 days. To use these certificates, you may need to import them into your
48+
system's trust store or directly into your browser, as the browser extension requires the certificate to be recognized.
49+
Some browsers, like Firefox, may reject self-signed certificates, requiring you to manually add an exception for the
50+
IPv4 address and port used by HTTPS.
51+
52+
To generate new certificates and keystore files, you have two options:
53+
54+
1. **Restart the server**: If the existing certificate and keystore files are removed from the server's directory,
55+
restarting the server will trigger the automatic generation of new ones.
56+
2. **Use the server's API endpoint**: Navigate to `/generate/certs-and-keystore` in your browser. You will be prompted
57+
to enter your `serverAuthToken`. Once entered, you will have two options: to *only generate* new certificates and
58+
keystore files (which will be saved in the same directory where the server JAR is located), or to *generate and
59+
download* them. If you choose to generate and download, the server will respond with a ZIP file containing all the
60+
newly generated files. If an incorrect authentication token is provided, the server will reject the request.
61+
62+
### Browser Extension
63+
64+
Get the **Linkora browser extension** to sync your web-based data. Find detailed setup instructions on
65+
the [Linkora Browser Extension GitHub repository](https://github.com/LinkoraApp/browser-extension).
66+
67+
-----
2668

2769
## Configuration
28-
Choose between configuration file or environment variables:
70+
71+
You can configure the server using either a configuration file or environment variables.
2972

3073
### Option 1: Configuration File (`linkoraConfig.json`)
31-
Auto-generated on first run - the server will prompt you for required configuration values. The `hostAddress` and `serverPort` fields are automatically set by the server:
74+
75+
This file is auto-generated on the first run; the server will prompt you for required values. The `hostAddress` and
76+
`serverPort` fields are automatically detected and set by the server.
3277

3378
```json
3479
{
@@ -37,12 +82,24 @@ Auto-generated on first run - the server will prompt you for required configurat
3782
"databasePassword": "your_password",
3883
"hostAddress": "xxx.xxx.xxx.xxx",
3984
"serverPort": 45454,
85+
"httpsPort": 54545,
86+
"keyStorePassword": "your_keystore_password",
4087
"serverAuthToken": "your_secure_token"
4188
}
4289
```
4390

91+
**HTTPS Configuration Details**:
92+
93+
- `httpsPort`: This optional field sets the port for HTTPS connections (default: `54545`).
94+
- `keyStorePassword`: This password for your keystore is **auto-generated by the server**.
95+
- For HTTPS connections, the server always uses the machine's IPv4 address. The `hostAddress` field in the configuration
96+
file primarily applies to HTTP connections.
97+
4498
### Option 2: Environment Variables
45-
Set these environment variables for containerized deployments, cloud hosting, or any deployment where you prefer environment variables over config files. The `LINKORA_HOST_ADDRESS` and `LINKORA_SERVER_PORT` are optional as the server will automatically detect/set them:
99+
100+
Use these for containerized deployments, cloud hosting, or any scenario where you prefer environment variables over
101+
configuration files. `LINKORA_HOST_ADDRESS`, `LINKORA_SERVER_PORT`, `LINKORA_HTTPS_PORT`, and
102+
`LINKORA_KEY_STORE_PASSWORD` are all optional, as the server can auto-detect/set them.
46103

47104
```bash
48105
LINKORA_SERVER_USE_ENV_VAL=true
@@ -51,60 +108,78 @@ LINKORA_DATABASE_USER=your_username
51108
LINKORA_DATABASE_PASSWORD=your_password
52109
LINKORA_HOST_ADDRESS=xxx.xxx.xxx.xxx
53110
LINKORA_SERVER_PORT=45454
111+
LINKORA_HTTPS_PORT=54545
112+
LINKORA_KEY_STORE_PASSWORD=your_keystore_password
54113
LINKORA_SERVER_AUTH_TOKEN=your_secure_token
55114
```
56115

57116
### Database URL Formats
58-
| Database | URL Format |
59-
|----------|------------|
60-
| MySQL | `mysql://hostname:port/database_name` |
117+
118+
| Database | URL Format |
119+
|------------|--------------------------------------------|
120+
| MySQL | `mysql://hostname:port/database_name` |
61121
| PostgreSQL | `postgresql://hostname:port/database_name` |
62-
| SQLite | `sqlite:/path/to/database/file.db` |
122+
| SQLite | `sqlite:/path/to/database/file.db` |
63123

64124
**Important**: For SQLite, leave `databaseUser` and `databasePassword` empty.
65125

126+
-----
127+
66128
## Deployment Options
67129

68130
### Local Deployment
69131

70132
#### Using JAR File
71-
1. Download the latest release JAR file
72-
2. Create a dedicated folder for the server
73-
3. **Critical**: Run from terminal (never double-click the JAR):
74133

75-
```bash
76-
java -jar linkoraSyncServer.jar
77-
```
134+
1. Download the latest release JAR file.
135+
136+
2. Create a dedicated folder for the server.
137+
138+
3. **Critical**: Run from your terminal (never double-click the JAR):
139+
140+
```bash
141+
java -jar linkoraSyncServer.jar
142+
```
78143

79-
**Recommendation**: Place the JAR file in a separate folder as `linkoraConfig.json` is generated in the same directory.
144+
**Recommendation**: Place the JAR file in a separate folder since `linkoraConfig.json`, as well as the server's
145+
certificates and keystore files, are generated in the same directory.
80146

81147
#### Using Docker
148+
82149
```bash
83150
# Pull the latest version of the image
84151
docker pull sakethpathike/linkora-sync-server:latest
85152

86153
# Run the server with environment variables
87-
# Note: LINKORA_HOST_ADDRESS and LINKORA_SERVER_PORT are optional
154+
# LINKORA_HOST_ADDRESS, LINKORA_SERVER_PORT, LINKORA_HTTPS_PORT, and LINKORA_KEY_STORE_PASSWORD are optional
88155
docker run -d \
89156
-e LINKORA_SERVER_USE_ENV_VAL=true \
90157
-e LINKORA_DATABASE_URL=mysql://your-db-url \
91158
-e LINKORA_DATABASE_USER=your-username \
92159
-e LINKORA_DATABASE_PASSWORD=your-password \
93160
-e LINKORA_HOST_ADDRESS=xxx.xxx.xxx.xxx \
94161
-e LINKORA_SERVER_PORT=45454 \
162+
-e LINKORA_HTTPS_PORT=54545 \
163+
-e LINKORA_KEY_STORE_PASSWORD=your_keystore_password \
95164
-e LINKORA_SERVER_AUTH_TOKEN=your-secure-token \
96165
-p 45454:45454 \
166+
-p 54545:54545 \
97167
--name linkora-sync-server \
98168
sakethpathike/linkora-sync-server:latest
99169
```
100170

101171
### Cloud Deployment
172+
102173
For cloud hosting platforms:
103-
1. Set `LINKORA_SERVER_USE_ENV_VAL=true` in your environment variables
104-
2. Configure all required environment variables through your platform's interface
105-
3. Ensure your database is accessible
174+
175+
1. Set `LINKORA_SERVER_USE_ENV_VAL=true` in your environment variables.
176+
2. Configure all required environment variables through your platform's interface.
177+
3. Ensure your database is accessible.
178+
179+
-----
106180

107181
## Systemd Setup
182+
108183
Create a service file in `/etc/systemd/system` and enable it to run at startup.
109184
Config & JAR files are in the same folder path.
110185
Add the below to your file (change values as per your setup) and name the file as `linkora.service`.
@@ -129,82 +204,125 @@ WantedBy=multi-user.target
129204
```
130205

131206
Once saved, reload the daemon & start the service:
207+
132208
```bash
133209
systemctl daemon-reload
134210
systemctl start linkora.service
135211
systemctl enable linkora.service
136212
```
137213

214+
-----
215+
138216
## Firewall Configuration
139-
If you can't connect to the server, allow the port through your firewall:
217+
218+
If you can't connect to the server, ensure the necessary ports are allowed through your firewall:
140219

141220
```bash
142-
# Allow the port (default: 45454)
221+
# Allow the HTTP port (default: 45454)
143222
sudo firewall-cmd --add-port=45454/tcp --permanent
223+
224+
# Allow the HTTPS port (default: 54545)
225+
sudo firewall-cmd --add-port=54545/tcp --permanent
226+
144227
sudo firewall-cmd --reload
145228

146-
# Verify the port is open
229+
# Verify the ports are open
147230
sudo firewall-cmd --list-ports
148231
```
149232

150-
## Critical Security & Connection Notes
233+
-----
151234

152-
**Authentication Token**: Treat `serverAuthToken` as a password—never share it publicly.
235+
## Critical Security & Connection Notes
153236

154-
**Network Access**: Connect using the server machine's IPv4 address (or the one detected and used by the server) instead of `localhost` when accessing from other devices.
237+
- **Authentication Token**: Treat `serverAuthToken` as a password—never share it publicly.
238+
- **Network Access**: When connecting from other devices, use the server machine's IPv4 address (or the one detected and
239+
used by the server) instead of `localhost`. For HTTPS connections, the server exclusively uses IPv4.
240+
- **Client-Server Compatibility**: Always verify client-server version compatibility. Mismatched versions may cause sync
241+
failures.
155242

156-
**Client-Server Compatibility**: Always verify client-server version compatibility. Mismatched versions may cause sync failures.
243+
-----
157244

158245
## Troubleshooting
159246

160247
### Common Issues
161248

162249
**Cannot connect to server from Linkora app**
163-
- Check if the server port is allowed through your firewall
164-
- Ensure you're using the server machine's IPv4 address (or the one detected and used by the server) instead of `localhost` when connecting from other devices
165-
- Verify the `serverAuthToken` matches between server and client
250+
251+
- Check if the server port(s) (HTTP: 45454, HTTPS: 54545) are allowed through your firewall.
252+
- Ensure you're using the server machine's IPv4 address (or the one detected and used by the server) instead of
253+
`localhost` when connecting from other devices.
254+
- Verify the `serverAuthToken` matches between the server and client.
166255

167256
**Server fails to start**
168-
- Ensure Java 11+ is installed and accessible
169-
- Check database connectivity and credentials
170-
- Verify the database URL format is correct for your database type
171-
- For JAR deployment, ensure you're running from terminal, not double-clicking
257+
258+
- Ensure Java 11+ is installed and accessible.
259+
- Check database connectivity and credentials.
260+
- Verify the database URL format is correct for your database type.
261+
- For JAR deployment, ensure you're running from the terminal, not double-clicking.
172262

173263
**Database connection errors**
174-
- Confirm your database server is running and accessible
175-
- Verify database URL, username, and password are correct
176-
- For SQLite, ensure the file path is accessible and the directory exists
264+
265+
- Confirm your database server is running and accessible.
266+
- Verify database URL, username, and password are correct.
267+
- For SQLite, ensure the file path is accessible and the directory exists.
177268

178269
**Configuration issues**
179-
- Ensure `LINKORA_SERVER_USE_ENV_VAL=true` when using environment variables
180-
- Verify all required fields are properly set in your chosen configuration method
270+
271+
- Ensure `LINKORA_SERVER_USE_ENV_VAL=true` when using environment variables.
272+
- Verify all required fields are properly set in your chosen configuration method.
273+
274+
-----
181275

182276
## How It Works
183-
![Linkora Workflow](https://github.com/user-attachments/assets/bb2d9b7e-92c4-41ed-82d3-ad821cc65638)
184277

185-
For detailed technical information about the synchronization mechanism, read the [technical blog post](https://sakethpathike.github.io/blog/synchronization-in-linkora).
278+
For detailed technical information about the synchronization mechanism, read
279+
the [technical blog post](https://sakethpathike.github.io/blog/synchronization-in-linkora).
280+
281+
Beyond the core sync logic, the Linkora Sync-Server also handles rendering user interfaces for specific functions. For
282+
example, the Linkora browser extension's UI is built and served directly by this sync server. The interface for the
283+
certificate generation endpoint is also handled this way. These UIs are generated using my Kotlin Multiplatform library,
284+
[Kapsule](https://github.com/sakethpathike/kapsule). Kapsule helps simplify creating static HTML by using a familiar Jetpack Compose-style approach with
285+
`kotlinx.html`.
286+
287+
-----
186288

187289
## Important Notes
188-
- **Single User Design**: Designed exclusively for individual use, not multi-user environments
189-
- **Configuration File Location**: For JAR deployments, `linkoraConfig.json` is created in the same directory as the JAR file when you first run the server
190-
- **Database Compatibility**: Linkora supports multiple databases through Exposed. The server has been tested with MySQL, SQLite, and PostgreSQL
191-
- **Environment Variables**: For local JAR hosting, `linkoraConfig.json` is recommended. For Docker and cloud hosting, use environment variables
192-
- **Host Address**: The `hostAddress` field automatically defaults to the machine's current network IPv4 address. The server detects this automatically, so no manual configuration is needed. When connecting from Linkora apps, use this address instead of `localhost`
290+
291+
- **Single User Design**: Designed exclusively for individual use, not multi-user environments.
292+
- **Configuration File Location**: For JAR deployments, `linkoraConfig.json` is created in the same directory as the JAR
293+
file when you first run the server.
294+
- **Database Compatibility**: Linkora supports multiple databases through Exposed. The server has been tested with
295+
MySQL, SQLite, and PostgreSQL.
296+
- **Environment Variables**: For local JAR hosting, `linkoraConfig.json` is recommended. For Docker and cloud hosting,
297+
use environment variables.
298+
- **Host Address**: The `hostAddress` field automatically defaults to the machine's current network IPv4 address. The
299+
server detects this automatically, so no manual configuration is needed for HTTP connections. When connecting from
300+
Linkora apps, use this address instead of `localhost`.
301+
- **HTTPS Certificates & Keystore**: The server automatically generates required certificates and keystore files.
302+
303+
-----
193304

194305
## Support
306+
195307
**Star the repo** if you find Linkora useful
196308

197309
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/sakethpathike)
198310

199311
## Community
312+
200313
[![Join us on Discord](https://discord.com/api/guilds/1214971383352664104/widget.png?style=banner2)](https://discord.gg/ZDBXNtv8MD)
201314

202315
## Contributing
316+
203317
Contributions are welcome! You can help by:
318+
204319
- Reporting bugs and issues
205320
- Suggesting new features
206321
- Submitting pull requests
207322
- Improving documentation
208323

324+
-----
325+
209326
## License
327+
210328
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)