# Put GroupChat online for free (Oracle Cloud Always Free)

> Just want to try it from other places right now? Double-click **START-PUBLIC.bat** instead:
> it gives the app a temporary public address while your PC is on. Use this guide for a
> permanent 24/7 address.

After this, anyone can join from any network using the group link,
over HTTPS, 24/7, without your PC being on. It takes about 30–45 minutes the first time.

## 1. Create an Oracle Cloud account
1. Go to https://www.oracle.com/cloud/free/ and click **Start for free**.
2. **Home Region:** choose **India West (Mumbai)** or **India South (Hyderabad)**.
   This can't be changed later, and the free resources only exist in your home region.
3. Oracle asks for a card for identity verification (a small temporary hold is refunded).
   You are not charged for anything labelled **Always Free-eligible**.

## 2. Create the server (VM)
1. Menu → **Compute → Instances → Create instance**.
2. **Image:** click *Change image* → **Canonical Ubuntu 24.04**.
3. **Shape:** click *Change shape* →
   - **Ampere → VM.Standard.A1.Flex**, 1 OCPU, 6 GB memory (best), or
   - if it says *out of capacity*: **Specialty and previous generation → VM.Standard.E2.1.Micro**.
   Both show **Always Free-eligible**.
4. **Networking:** keep *Create new virtual cloud network* and *public subnet*, and make sure
   **Assign a public IPv4 address** is on.
5. **Add SSH keys:** choose **Generate a key pair for me** → click **Save private key**.
   Keep this `.key` file safe; you need it to deploy.
6. Click **Create**. When it's *Running*, copy the **Public IP address**.

## 3. Open the web ports (80 and 443)
1. On the instance page, click the **Subnet** link → **Security Lists** → *Default Security List*.
2. **Add Ingress Rules**: Source CIDR `0.0.0.0/0`, IP Protocol **TCP**,
   Destination Port Range `80,443` → **Add**.

## 4. (Recommended) Get a free, permanent web address
1. Go to https://www.duckdns.org and sign in (Google login is fine).
2. Type a name, e.g. `mygroupchat`, click **add domain**, then put your server's public IP
   in the *current ip* box and click **update ip**.
3. Copy your **token** from the top of the page.

Your address is now `mygroupchat.duckdns.org`. (If you skip this step, the installer
uses a free automatic address like `140-238-1-2.sslip.io` instead.)

## 5. Deploy
1. Double-click **DEPLOY-TO-SERVER.bat** in this folder.
2. Answer the questions: server IP, username `ubuntu`, path to the `.key` file,
   your DuckDNS address and token.
3. Wait 3–6 minutes. When asked, create your **admin username and password**.
4. At the end it prints your live address, e.g. `https://mygroupchat.duckdns.org`.

## 6. Use it
- Open `https://<your address>/admin` and log in.
- Select a group and click **Copy Link** (or **Share**) under **Group link**. Send that link
  to anyone: they open it, type their name and they're in, from any network.
- Links copied earlier from `localhost` or a `trycloudflare.com` address won't work here.
  Copy the group link again from this address. Personal invite links: click **New Link**
  in **View Members** for each person.

## Updating the app later
Double-click **DEPLOY-TO-SERVER.bat** again. Your settings are remembered, and your groups,
messages and files are kept.

## Good to know
- **Keep the server from being reclaimed:** Oracle may reclaim *idle* free VMs.
  To avoid this, upgrade the account to **Pay As You Go** (Billing → Upgrade). Always Free
  resources stay free; set a **budget alert** of ₹100 for peace of mind.
- **Backups:** the database is backed up daily on the server to `/var/backups/groupchat`
  (kept 14 days). Uploaded photos/videos are not backed up.
- **Useful server commands** (after `ssh -i <key> ubuntu@<ip>`):
  - View live logs: `sudo journalctl -u groupchat -f`
  - Restart the app: `sudo systemctl restart groupchat`
  - Reset the admin password: `sudo groupchat-create-admin --reset`
