Skip to content

Commit

Permalink
[getting-started] add custom gateway setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
capcom6 committed May 31, 2024
1 parent f01d77f commit c632ceb
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
2 changes: 0 additions & 2 deletions deployments/secrets.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
registry-password = "password"

swarm-manager-host = "ssh://user@host:22"
app-name = "app-name"
app-host = "app-host.example.com"
45 changes: 45 additions & 0 deletions docs/getting-started/custom-gateway.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Custom Gateway Setup

By setting up a custom gateway, you gain full control over communications and data. However, this process requires technical skills and infrastructure. Before starting, please consider the [Private Server](./private-server.md) mode, as it offers additional privacy features and is not significantly different from a self-built solution, with much fewer setup operations required.

## Before You Begin

As of the time of writing this document, the backend in its default configuration exposes public endpoints. Therefore, anyone who knows the server address can connect a mobile app to it and use the API.

Please be aware that these instructions are simplified and do not cover detailed security configurations, such as firewall settings and HTTPS setup. Implementing these security measures is the user's responsibility.

**Use at your own risk.**

## Prerequisites

1. Android Studio with the Android SDK installed.
2. A Google Firebase account and a project with Cloud Messaging activated.
3. A MySQL or MariaDB database.
4. A VPS (Virtual Private Server) with a public IP address.
5. A reverse proxy such as Nginx or Traefik with HTTPS support.
6. Go programming language with the latest version installed (only necessary for using private server mode).

## Backend

If you do not plan to use the private server mode, there is no need to rebuild the backend. You can follow the instructions for the [Private Server](./private-server.md) mode with the following changes:

1. Set the `gateway.mode` value to `public`.
2. Update the `fcm.credentials_json` with the content of your Firebase project's credentials JSON file.

### Private Server Mode

To use the private server mode, you must rebuild the backend after modifying the file at `internal/sms-gateway/modules/push/upstream/client.go` to set your main server address. You can then build the binary by executing `make build` or the Docker image by running `make docker-build`.

## Android App

To build a custom version of the Android application that will communicate with your server, follow these steps:

1. Clone the repository at [https://github.com/capcom6/android-sms-gateway](https://github.com/capcom6/android-sms-gateway) and open it in Android Studio.
2. Navigate to `app/src/main/java/me/capcom/smsgateway/modules/gateway/GatewayApi.kt` and update the `BASE_URL` constant to your server's URL.
3. Modify the `applicationId` in `app/build.gradle` to a unique value.
4. Refer to the instructions at [https://firebase.google.com/docs/android/setup](https://firebase.google.com/docs/android/setup) to register your application and generate the `google-services.json` file.
5. Build and run the application.

## See Also

* [GitHub Discussion](https://github.com/capcom6/android-sms-gateway/discussions/71)
16 changes: 10 additions & 6 deletions docs/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Getting Started

The Android SMS Gateway can operate in three distinct modes, all using the same API:
The Android SMS Gateway can operate in three distinct modes, all utilizing the same API:

1. [**Local Server**](./local-server.md): Operate entirely within your local network by running the server directly on your Android device. This is perfect for a quick setup and use where Internet access isn't necessary. For remote access, you may need to adjust your network settings and consider additional security measures.
2. [**Public Cloud Server**](./public-cloud-server.md): Connect easily via the Internet using our public server at `sms.capcom.me`. Messages are routed through this server to your devices, which simplifies the setup without the need for network adjustments. This is suitable for non-sensitive data only — for more secure communication, please check out the [end-to-end encryption section](../privacy/encryption.md).
3. [**Private Server**](./private-server.md): Deploy your own server instance and connect your Android devices to ensure maximum privacy. We won't have access to your message content, making this the preferred option for sensitive communication. However, it requires setting up and maintaining your own infrastructure, which includes a database and server application.
1. [**Local Server**](./local-server.md): Operate entirely within your local network by running the server on your Android device. This mode is perfect for quick setups with no need for Internet access. For remote access, you may need to configure your network settings and implement additional security measures.
2. [**Public Cloud Server**](./public-cloud-server.md): Easily connect via the Internet using the public server at `sms.capcom.me`. Messages are routed through this server to your devices, simplifying the setup without requiring network adjustments. This mode is suitable for non-sensitive data only. For more secure communication, please refer to the [end-to-end encryption section](../privacy/encryption.md).
3. [**Private Server**](./private-server.md): Deploy your own server instance and connect your Android devices to ensure maximum privacy. We will not have access to your message content, making this the preferred option for sensitive communication. However, this option requires setting up and maintaining your own infrastructure, including a database and server application.

For any of these modes, you'll first need to install the Android SMS Gateway app on your device as described in the [Installation](../installation.md) section.
To begin with any of these modes, you must first install the Android SMS Gateway app on your device, as described in the [Installation](../installation.md) section.

For more information on how to use the API, please refer to the [API](../api.md) section.
For more details on how to use the API, please consult the [API](../api.md) section.

## Building Your Own Gateway

Building your own gateway is an option that allows you to create an independent infrastructure without any connection to the public server at `sms.capcom.me`. In most cases, this is not necessary, and you can use the [Private Server](./private-server.md) mode with all of its privacy features. However, if you require full control, please see [Custom Gateway Setup](./custom-gateway.md) section.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ nav:
- Local Server: getting-started/local-server.md
- Public Cloud Server: getting-started/public-cloud-server.md
- Private Server: getting-started/private-server.md
- Custom Gateway Setup: getting-started/custom-gateway.md
- API: api.md
- Pricing: pricing.md
- Privacy:
Expand Down

0 comments on commit c632ceb

Please sign in to comment.