From 342b8a11810657d554f06845955e96e0dea17c5a Mon Sep 17 00:00:00 2001 From: Alex Yong Date: Tue, 25 Feb 2025 18:10:21 +0000 Subject: [PATCH] feat: Adding support to run on Github Codespaces for local development and testing. Signed-off-by: Alex Yong --- .devcontainer/devcontainer.json | 9 +++++++++ README.md | 28 ++++++++++++++++++++++++++++ firefox.sh | 17 +++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 firefox.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f79ae28 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,9 @@ +{ + "name": "RevoltChat", + "postCreateCommand": "bash firefox.sh", + "forwardPorts": [6080], + "features": { + "ghcr.io/devcontainers/features/desktop-lite:1": {} + } + } + \ No newline at end of file diff --git a/README.md b/README.md index 1038ae1..bf8b250 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ This repository contains configurations and instructions that can be used for de - [Deployment](#deployment) - [Updating](#updating) - [Advanced Deployment](#advanced-deployment) +- [Github Codespaces Deployment](#github-codespaces-deployment) - [Additional Notes](#additional-notes) - [Custom Domain](#custom-domain) - [Placing Behind Another Reverse-Proxy or Another Port](#placing-behind-another-reverse-proxy-or-another-port) @@ -230,6 +231,33 @@ Then start Revolt: docker compose up -d ``` +## Github Codespaces Deployment + +> [!WARNING] +> This guide is only intended for deployments for testing and development. Codespaces is NOT recommended to be used for hosting Revolt server for other users. + +Run these commands to set up your configuration files for Revolt Server + +```bash +echo "HOSTNAME=http://local.revolt.chat" > .env.web +echo "REVOLT_PUBLIC_URL=http://local.revolt.chat/api" >> .env.web +wget -O Revolt.toml https://raw.githubusercontent.com/revoltchat/backend/main/crates/core/config/Revolt.toml +``` + +Then start Revolt: + +```bash +docker compose up -d +``` + +If you are using VSCode for Codespaces in the browser, to view your instance, go to the ports tab, select Ports, and click on the forwarded address to open up +fluxbox. + +If you are using the [Github Codespaces extention](https://code.visualstudio.com/docs/remote/codespaces) on your copy of VSCode on your local machine, the ports should forward for you automatically and you should be able to naviagte to localhost:6080 open up fluxbox. + +However you open up fluxbox, click the arrow button at the bottom left hand corner, select web browser, and when Firefox opens, navigate to http://local.revolt.chat to view the web client. + + ## Additional Notes ### Custom Domain diff --git a/firefox.sh b/firefox.sh new file mode 100644 index 0000000..03cfd93 --- /dev/null +++ b/firefox.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +echo "Updating package lists..." +sudo apt update -y + +echo "Installing Firefox..." +sudo apt install -y firefox + +# Verify installation +if command -v firefox &> /dev/null; then + echo "Firefox installed successfully!" +else + echo "Firefox installation failed." + exit 1 +fi