Add setup script

This commit is contained in:
MartinBraquet
2025-09-01 14:56:23 +02:00
parent 3b932fd52d
commit 83c6973d8e
2 changed files with 121 additions and 5 deletions

View File

@@ -5,8 +5,7 @@
# Compass
This repository provides the source code for [Compass](https://compassmeet.com), a web application where rational thinkers can bond and form deep 1-1
relationships in a fully transparent and efficient way. It just got released—please share it with anyone who would benefit from it!
This repository provides the source code for [Compass](https://compassmeet.com), a web application where rational thinkers can bond and form deep 1-1 relationships in a fully transparent and efficient way. It just got released—please share it with anyone who would benefit from it!
To contribute, please submit a pull request or issue, or fill out this [form](https://forms.gle/tKnXUMAbEreMK6FC6) for suggestions and collaborations.
@@ -63,9 +62,14 @@ git clone git@github.com:CompassMeet/Compass.git
cd Compass
```
Install the dependencies:
Install `opentofu`, `docker`, and `yarn`. Try running on Linux or macOS:
```bash
./setup.sh
```
npm install @tiptap/core@2.3.2 @tiptap/starter-kit@2.3.2 @tiptap/extension-link@2.3.2 @tiptap/extension-image@2.3.2 @tiptap/extension-blockquote@2.3.2 @tiptap/extension-bold@2.3.2 @tiptap/extension-mention@2.3.2 @tiptap/extension-floating-menu@2.3.2 @tiptap/extension-bubble-menu@2.3.2 @tiptap/suggestion@2.3.2 @tiptap/html@2.3.2 --save-exact
Install the dependencies:
```bash
yarn install
```
### Environment Variables
@@ -133,7 +137,7 @@ npm run test
Start the development server:
```bash
npm run dev
yarn dev
```
Once the server is running, visit http://localhost:3000 to start using the app. You can sign up and visit the profiles; you should see 5 synthetic profiles.

112
setup.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env bash
set -e
DIR=$(dirname "$0")
cd "$DIR" || exit 1
# ----------------------------
# Helper functions
# ----------------------------
command_exists() {
command -v "$1" >/dev/null 2>&1
}
info() {
echo -e "\033[1;34m[INFO]\033[0m $1"
}
error() {
echo -e "\033[1;31m[ERROR]\033[0m $1"
}
# ----------------------------
# Detect OS
# ----------------------------
OS="$(uname -s)"
info "Detected OS: $OS"
# ----------------------------
# Install OpenTofu
# ----------------------------
install_opentofu_linux() {
info "Installing OpenTofu for Linux..."
# LATEST=$(curl -s https://api.github.com/repos/opentofu/opentofu/releases/latest | grep browser_download_url | grep linux_amd64.zip | cut -d '"' -f 4)
LATEST=https://github.com/opentofu/opentofu/releases/download/v1.10.5/tofu_1.10.5_linux_amd64.zip
cd /tmp || exit 1
curl -LO "$LATEST"
unzip -o tofu_*_linux_amd64.zip
sudo mv tofu /usr/local/bin/
rm tofu_*_linux_amd64.zip
info "OpenTofu version: $(tofu version)"
cd $DIR || exit 1
}
install_opentofu_mac() {
info "Installing OpenTofu via Homebrew..."
if ! command_exists brew; then
error "Homebrew not found. Install it first: https://brew.sh/"
exit 1
fi
brew tap opentofu/opentofu
brew install opentofu
info "OpenTofu version: $(opentofu version)"
}
# ----------------------------
# Install Docker
# ----------------------------
install_docker_linux() {
info "Installing Docker for Linux..."
sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release unzip
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable docker
info "Docker version: $(docker --version)"
}
install_docker_mac() {
info "Please install Docker Desktop from https://www.docker.com/products/docker-desktop/"
}
# ----------------------------
# Install Yarn
# ----------------------------
install_yarn_linux() {
info "Installing Node.js LTS..."
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
info "Installing Yarn..."
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install -y yarn
info "Yarn version: $(yarn --version)"
}
install_yarn_mac() {
info "Installing Yarn via Homebrew..."
brew install yarn
info "Yarn version: $(yarn --version)"
}
# ----------------------------
# Main installation flow
# ----------------------------
if [[ "$OS" == "Linux" ]]; then
install_opentofu_linux
install_docker_linux
install_yarn_linux
elif [[ "$OS" == "Darwin" ]]; then
install_opentofu_mac
install_docker_mac
install_yarn_mac
else
error "Unsupported OS: $OS"
exit 1
fi
info "Installation completed successfully!"