diff --git a/README.md b/README.md index b14dac28..5ae0a894 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,7 @@ cases and learning Django skills. The project is easy to customize, allowing for ### Prerequisites -- Docker and Docker Compose installed on your machine. -- Python 3.12 if running locally without Docker. +- Docker and Docker Compose installed on your machine - that's it! ### Installation @@ -42,15 +41,49 @@ cases and learning Django skills. The project is easy to customize, allowing for cd eVibes ``` -2. Copy the example environment file and configure it. - -3. Build and start the services: +2. Choose the storefront. By default, `main` branch has Astro one. Skip this step if you're OK with Astro. ```bash - docker-compose up -d --build + git checkout storefront- ``` - This command will build the Docker images and start all the services defined in the `docker-compose.yml` file. +3. Generate your .env file. Check and confirm the contents afterwards. + + - Windows + ```powershell + scripts\Windows\generate-environment-file.ps1 + ``` + - Unix + ```bash + scripts/Unix/generate-environment-file.sh + ``` + +4. Install all the dependencies. + + - Windows + ```powershell + scripts\Windows\install.ps1 + ``` + - Unix + ```bash + scripts/Unix/install.sh + ``` + +5. Spin it up. + + - Windows + ```powershell + scripts\Windows\run.ps1 + ``` + - Unix + ```bash + scripts/Unix/run.sh + ``` + +6. Bring to production. + + Include `nginx` file to your nginx configuration, you really want to install and + run [Certbot](https://certbot.eff.org/) afterwards! ## Configuration @@ -58,78 +91,40 @@ cases and learning Django skills. The project is easy to customize, allowing for Don't forget to change the `RUN sed -i 's|https://deb.debian.org/debian|https://ftp..debian.org/debian|g' /etc/apt/sources.list.d/debian.sources` +before running installment scripts -### Environment Variables +### nginx -The project uses environment variables for configuration. Below is an example of the `.env` file: +Please comment-out SSL-related lines, then apply needed configurations, run `certbot --cert-only --nginx`, +decomment previously commented lines and enjoy eVibes over HTTPS! -```plaintext -EVIBES_PROJECT_NAME="eVibes" -EVIBES_FRONTEND_DOMAIN="evibes.com" -EVIBES_BASE_DOMAIN="evibes.com" -SENTRY_DSN="" -DEBUG=1 +### .env -SECRET_KEY="SUPERSECRETKEY" -JWT_SIGNING_KEY="SUPERSECRETJWTSIGNINGKEY" - -ALLOWED_HOSTS="evibes.com api.evibes.com b2b.evibes.com" -CSRF_TRUSTED_ORIGINS="https://evibes.com https://api.evibes.com https://www.evibes.com https://b2b.evibes.com" -CORS_ALLOWED_ORIGINS="https://evibes.com https://api.evibes.com https://www.evibes.com https://b2b.evibes.com" - -POSTGRES_DB="evibes" -POSTGRES_USER="evibes_user" -POSTGRES_PASSWORD="SUPERSECRETPOSTGRESPASSWORD" - -DBBACKUP_SFTP_HOST="Your SFTP backup host" -DBBACKUP_SFTP_USER="The username to use to log in to that host" -DBBACKUP_SFTP_PASS="The password to use to log in to that host" - -ELASTIC_PASSWORD="SUPERSECRETELASTICPASSWORD" - -REDIS_PASSWORD="SUPERSECRETREDISPASSWORD" - -CELERY_BROKER_URL="redis://:SUPERSECRETREDISPASSWORD@redis:6379/0" -CELERY_RESULT_BACKEND="redis://:SUPERSECRETREDISPASSWORD@redis:6379/0" - -PROMETHEUS_USER="evibes" -PROMETHEUS_PASSWORD="SUPERSECRETFLOWERPASSWORD" - -EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend" -EMAIL_HOST="smtp.whatever.evibes.com" -EMAIL_PORT="465" -EMAIL_USE_TLS=0 -EMAIL_USE_SSL=1 -EMAIL_HOST_USER="your-email-user@whatever.evibes.com" -EMAIL_HOST_PASSWORD="SUPERSECRETEMAILHOSTPASSWORD" -EMAIL_FROM="your-email-user@whatever.evibes.com" - -COMPANY_NAME="eVibes, Inc." -COMPANY_PHONE_NUMBER="+888888888888" -COMPANY_ADDRESS="The place that does not exist" - -OPENAI_API_KEY="Haha, really?" -ABSTRACT_API_KEY="Haha, really? x2" -DEEPL_AUTH_KEY="Haha, really? x3" -``` - -**Note**: Replace all placeholder values (e.g., `your-secret-key`, `your-database-name`) with your actual configuration. +After .env file generation, you may want to edit some of it's values such as macroservices' API keys, database password, +redis password, etc. ## Usage -Add these lines to your hosts-file to use django-hosts functionality on localhost: +- Add needed subdomains to DNS-settings of your domain, those are: + +1. @.your-domain.com +2. www.your-domain.com +3. api.your-domain.com +4. b2b.your-domain.com +5. prometheus.your-domain.com + +- Add these lines to your hosts-file to use django-hosts functionality on localhost(*DEVELOPMENT ONLY*): ```hosts 127.0.0.1 api.localhost 127.0.0.1 b2b.localhost ``` -Otherwise, add needed subdomains to DNS-settings of your domain. +Once the services are up and running, you can access the application at +`http://api.your-domain.com`(http://api.localhost:8000). -Once the services are up and running, you can access the application at `http://api.localhost:8000`. - -- **Django Admin**: `http://api.localhost:8000/admin/` -- **API Endpoints**: +- **Django Admin**: `http://api.your-domain.com/` (will redirect to admin) +- **API Docs**: - REST API: `http://api.localhost:8000/docs/swagger` or `http://api.localhost:8000/docs/redoc` - GraphQL API: `http://api.localhost:8000/graphql/` diff --git a/scripts/Unix/export-environment-file.sh b/scripts/Unix/export-environment-file.sh index 76b6b80b..5b6c5a2b 100755 --- a/scripts/Unix/export-environment-file.sh +++ b/scripts/Unix/export-environment-file.sh @@ -23,7 +23,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" ENV_FILE=".env" if [ ! -f "$ENV_FILE" ]; then diff --git a/scripts/Unix/generate-environment-file.sh b/scripts/Unix/generate-environment-file.sh index f6a8f777..fb58e807 100755 --- a/scripts/Unix/generate-environment-file.sh +++ b/scripts/Unix/generate-environment-file.sh @@ -23,7 +23,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" # prompt for a value with default prompt_default() { diff --git a/scripts/Unix/install.sh b/scripts/Unix/install.sh index 0e203a4d..d7d99820 100755 --- a/scripts/Unix/install.sh +++ b/scripts/Unix/install.sh @@ -22,7 +22,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" if [ ! -f .env ]; then printf "\e[33m.env file not found. Exiting without running Docker steps.\e[0m\n" diff --git a/scripts/Unix/reboot.sh b/scripts/Unix/reboot.sh index 1233c395..bc3aeb8a 100755 --- a/scripts/Unix/reboot.sh +++ b/scripts/Unix/reboot.sh @@ -24,7 +24,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" printf "%bStopping services…%b\n" "$CYAN" "$RESET" docker compose down --ansi never diff --git a/scripts/Unix/run.sh b/scripts/Unix/run.sh index e12c5a9f..fe226830 100755 --- a/scripts/Unix/run.sh +++ b/scripts/Unix/run.sh @@ -23,7 +23,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" printf "\e[32mVerifying all images are present…\e[0m\n" diff --git a/scripts/Unix/uninstall.sh b/scripts/Unix/uninstall.sh index d6d0e4fd..389c47e8 100644 --- a/scripts/Unix/uninstall.sh +++ b/scripts/Unix/uninstall.sh @@ -25,7 +25,7 @@ while IFS= read -r line; do printf "%b%s%b\n" "$PURPLE" "$line" "$RESET" done < "$ART_PATH" -printf "\n%bby WISELESS TEAM%b\n\n" "$GRAY" "$RESET" +printf "\n%b by WISELESS TEAM%b\n\n" "$GRAY" "$RESET" printf "%bKilling services…%b\n" "$CYAN" "$RESET" docker compose down --ansi never diff --git a/scripts/Windows/export-environment-file.ps1 b/scripts/Windows/export-environment-file.ps1 index 9d7e7eb1..c05d4a5b 100644 --- a/scripts/Windows/export-environment-file.ps1 +++ b/scripts/Windows/export-environment-file.ps1 @@ -23,7 +23,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray $Spinner = @('|', '/', '-', '\') $Colors = @('White', 'Gray') diff --git a/scripts/Windows/generate-environment-file.ps1 b/scripts/Windows/generate-environment-file.ps1 index e5e5eec2..1cee26b3 100644 --- a/scripts/Windows/generate-environment-file.ps1 +++ b/scripts/Windows/generate-environment-file.ps1 @@ -23,7 +23,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray function Get-RandomHex { diff --git a/scripts/Windows/install.ps1 b/scripts/Windows/install.ps1 index 0c4a56d7..6c7f8fda 100644 --- a/scripts/Windows/install.ps1 +++ b/scripts/Windows/install.ps1 @@ -23,7 +23,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray if (-not (Test-Path '.env')) { diff --git a/scripts/Windows/reboot.ps1 b/scripts/Windows/reboot.ps1 index ecba9e4e..ebe82079 100644 --- a/scripts/Windows/reboot.ps1 +++ b/scripts/Windows/reboot.ps1 @@ -21,7 +21,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray $Spinner = @('|', '/', '-', '\') $Colors = @('White', 'Gray') diff --git a/scripts/Windows/run.ps1 b/scripts/Windows/run.ps1 index 829c870c..0ab8fb35 100644 --- a/scripts/Windows/run.ps1 +++ b/scripts/Windows/run.ps1 @@ -23,7 +23,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray Write-Host "Verifying all images are present…" -ForegroundColor Green diff --git a/scripts/Windows/uninstall.ps1 b/scripts/Windows/uninstall.ps1 index e7c64221..3bf410df 100644 --- a/scripts/Windows/uninstall.ps1 +++ b/scripts/Windows/uninstall.ps1 @@ -23,7 +23,7 @@ $art -split "`r?`n" | ForEach-Object { Write-Host "$purple$_$reset" } -Write-Host "`nby WISELESS TEAM`n" -ForegroundColor Gray +Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray $Spinner = @('|', '/', '-', '\') $Colors = @('White', 'Gray')