From c632ceb33751253a4ec3fa2c2f4ed784d6d2622a Mon Sep 17 00:00:00 2001 From: Aleksandr Soloshenko Date: Fri, 31 May 2024 23:28:13 +0700 Subject: [PATCH] [getting-started] add custom gateway setup instructions --- deployments/secrets.tfvars.example | 2 -- docs/getting-started/custom-gateway.md | 45 ++++++++++++++++++++++++++ docs/getting-started/index.md | 16 +++++---- mkdocs.yml | 1 + 4 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 docs/getting-started/custom-gateway.md diff --git a/deployments/secrets.tfvars.example b/deployments/secrets.tfvars.example index 70e907c..bc22385 100644 --- a/deployments/secrets.tfvars.example +++ b/deployments/secrets.tfvars.example @@ -1,5 +1,3 @@ -registry-password = "password" - swarm-manager-host = "ssh://user@host:22" app-name = "app-name" app-host = "app-host.example.com" diff --git a/docs/getting-started/custom-gateway.md b/docs/getting-started/custom-gateway.md new file mode 100644 index 0000000..589c758 --- /dev/null +++ b/docs/getting-started/custom-gateway.md @@ -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) \ No newline at end of file diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md index 79203a7..474e3fa 100644 --- a/docs/getting-started/index.md +++ b/docs/getting-started/index.md @@ -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. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 4e9983f..cfa4671 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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: