This is a Next.js project bootstrapped with create-next-app.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Inter, a custom Google Font.
-
Create a SendGrid Account
- Go to https://sendgrid.com/ and sign up for a free account.
-
Authenticate a Sender Email
- In the SendGrid dashboard, go to Email API > Sender Authentication
- Under Single Sender Verification, click "Create a Sender"
- Fill out the form:
- From Name: (e.g. YourApp Support)
- From Email: your personal or test email (e.g. [email protected])
- Reply-To Email: (can be the same as above)
- You'll receive a confirmation email — verify it.
- Note: Until domain authentication is set up (which we don't require for local dev), each teammate needs to use their own verified sender email.
-
Generate an API Key
- Navigate to Settings > API Keys
- Click "Create API Key"
- Give it a name (e.g., local-dev-key)
- Select Full Access or at least "Mail Send"
- Click Create & Copy the key
-
Add your key and sender email to a .env file
- In your project root, create a .env file (if it doesn't exist already), and add:
SENDGRID_API_KEY=your-api-key-here [email protected] -
Restart your dev server
- If it's already running, make sure to restart so the environment variables are loaded.
This section provides instructions for deploying the application to Azure.
- Navigate to Azure Portal and search for 'Virtual machine'
- Click 'Create' and select 'Azure virtual machine'
- Fill in the project details:
- Subscription: Select your subscription
- Resource group: Click 'Create new' to create a new one
- Configure instance details:
- Virtual machine name: Choose a name for your VM
- Leave all other default settings unchanged
- Set up administrator account:
- Username: Create a username (make sure to remember this)
- Password: Create a password that meets requirements (e.g., Team3-Spider!)
- Configure inbound port rules:
- Public inbound ports: Select 'Allow selected ports'
- Select inbound ports: HTTP (80), HTTPS (443), SSH (22)
- Click 'Review + create', then 'Create' to confirm and deploy
⚠️ CHECKPOINT: Record this important information:
- Public IP address: (example: 20.77.24.37)
- Administrative username: (example: team3)
- Administrative password: (example: Team3-Spider!)
- Navigate to Azure Portal and search for 'Storage accounts'
- Click 'Create'
- Fill in the storage account details:
- Subscription: Same as VM
- Resource group: Same as VM
- Storage account name: Choose a unique name (e.g., 0067team3demostorage)
- Region: Same as VM
- Use default settings for other options
- Click 'Review + create', then 'Create' to confirm
- Once created, navigate to the storage account
- Create a storage container:
- Click 'Containers' in the left menu
- Click '+ Container'
- Name: Enter a name (e.g., 0067team3demostorage-container)
- Click 'Create'
- Get the connection string:
- Navigate to 'Security + networking' → 'Access keys'
- Click 'Show' next to a connection string and copy it
⚠️ CHECKPOINT: Record this important information:
- Storage account name: (example: 0067team3demostorage)
- Storage container name: (example: 0067team3demostorage-container)
- Connection string: (Your full connection string)
- Open PowerShell (Windows) or Terminal (macOS/Linux)
- Connect using SSH with your credentials:
Replace
ssh username@ip_address
usernamewith your administrative username andip_addresswith your VM's IP address - If connecting for the first time, type 'yes' when asked about host authenticity
- Enter your password when prompted
Execute the following commands one by one:
-
Remove any conflicting packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
-
Update and install prerequisites:
sudo apt-get update sudo apt-get install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc -
Add the repository to Apt sources:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update package index:
sudo apt-get update
-
Install Docker and related packages:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
Possible messages you will see after running the above code (and you can ignore it):
E: Package 'docker-ce' has no installation candidate E: Unable to locate package docker-ce-cli E: Unable to locate package containerd.io E: Couldn't find any package by glob 'containerd.io' E: Couldn't find any package by regex 'containerd.io' E: Unable to locate package docker-buildx-plugin E: Unable to locate package docker-compose-pluginsudo apt install docker-compose
-
Verify installation:
sudo docker run hello-world
If successful, you'll see a message indicating that Docker is working correctly.
-
Clone the GitHub repository:
git clone https://github.com/UCLComputerScience/COMP0067_2025_Team3.git
-
Navigate to the project directory:
cd COMP0067_2025_Team3
- Download the repository code to your local machine
- Create a file named
.env.productionin the project root with the following content (replace with your values):
NEXT_PUBLIC_APP_URL=https://your-domain-name.cloudapp.azure.com
BASEPATH=
NODE_ENV=production
NEXTAUTH_URL=https://your-domain-name.cloudapp.azure.com/
NEXTAUTH_SECRET=L+tNhw7zwbUJF9OIG6n/xGGYWc0CO6kCIzRR+D3AAw0=
AZURE_STORAGE_ACCOUNT_NAME=your-storage-account-name
AZURE_STORAGE_CONTAINER_NAME=your-storage-container-name
AZURE_STORAGE_CONNECTION_STRING=your-connection-string
SENDGRID_API_KEY=your-sendgrid-api-key
SENDGRID_SENDER_EMAIL=your-sender-email
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=spider
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?schema=public"
- Replace all occurrences of the domain name in the project files:
- Search for "team3docker.uksouth.cloudapp.azure.com"
- Replace with your domain name (e.g., "team3demo.uksouth.cloudapp.azure.com")
-
Install and set up an SFTP client (e.g., XFTP, FileZilla):
- Download from XFTP website or your preferred source
- Create a new session with:
- Host: Your VM's IP address
- Username: Your administrative username
- Password: Your administrative password
- Connect to the VM
-
Transfer the following files from your local machine to the VM:
docker-compose.ymldocker-compose-init.yml.env.production- The entire
nginx/folder
-
Navigate to the project directory on the VM:
cd COMP0067_2025_Team3 -
Create the following volumes:
sudo docker volume create --name=certbot-etc sudo docker volume create --name=certbot-www
-
Run the Docker Compose Init to get the certificate for the website (once success, press Ctrl + C to exit):
sudo docker-compose -f docker-compose-init.yml up
-
Put the Docker Compose Init down once successfully get the cerficiate:
sudo docker-compose -f docker-compose-init.yml down
-
Run Docker Compose to start the application (might take a long time to build):
sudo docker-compose up -d --build
-
Check if containers are running:
sudo docker ps
-
Access your application through a web browser:
https://your-domain-name.cloudapp.azure.com
-
Check container logs:
sudo docker logs [container_name]
-
Restart containers if needed:
sudo docker-compose -f docker-compose.yml restart
-
Remove and recreate containers:
sudo docker-compose -f docker-compose.yml down sudo docker-compose -f docker-compose.yml up -d
