An open API service indexing awesome lists of open source software.

https://github.com/lintshiwe/v-crisislink

CrisisLink is a mobile-first disaster rescue platform designed for South Africans facing extreme weather events. The system instantly sends users' live locations and triggers visual warnings when danger is imminent, helping them prepare and respond faster.
https://github.com/lintshiwe/v-crisislink

devops disaster-relief emergency-response south-africa vagrant vagrantfile virtualization

Last synced: 8 months ago
JSON representation

CrisisLink is a mobile-first disaster rescue platform designed for South Africans facing extreme weather events. The system instantly sends users' live locations and triggers visual warnings when danger is imminent, helping them prepare and respond faster.

Awesome Lists containing this project

README

          

# CrisisLink2.0 Vagrant Setup

This repository contains Vagrant configuration to automatically set up and run the CrisisLink2.0 application in a virtual machine.

## 🚨 What is CrisisLink?

CrisisLink is a mobile-first disaster rescue platform built for South Africans facing extreme weather emergencies. With one tap on a glowing SOS button, users instantly send their live location and alert status to 24/7 emergency agents. The system also monitors local weather conditions and triggers visual warnings when danger is imminentβ€”helping users prepare and respond faster.

## πŸ› οΈ Prerequisites

Before you begin, ensure you have the following installed on your host machine:

1. [Vagrant](https://www.vagrantup.com/downloads) (2.2.19 or newer)
2. [VirtualBox](https://www.virtualbox.org/wiki/Downloads) (6.1 or newer)
3. Git (to clone this repository)

## πŸš€ Getting Started

Follow these steps to set up and run CrisisLink using Vagrant:

### 1. Clone this Repository

```bash
git clone https://github.com/Lintshiwe/V-CrisisLink.git
cd V-CrisisLink
```

### 2. Start the Vagrant VM

```bash
vagrant up
```

This command will:

- Download the Debian Bullseye base box (if not already present)
- Set up a virtual machine with 2GB RAM and 2 CPU cores
- Install all required dependencies (Node.js, PostgreSQL with PostGIS, Redis)
- Clone the CrisisLink2.0 repository from GitHub
- Set up the database and required environment files
- Install all project dependencies
- Fix any potential native module issues (like bcrypt)
- Start the application automatically

The entire setup is fully automated - no manual steps required!

### 3. Access the Application

Once the VM is provisioned (this may take several minutes), you can access the application at:

- Frontend: [http://localhost:3000](http://localhost:3000)
- Backend API: [http://localhost:5000](http://localhost:5000)

## πŸ”§ Managing the VM

- **SSH into the VM**: `vagrant ssh`
- **Stop the VM**: `vagrant halt`
- **Restart the VM**: `vagrant reload`
- **Destroy the VM**: `vagrant destroy`

## βš™οΈ Configuration

The Vagrant setup includes:

- **Port Forwarding**:

- Frontend (port 3000)
- Backend API (port 5000)

- **System Requirements**:
- 2GB RAM
- 2 CPU cores

You can modify these settings in the `Vagrantfile` if needed.

## πŸ”‘ API Keys Setup

CrisisLink comes with pre-configured API keys for core functionality, but you can also use your own keys.

### Quick Setup (Recommended)

1. **Run the setup script**:

```bash
./setup-api-keys.sh
```

2. **Start Vagrant**:

```bash
vagrant up
```

### Manual Setup

1. **Copy the template**:

```bash
cp api-keys.env.template api-keys.env
```

2. **Edit your API keys**:

```bash
nano api-keys.env
```

3. **Start Vagrant**:

```bash
vagrant up
```

### Pre-configured Services

The following services are **already configured** and working:

βœ… **OpenWeatherMap API** - Real-time weather data and alerts
βœ… **Ambee Environmental API** - Natural disaster monitoring
βœ… **Google Maps API** - Interactive maps and geolocation
βœ… **Google Firebase API** - Real-time database and notifications

### Optional Services (Require Your Own Credentials)

❌ **Twilio SMS** - Emergency SMS alerts (optional)
❌ **Custom JWT Secret** - Enhanced security (recommended for production)

### Security Features

- πŸ”’ **API keys are never committed to Git** (protected by .gitignore)
- πŸ”’ **Automatic environment variable injection** during VM setup
- πŸ”’ **Template system** for easy key management
- πŸ”’ **Fallback to working defaults** if no custom keys provided

## 🧩 Project Structure

Inside the VM, the CrisisLink project is located at `/home/vagrant/CrisisLink` with the following structure:

- `backend/` - Node.js backend API
- `frontend/` - React frontend application
- `database/` - Database schema and migrations

## πŸ“ Troubleshooting

If you encounter any issues:

### Check the service status

```bash
vagrant ssh -c "sudo systemctl status crisislink"
```

### View service logs

```bash
vagrant ssh -c "sudo journalctl -u crisislink"
```

### Restart the application

```bash
vagrant ssh -c "sudo systemctl restart crisislink"
```

### Fix bcrypt native module issues

If you see errors about the bcrypt module:

```bash
vagrant ssh
cd ~/CrisisLink/backend
npm rebuild bcrypt --build-from-source
sudo systemctl restart crisislink
```

### Check if ports are in use

```bash
vagrant ssh -c "netstat -tulpn | grep -E '3000|5000'"
```

### Database Health Check

Run the comprehensive database health check:

```bash
vagrant ssh -c "./db-health-check.sh"
```

### Database troubleshooting

Check database connection:

```bash
vagrant ssh -c "sudo -u postgres psql -d crisislink -c 'SELECT version();'"
```

List databases and tables:

```bash
vagrant ssh
sudo -u postgres psql -c '\l' # List databases
sudo -u postgres psql -d crisislink -c '\dt' # List tables
```

Restart database service:

```bash
vagrant ssh -c "sudo systemctl restart postgresql"
```

Test application database connection:

```bash
vagrant ssh -c "PGPASSWORD=crisislink_password psql -h localhost -U crisislink_user -d crisislink -c 'SELECT 1;'"
```

## πŸ“„ License

CrisisLink is available under the MIT License.