-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '361-improve-installation-script' into 'main'
Resolve "Improve installation script" Closes #361 See merge request reportcreator/reportcreator!621
- Loading branch information
Showing
18 changed files
with
432 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Do not modify. This file is automatically generated. | ||
# Changes will be overwritten. | ||
services: | ||
caddy: | ||
image: caddy:latest | ||
container_name: 'sysreptor-caddy' | ||
restart: unless-stopped | ||
volumes: | ||
- ./Caddyfile:/etc/caddy/Caddyfile | ||
- type: volume | ||
source: sysreptor-caddy-data | ||
target: /data | ||
network_mode: "host" | ||
|
||
volumes: | ||
sysreptor-caddy-data: | ||
name: sysreptor-caddy-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#!/bin/bash | ||
cd `dirname "$BASH_SOURCE"` | ||
if | ||
test -f Caddyfile | ||
then | ||
echo "Caddyfile exists. Skipping web server setup." | ||
read -p "Press any key to continue installation..." | ||
echo "" | ||
cd - >/dev/null | ||
return 2>/dev/null || exit -1 # return if script is source, exit if in process | ||
fi | ||
while [[ "$SYSREPTOR_WEBSERVER" != [yY] && "$SYSREPTOR_WEBSERVER" != [nN] ]] | ||
do | ||
echo "" | ||
echo "SysReptor runs on localhost (127.0.0.1) by default." | ||
read -p "Should we setup a webserver (Caddy in Docker) for you to expose it to your local network or the Internet? [y/n]: " SYSREPTOR_WEBSERVER | ||
if [[ "$SYSREPTOR_WEBSERVER" == [yY] ]] | ||
then | ||
while [[ "$SYSREPTOR_LETSENCRYPT" != [yY] && "$SYSREPTOR_LETSENCRYPT" != [nN] ]] | ||
do | ||
echo "" | ||
echo "Should we take care of your webserver HTTPS certificate using LetsEncrypt?" | ||
echo "For this, you must set up:" | ||
echo " 1. a valid domain name resolving to your public IP address" | ||
echo " 2. port 80 of your must be publicly reachable" | ||
read -p "Want a LetsEncrypt webserver certificate? [y/n]: " SYSREPTOR_LETSENCRYPT | ||
done | ||
while ! case "$SYSREPTOR_CADDY_PORT" in ''|*[!0-9]*) false;;esac; | ||
do | ||
if [[ "$SYSREPTOR_LETSENCRYPT" == [yY] ]] | ||
then | ||
default_port=443 | ||
else | ||
default_port=80 | ||
fi | ||
read -p "What port should the webserver use? [$default_port] " SYSREPTOR_CADDY_PORT | ||
SYSREPTOR_CADDY_PORT=${SYSREPTOR_CADDY_PORT:-$default_port} | ||
if [[ "$SYSREPTOR_CADDY_PORT" -lt 1 || "$SYSREPTOR_CADDY_PORT" -gt 65535 ]] | ||
then | ||
echo "Invalid port number. Please enter a valid port number between 1 and 65535." | ||
SYSREPTOR_CADDY_PORT="" | ||
elif [[ "$SYSREPTOR_CADDY_PORT" -eq 8000 ]] | ||
then | ||
echo "The Django app uses port 8000 on 127.0.0.1. Please use a different port." | ||
SYSREPTOR_CADDY_PORT="" | ||
fi | ||
done | ||
if [[ "$SYSREPTOR_LETSENCRYPT" == [yY] ]] | ||
then | ||
while [ -z "$SYSREPTOR_CADDY_FQDN" ] | ||
do | ||
read -p "What is your publicly reachable fully qualified domain name (e.g., sysreptor.example.com)? " SYSREPTOR_CADDY_FQDN | ||
done | ||
fi | ||
fi | ||
done | ||
if [[ "$SYSREPTOR_WEBSERVER" == [nN] ]] | ||
then | ||
echo "Okay. Won't set up a webserver." | ||
else | ||
# Create config | ||
echo """# Do not modify. This file is automatically generated. | ||
# Changes will be overwritten. | ||
$SYSREPTOR_CADDY_FQDN:$SYSREPTOR_CADDY_PORT | ||
reverse_proxy http://127.0.0.1:8000""" > Caddyfile | ||
echo "Setting up your web server..." | ||
|
||
docker_compose_file="../docker-compose.yml" | ||
include_caddy=" - caddy/docker-compose.yml" | ||
if ! grep -q "^$include_caddy" "$docker_compose_file" | ||
then | ||
# Include Caddy in docker-compose.yml | ||
sed -i "s#include:#include:\n$include_caddy#" "$docker_compose_file" | ||
fi | ||
fi | ||
docker container stop sysreptor-caddy 1>/dev/null 2>&1 && docker container rm sysreptor-caddy 1>/dev/null 2>&1 || true | ||
echo "" | ||
cd - >/dev/null | ||
return 2>/dev/null || true # return if script is source | ||
|
||
cd `dirname "$BASH_SOURCE"` | ||
cd .. | ||
docker compose up -d | ||
cd - >/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,5 @@ | ||
name: sysreptor | ||
|
||
services: | ||
app: | ||
environment: | ||
SPELLCHECK_URL: http://languagetool:8010/ | ||
depends_on: | ||
languagetool: | ||
condition: service_started | ||
languagetool: | ||
build: | ||
context: ../languagetool | ||
args: | ||
CA_CERTIFICATES: ${SYSREPTOR_CA_CERTIFICATES-} | ||
container_name: 'sysreptor-languagetool' | ||
init: true | ||
environment: | ||
languagetool_dbHost: db | ||
languagetool_dbName: reportcreator | ||
languagetool_dbUsername: reportcreator | ||
languagetool_dbPassword: reportcreator | ||
HTTP_PROXY: ${HTTP_PROXY-} | ||
HTTPS_PROXY: ${HTTPS_PROXY-} | ||
expose: | ||
- 8010 | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "-so", "/dev/null", "http://localhost:8010/v2/languages"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 5 | ||
start_period: 10s | ||
restart: unless-stopped | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
# This file is included due to legacy reasons | ||
# It makes sure that Docker starts the languagetool container for Pro customers | ||
# We will delete this file in July 2025 | ||
include: | ||
- languagetool/docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,4 @@ | ||
# Do not modify. This file is automatically generated. | ||
# Changes will be overwritten. | ||
name: sysreptor | ||
|
||
services: | ||
db: | ||
image: 'postgres:14' | ||
container_name: 'sysreptor-db' | ||
environment: | ||
POSTGRES_USER: reportcreator | ||
POSTGRES_PASSWORD: reportcreator | ||
POSTGRES_DB: reportcreator | ||
PGDATA: /data | ||
volumes: | ||
- type: volume | ||
source: db-data | ||
target: /data | ||
expose: | ||
- 5432 | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U reportcreator"] | ||
interval: 2s | ||
timeout: 5s | ||
retries: 30 | ||
restart: unless-stopped | ||
stop_grace_period: 120s | ||
redis: | ||
image: bitnami/redis:7.2 | ||
environment: | ||
REDIS_PASSWORD: reportcreator | ||
expose: | ||
- 6379 | ||
restart: unless-stopped | ||
app: | ||
build: | ||
context: ../ | ||
target: api | ||
args: | ||
VERSION: ${SYSREPTOR_VERSION} | ||
CA_CERTIFICATES: ${SYSREPTOR_CA_CERTIFICATES-} | ||
container_name: 'sysreptor-app' | ||
init: true | ||
volumes: | ||
- type: volume | ||
source: app-data | ||
target: /data | ||
expose: | ||
- 8000 | ||
ports: | ||
- ${BIND_PORT:-127.0.0.1:8000:8000} | ||
environment: | ||
DATABASE_HOST: db | ||
DATABASE_NAME: reportcreator | ||
DATABASE_USER: reportcreator | ||
DATABASE_PASSWORD: reportcreator | ||
REDIS_URL: redis://:reportcreator@redis:6379/0 | ||
HTTP_PROXY: ${HTTP_PROXY-} | ||
HTTPS_PROXY: ${HTTPS_PROXY-} | ||
env_file: app.env | ||
restart: unless-stopped | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/healthcheck/"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 5 | ||
start_period: 10s | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
redis: | ||
condition: service_started | ||
|
||
|
||
volumes: | ||
db-data: | ||
name: sysreptor-db-data | ||
external: true | ||
app-data: | ||
name: sysreptor-app-data | ||
external: true | ||
include: | ||
- sysreptor/docker-compose.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Do not modify. This file is automatically generated. | ||
# Changes will be overwritten. | ||
services: | ||
languagetool: | ||
build: | ||
context: ../../languagetool | ||
args: | ||
CA_CERTIFICATES: ${SYSREPTOR_CA_CERTIFICATES-} | ||
container_name: 'sysreptor-languagetool' | ||
init: true | ||
environment: | ||
languagetool_dbHost: db | ||
languagetool_dbName: reportcreator | ||
languagetool_dbUsername: reportcreator | ||
languagetool_dbPassword: reportcreator | ||
HTTP_PROXY: ${HTTP_PROXY-} | ||
HTTPS_PROXY: ${HTTPS_PROXY-} | ||
expose: | ||
- 8010 | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "-so", "/dev/null", "http://localhost:8010/v2/languages"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 5 | ||
start_period: 10s | ||
restart: unless-stopped | ||
depends_on: | ||
db: | ||
condition: service_healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Do not modify. This file is automatically generated. | ||
# Changes will be overwritten. | ||
name: sysreptor | ||
|
||
services: | ||
db: | ||
image: 'postgres:14' | ||
container_name: 'sysreptor-db' | ||
environment: | ||
POSTGRES_USER: reportcreator | ||
POSTGRES_PASSWORD: reportcreator | ||
POSTGRES_DB: reportcreator | ||
PGDATA: /data | ||
volumes: | ||
- type: volume | ||
source: db-data | ||
target: /data | ||
expose: | ||
- 5432 | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U reportcreator"] | ||
interval: 2s | ||
timeout: 5s | ||
retries: 30 | ||
restart: unless-stopped | ||
stop_grace_period: 120s | ||
redis: | ||
image: bitnami/redis:7.2 | ||
container_name: 'sysreptor-redis' | ||
environment: | ||
REDIS_PASSWORD: reportcreator | ||
expose: | ||
- 6379 | ||
restart: unless-stopped | ||
app: | ||
build: | ||
context: ../.. | ||
target: api | ||
args: | ||
VERSION: ${SYSREPTOR_VERSION} | ||
CA_CERTIFICATES: ${SYSREPTOR_CA_CERTIFICATES-} | ||
SPELLCHECK_URL: ${SYSREPTOR_SPELLCHECK_URL:-http://languagetool:8010/} | ||
container_name: 'sysreptor-app' | ||
init: true | ||
volumes: | ||
- type: volume | ||
source: app-data | ||
target: /data | ||
expose: | ||
- 8000 | ||
ports: | ||
- ${BIND_PORT:-127.0.0.1:8000:8000} | ||
environment: | ||
DATABASE_HOST: db | ||
DATABASE_NAME: reportcreator | ||
DATABASE_USER: reportcreator | ||
DATABASE_PASSWORD: reportcreator | ||
REDIS_URL: redis://:reportcreator@redis:6379/0 | ||
HTTP_PROXY: ${HTTP_PROXY-} | ||
HTTPS_PROXY: ${HTTPS_PROXY-} | ||
env_file: ../app.env | ||
restart: unless-stopped | ||
healthcheck: | ||
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/utils/healthcheck/"] | ||
interval: 30s | ||
timeout: 30s | ||
retries: 5 | ||
start_period: 10s | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
|
||
|
||
volumes: | ||
db-data: | ||
name: sysreptor-db-data | ||
external: true | ||
app-data: | ||
name: sysreptor-app-data | ||
external: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.