File size: 2,062 Bytes
8a3277e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
# PNA Assistant — EC2 deploy script
# Run once on a fresh Ubuntu 22.04 t3.small in eu-west-2
# Usage: bash deploy-ec2.sh

set -euo pipefail

DOMAIN="pna.nursingcitizendevelopment.com"
REPO="https://github.com/Clinical-Quality-Artifical-Intelligence/Professional-Nurse-Advocate-Assistant"
EMAIL="lincoln@clinyqai.com"

echo "=== 1. System packages ==="
sudo apt-get update -y
sudo apt-get install -y docker.io docker-compose-plugin curl certbot git unzip

sudo systemctl enable docker --now
sudo usermod -aG docker "$USER"

echo "=== 2. Clone repo ==="
cd /home/"$USER"
git clone "$REPO" pna-assistant
cd pna-assistant

echo "=== 3. Create .env ==="
cat > .env <<'ENV'
STRIPE_PRO_LINK=https://buy.stripe.com/14A28t0P99Qmdph8v68og00
STRIPE_INSTITUTION=https://buy.stripe.com/9B63cxfK3d2y3OHbHi8og01
STRIPE_WEBHOOK_SECRET=whsec_REPLACE_AFTER_STRIPE_WEBHOOK_SETUP
AWS_REGION=eu-west-2
SES_FROM_EMAIL=lincoln@clinyqai.com
ENV
chmod 600 .env

echo "=== 4. Copy A-EQUIP guide ==="
mkdir -p assets
# Paste your guide file here, or scp it separately:
# scp "Professional nurse advocate A-EQUIP model Guide.md" ubuntu@<EC2_IP>:/home/ubuntu/pna-assistant/assets/aequip_guide.md
echo "  >> Remember to copy aequip_guide.md into assets/ before starting!"

echo "=== 5. Get SSL cert (stop port 80 first if running) ==="
sudo certbot certonly --standalone \
    -d "$DOMAIN" \
    --email "$EMAIL" \
    --agree-tos \
    --non-interactive

echo "=== 6. Start services ==="
# Run as current user (already in docker group after re-login)
# If first run, you may need: newgrp docker && docker compose up -d
docker compose up -d

echo ""
echo "======================================"
echo " PNA Assistant deployed!"
echo " App:     https://$DOMAIN"
echo " Webhook: https://$DOMAIN/webhook"
echo "======================================"
echo ""
echo "Next: set up Stripe webhook endpoint:"
echo "  URL: https://$DOMAIN/webhook"
echo "  Event: checkout.session.completed"
echo "  Copy the signing secret → update .env → docker compose restart pna-webhook"