Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env bash
set -e

echo '====================================='
echo ' ____ _ _ '
echo ' | _ \ __ _ _ __ (_) __| | ___ ____'
echo ' | |_) / _` | '\''_ \| |/ _` |/ _ \_ /'
echo ' | _ < (_| | |_) | | (_| | __// / '
echo ' |_| \_\__,_| .__/|_|\__,_|\___/___|'
echo ' |_| '
echo ' Welcome to the Rapidez installer!'
echo '====================================='

# Vars
DEFAULT_TRAEFIK_PORT=80
DEFAULT_DB_PORT=3306
INSTALL_DIR="${RAPIDEZ_HOME:-rapidez}"

# Helpers
command_exists() {
command -v "$1" >/dev/null 2>&1
}

find_free_port() {
local port=$1

while nc -z localhost "$port" >/dev/null 2>&1; do
port=$((port + 1))
done

echo "$port"
}

# Start!
if ! command_exists docker; then
echo "❌ Docker is not installed!"
echo "Please install Docker and try again"
exit 1
fi

if ! docker compose version >/dev/null 2>&1; then
echo "❌ Docker Compose is not available!"
echo "Please update Docker and try again"
exit 1
fi

echo "✓ Docker found"

mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"

composer create-project rapidez/rapidez:^5.0 .
composer require rapidez/reviews

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What makes this package special enough that it needs to be included in a base install of Rapidez? If it's that special it may as well go into the core IMO 🤔


if [ ! -f docker-compose.yml ]; then
echo "⚠️ No docker-compose.yml found"
echo "Check the errors and try again"
exit 1
fi

TRAEFIK_PORT=$(find_free_port "$DEFAULT_TRAEFIK_PORT")
DB_PORT=$(find_free_port "$DEFAULT_DB_PORT")

echo "✓ Free ports found:"
echo " HTTP: $TRAEFIK_PORT"
echo " MySQL: $DB_PORT"

cp .env.example.traefik .env
sed -i.bak "s/^TRAEFIK_PORT=.*/TRAEFIK_PORT=$TRAEFIK_PORT/" .env && rm -f .env.bak
sed -i.bak "s/^DB_PORT=.*/DB_PORT=$DB_PORT/" .env && rm -f .env.bak
echo "✓ .env configured"

docker exec rapidez php artisan key:generate
echo "✓ key generated"
docker exec rapidez php artisan rapidez:install --frontendonly
echo "✓ frontend dependencies copied"
docker exec rapidez yarn
echo "✓ frontend dependencies installed"
docker exec rapidez yarn run prod
echo "✓ frontend dependencies build"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "✓ frontend dependencies build"
echo "✓ frontend dependencies built"

Past tense 😉

docker exec rapidez php artisan storage:link
echo "✓ storage linked"
docker exec rapidez php artisan rapidez:index
echo "✓ products indexed"
docker exec rapidez php artisan vendor:publish --provider "Rapidez\Core\RapidezServiceProvider"
echo "✓ configs published"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also publishes the views, right?

Suggested change
echo "✓ configs published"
echo "✓ configs, views, and translation files published"


docker compose up -d

echo ""
echo "🎉 Rapidez is ready!"
echo ""
echo "Rapidez frontend:"
echo "http://rapidez.localhost:$TRAEFIK_PORT"
echo ""
echo "Magento admin:"
echo "http://magento.localhost:$TRAEFIK_PORT/admin"
echo ""
echo "To stop everything:"
echo "docker compose down"
echo ""
echo "From here:"
echo "- Have a look, and make some changes in the templates: /resources/views/vendor/rapidez/"
echo "- Check the docs @ https://docs.rapidez.io"
echo "- Questions? Join Slack @ https://rapidez.io/slack"
Loading