From 13e30787a215ced224a765089a1e947db23dbc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Rodr=C3=ADguez?= Date: Fri, 2 Jan 2026 11:48:37 +0100 Subject: [PATCH 1/6] Investbrain scripts --- ct/investbrain.sh | 117 ++++++++++++++ frontend/public/json/investbrain.json | 58 +++++++ install/investbrain-install.sh | 213 ++++++++++++++++++++++++++ 3 files changed, 388 insertions(+) create mode 100644 ct/investbrain.sh create mode 100644 frontend/public/json/investbrain.json create mode 100644 install/investbrain-install.sh diff --git a/ct/investbrain.sh b/ct/investbrain.sh new file mode 100644 index 000000000..957ab6a2c --- /dev/null +++ b/ct/investbrain.sh @@ -0,0 +1,117 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Benito Rodríguez (b3ni) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/investbrainapp/investbrain + +APP="Investbrain" +var_tags="${var_tags:-finance;portfolio;investing}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-4}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/investbrain ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + PG_VERSION="17" setup_postgresql + + if check_for_gh_release "investbrain" "investbrainapp/investbrain"; then + msg_info "Stopping Services" + systemctl stop nginx + systemctl stop php8.4-fpm + supervisorctl stop all + msg_ok "Services Stopped" + + msg_info "Creating Backup" + rm -f /opt/.env.backup + rm -rf /opt/storage.backup + cp /opt/investbrain/.env /opt/.env.backup + cp -r /opt/investbrain/storage /opt/storage.backup + msg_ok "Created Backup" + + RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + msg_info "Updating Investbrain to $RELEASE" + rm -rf /opt/investbrain-new + mkdir -p /opt/investbrain-new + curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/investbrain-new + + cd /opt/investbrain + cp -r /opt/investbrain-new/* /opt/investbrain/ + rm -rf /opt/investbrain/storage + rm -rf /opt/investbrain-new + + cp /opt/.env.backup /opt/investbrain/.env + cp -r /opt/storage.backup/ /opt/investbrain/storage + + chown -R www-data:www-data /opt/investbrain + chmod -R 775 /opt/investbrain/storage + mkdir -p /opt/investbrain/storage/framework/cache/data + mkdir -p /opt/investbrain/storage/framework/sessions + mkdir -p /opt/investbrain/storage/framework/views + mkdir -p /opt/investbrain/storage/logs + mkdir -p /opt/investbrain/bootstrap/cache + chown -R www-data:www-data /opt/investbrain/{storage,bootstrap/cache} + + PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php + setup_composer + + export COMPOSER_ALLOW_SUPERUSER=1 + $STD composer install --no-interaction --no-dev --optimize-autoloader + + $STD npm install + $STD npm run build + + $STD php artisan storage:link + $STD php artisan migrate --force + + $STD php artisan cache:clear + $STD php artisan view:clear + $STD php artisan route:clear + $STD php artisan event:clear + $STD php artisan route:cache + $STD php artisan event:cache + + chown -R www-data:www-data /opt/investbrain + chmod -R 755 /opt/investbrain/storage /opt/investbrain/bootstrap/cache + echo "${RELEASE}" >/root/.investbrain + + rm -rf /opt/.env.backup /opt/storage.backup + msg_ok "Updated Investbrain" + + msg_info "Starting Services" + systemctl start php8.4-fpm + systemctl start nginx + supervisorctl start all + msg_ok "Services Started" + + msg_ok "Updated Successfully!" + else + msg_ok "No update available" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8000${CL}" diff --git a/frontend/public/json/investbrain.json b/frontend/public/json/investbrain.json new file mode 100644 index 000000000..445562ed0 --- /dev/null +++ b/frontend/public/json/investbrain.json @@ -0,0 +1,58 @@ +{ + "name": "Investbrain", + "slug": "investbrain", + "categories": [23], + "date_created": "2025-12-26", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8000, + "documentation": "https://github.com/investbrainapp/investbrain", + "website": "https://investbra.in", + "logo": "https://raw.githubusercontent.com/investbrainapp/investbrain/main/investbrain-logo.png", + "config_path": "/opt/investbrain/.env", + "description": "Investbrain is a smart open-source investment tracker that helps you manage, track, and make informed decisions about your investments.", + "install_methods": [ + { + "type": "default", + "script": "ct/investbrain.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Access the UI via http://:8000/register to create the first user.", + "type": "info" + }, + { + "text": "Default market data provider is Yahoo Finance. Configure others in `.env` with `MARKET_DATA_PROVIDER=yahoo,alphavantage`", + "type": "info" + }, + { + "text": "Refresh market data: `cd /opt/investbrain && php artisan refresh:market-data`", + "type": "info" + }, + { + "text": "Enable AI chat by setting `AI_CHAT_ENABLED=true` and `OPENAI_API_KEY` in `.env`", + "type": "info" + }, + { + "text": "View logs: `ls /opt/investbrain/storage/logs/` (daily rotation: laravel-YYYY-MM-DD.log)", + "type": "info" + }, + { + "text": "Database credentials: `cat ~/investbrain.creds`", + "type": "info" + } + ] +} diff --git a/install/investbrain-install.sh b/install/investbrain-install.sh new file mode 100644 index 000000000..7fc57d345 --- /dev/null +++ b/install/investbrain-install.sh @@ -0,0 +1,213 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Benito Rodríguez (b3ni) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/investbrainapp/investbrain + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get update && apt-get install -y \ + nginx \ + supervisor \ + redis-server \ + libfreetype-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + zlib1g-dev \ + libzip-dev \ + libicu-dev \ + libpq-dev +msg_ok "Installed Dependencies" + +PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php +setup_composer +NODE_VERSION="22" setup_nodejs +PG_VERSION="17" setup_postgresql +PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db + +msg_info "Setting up Investbrain" +RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +mkdir -p /opt/investbrain +cd /opt/investbrain +curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 +LOCAL_IP=$(hostname -I | awk '{print $1}') +APP_KEY=$(openssl rand -base64 32) + +cat </opt/investbrain/.env +APP_KEY=base64:${APP_KEY} +APP_PORT=8000 +APP_URL=http://${LOCAL_IP}:8000 +ASSET_URL=http://${LOCAL_IP}:8000 + +LOG_CHANNEL=daily +LOG_LEVEL=warning + +REGISTRATION_ENABLED=true + +AI_CHAT_ENABLED=false +OPENAI_API_KEY= +OPENAI_ORGANIZATION= + +MARKET_DATA_PROVIDER=yahoo +ALPHAVANTAGE_API_KEY= +FINNHUB_API_KEY= +ALPACA_API_KEY= +ALPACA_API_SECRET= +TWELVEDATA_API_SECRET= + +MARKET_DATA_REFRESH=30 +DAILY_CHANGE_TIME= + +DB_CONNECTION=pgsql +DB_HOST=127.0.0.1 +DB_PORT=5432 +DB_DATABASE=${PG_DB_NAME} +DB_USERNAME=${PG_DB_USER} +DB_PASSWORD=${PG_DB_PASS} + +REDIS_CLIENT=phpredis +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +CACHE_STORE=redis +CACHE_PREFIX= + +SESSION_DRIVER=redis +SESSION_LIFETIME=120 + +QUEUE_CONNECTION=redis + +MAIL_MAILER=log +MAIL_HOST=127.0.0.1 +MAIL_PORT=2525 +MAIL_FROM_ADDRESS="investbrain@${LOCAL_IP}" + +VITE_APP_NAME=Investbrain +EOF + +msg_ok "Setup Investbrain" + +msg_info "Installing Investbrain (Patience)" +export COMPOSER_ALLOW_SUPERUSER=1 +$STD composer install --no-interaction --no-dev --optimize-autoloader +$STD npm install +$STD npm run build +msg_ok "Installed Investbrain" + +msg_info "Setting up Storage" +mkdir -p /opt/investbrain/storage/framework/cache +mkdir -p /opt/investbrain/storage/framework/sessions +mkdir -p /opt/investbrain/storage/framework/views +mkdir -p /opt/investbrain/storage/app +mkdir -p /opt/investbrain/storage/logs +chmod -R 775 /opt/investbrain/storage +chown -R www-data:www-data /opt/investbrain/storage +msg_ok "Setup Storage" + +msg_info "Running Migrations" +$STD php artisan migrate --force +$STD php artisan storage:link +msg_ok "Ran Migrations" + +msg_info "Clearing and Caching" +$STD php artisan cache:clear +$STD php artisan view:clear +$STD php artisan route:clear +$STD php artisan event:clear +$STD php artisan route:cache +chown -R www-data:www-data /opt/investbrain +chmod -R 755 /opt/investbrain/bootstrap/cache +echo "${RELEASE}" >/opt/investbrain_version.txt +msg_ok "Cleared and Cached" + +msg_info "Configuring Nginx" +PHPVER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "\n";') +cat </etc/nginx/sites-available/investbrain.conf +server { + listen 8000 default_server; + listen [::]:8000 default_server; + server_name _; + + root /opt/investbrain/public; + index index.php; + + client_max_body_size 50M; + charset utf-8; + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + location / { + try_files \$uri \$uri/ /index.php?\$query_string; + } + + location ~ \.php\$ { + fastcgi_pass unix:/var/run/php/php${PHPVER}-fpm.sock; + fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name; + include fastcgi_params; + fastcgi_hide_header X-Powered-By; + fastcgi_read_timeout 300; + } + + location ~ /\.(?!well-known).* { + deny all; + } + + error_log /var/log/nginx/investbrain_error.log; + access_log /var/log/nginx/investbrain_access.log; +} +EOF + +ln -sf /etc/nginx/sites-available/investbrain.conf /etc/nginx/sites-enabled/ +rm -f /etc/nginx/sites-enabled/default +$STD systemctl reload nginx +msg_ok "Configured Nginx" + +msg_info "Setting up Supervisor" +cat </etc/supervisor/conf.d/investbrain.conf +[program:investbrain-queue] +process_name=%%(program_name)s_%%(process_num)02d +command=php /opt/investbrain/artisan queue:work --sleep=3 --tries=1 --memory=256 --timeout=3600 +user=www-data +autostart=true +autorestart=true +redirect_stderr=true +stdout_logfile=/opt/investbrain/storage/logs/queue.log +stdout_logfile_maxbytes=50MB +stdout_logfile_backups=10 +numprocs=1 +EOF + +$STD supervisorctl reread +$STD supervisorctl update +$STD supervisorctl start all +msg_ok "Setup Supervisor" + +msg_info "Setting up Cron for Scheduler" +cat </etc/cron.d/investbrain-scheduler +* * * * * www-data php /opt/investbrain/artisan schedule:run >> /dev/null 2>&1 +EOF +chmod 644 /etc/cron.d/investbrain-scheduler +$STD systemctl restart cron +msg_ok "Setup Cron for Scheduler" + +{ + echo "" + echo "Investbrain Database Credentials" + echo "Database Name: ${PG_DB_NAME}" + echo "Database User: ${PG_DB_USER}" + echo "Database Password: ${PG_DB_PASS}" +} >>~/investbrain.creds + +motd_ssh +customize +cleanup_lxc From 8c5b7b4adef5feffcc4c5e2ea0795e6beafdc0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Rodr=C3=ADguez?= Date: Fri, 2 Jan 2026 18:48:25 +0100 Subject: [PATCH 2/6] Refactor Investbrain installation and update script to use fetch_and_deploy_gh_release function --- ct/investbrain.sh | 8 +++----- install/investbrain-install.sh | 7 ++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ct/investbrain.sh b/ct/investbrain.sh index 957ab6a2c..8ca359314 100644 --- a/ct/investbrain.sh +++ b/ct/investbrain.sh @@ -31,7 +31,7 @@ function update_script() { PG_VERSION="17" setup_postgresql - if check_for_gh_release "investbrain" "investbrainapp/investbrain"; then + if check_for_gh_release "Investbrain" "investbrainapp/investbrain"; then msg_info "Stopping Services" systemctl stop nginx systemctl stop php8.4-fpm @@ -45,11 +45,10 @@ function update_script() { cp -r /opt/investbrain/storage /opt/storage.backup msg_ok "Created Backup" - RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - msg_info "Updating Investbrain to $RELEASE" + msg_info "Updating Investbrain" rm -rf /opt/investbrain-new mkdir -p /opt/investbrain-new - curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 -C /opt/investbrain-new + fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain-new" cd /opt/investbrain cp -r /opt/investbrain-new/* /opt/investbrain/ @@ -89,7 +88,6 @@ function update_script() { chown -R www-data:www-data /opt/investbrain chmod -R 755 /opt/investbrain/storage /opt/investbrain/bootstrap/cache - echo "${RELEASE}" >/root/.investbrain rm -rf /opt/.env.backup /opt/storage.backup msg_ok "Updated Investbrain" diff --git a/install/investbrain-install.sh b/install/investbrain-install.sh index 7fc57d345..8c5dc356f 100644 --- a/install/investbrain-install.sh +++ b/install/investbrain-install.sh @@ -33,11 +33,9 @@ NODE_VERSION="22" setup_nodejs PG_VERSION="17" setup_postgresql PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db -msg_info "Setting up Investbrain" -RELEASE=$(curl -fsSL https://api.github.com/repos/investbrainapp/investbrain/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +msg_info "Installing Investbrain" mkdir -p /opt/investbrain -cd /opt/investbrain -curl -fsSL "https://github.com/investbrainapp/investbrain/archive/refs/tags/v${RELEASE}.tar.gz" | tar -xz --strip-components=1 +fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain" LOCAL_IP=$(hostname -I | awk '{print $1}') APP_KEY=$(openssl rand -base64 32) @@ -126,7 +124,6 @@ $STD php artisan event:clear $STD php artisan route:cache chown -R www-data:www-data /opt/investbrain chmod -R 755 /opt/investbrain/bootstrap/cache -echo "${RELEASE}" >/opt/investbrain_version.txt msg_ok "Cleared and Cached" msg_info "Configuring Nginx" From 61b0ecf7028170b21fbca76cd241b0704959ddcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Rodr=C3=ADguez?= Date: Mon, 5 Jan 2026 17:20:25 +0100 Subject: [PATCH 3/6] Update Investbrain installation script and improve backup management --- ct/investbrain.sh | 45 +++++-------- frontend/public/json/investbrain.json | 92 +++++++++++---------------- install/investbrain-install.sh | 42 ++---------- 3 files changed, 59 insertions(+), 120 deletions(-) diff --git a/ct/investbrain.sh b/ct/investbrain.sh index 8ca359314..6e3c55c59 100644 --- a/ct/investbrain.sh +++ b/ct/investbrain.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 community-scripts ORG # Author: Benito Rodríguez (b3ni) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -29,56 +29,44 @@ function update_script() { exit fi - PG_VERSION="17" setup_postgresql - if check_for_gh_release "Investbrain" "investbrainapp/investbrain"; then msg_info "Stopping Services" - systemctl stop nginx - systemctl stop php8.4-fpm + systemctl stop nginx php8.4-fpm supervisorctl stop all msg_ok "Services Stopped" + PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php + setup_composer + NODE_VERSION="22" setup_nodejs + PG_VERSION="17" setup_postgresql + msg_info "Creating Backup" rm -f /opt/.env.backup - rm -rf /opt/storage.backup + rm -rf /opt/investbrain_backup cp /opt/investbrain/.env /opt/.env.backup - cp -r /opt/investbrain/storage /opt/storage.backup + cp -r /opt/investbrain/storage /opt/investbrain_backup msg_ok "Created Backup" - msg_info "Updating Investbrain" rm -rf /opt/investbrain-new mkdir -p /opt/investbrain-new fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain-new" + msg_info "Updating Investbrain" cd /opt/investbrain cp -r /opt/investbrain-new/* /opt/investbrain/ rm -rf /opt/investbrain/storage rm -rf /opt/investbrain-new cp /opt/.env.backup /opt/investbrain/.env - cp -r /opt/storage.backup/ /opt/investbrain/storage - - chown -R www-data:www-data /opt/investbrain - chmod -R 775 /opt/investbrain/storage - mkdir -p /opt/investbrain/storage/framework/cache/data - mkdir -p /opt/investbrain/storage/framework/sessions - mkdir -p /opt/investbrain/storage/framework/views - mkdir -p /opt/investbrain/storage/logs - mkdir -p /opt/investbrain/bootstrap/cache - chown -R www-data:www-data /opt/investbrain/{storage,bootstrap/cache} - - PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php - setup_composer + cp -r /opt/investbrain_backup/ /opt/investbrain/storage + mkdir -p /opt/investbrain/storage/{framework/cache,framework/sessions,framework/views,app,logs} export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-interaction --no-dev --optimize-autoloader - $STD npm install $STD npm run build - $STD php artisan storage:link $STD php artisan migrate --force - $STD php artisan cache:clear $STD php artisan view:clear $STD php artisan route:clear @@ -87,20 +75,17 @@ function update_script() { $STD php artisan event:cache chown -R www-data:www-data /opt/investbrain - chmod -R 755 /opt/investbrain/storage /opt/investbrain/bootstrap/cache + chmod -R 775 /opt/investbrain/storage /opt/investbrain/bootstrap/cache - rm -rf /opt/.env.backup /opt/storage.backup + rm -rf /opt/.env.backup /opt/investbrain_backup msg_ok "Updated Investbrain" msg_info "Starting Services" - systemctl start php8.4-fpm - systemctl start nginx + systemctl start php8.4-fpm nginx supervisorctl start all msg_ok "Services Started" msg_ok "Updated Successfully!" - else - msg_ok "No update available" fi exit } diff --git a/frontend/public/json/investbrain.json b/frontend/public/json/investbrain.json index 445562ed0..19c50e9c6 100644 --- a/frontend/public/json/investbrain.json +++ b/frontend/public/json/investbrain.json @@ -1,58 +1,40 @@ { - "name": "Investbrain", - "slug": "investbrain", - "categories": [23], - "date_created": "2025-12-26", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 8000, - "documentation": "https://github.com/investbrainapp/investbrain", - "website": "https://investbra.in", - "logo": "https://raw.githubusercontent.com/investbrainapp/investbrain/main/investbrain-logo.png", - "config_path": "/opt/investbrain/.env", - "description": "Investbrain is a smart open-source investment tracker that helps you manage, track, and make informed decisions about your investments.", - "install_methods": [ - { - "type": "default", - "script": "ct/investbrain.sh", - "resources": { - "cpu": 2, - "ram": 2048, - "hdd": 4, - "os": "debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [ - { - "text": "Access the UI via http://:8000/register to create the first user.", - "type": "info" + "name": "Investbrain", + "slug": "investbrain", + "categories": [ + 23 + ], + "date_created": "2025-12-26", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8000, + "documentation": "https://github.com/investbrainapp/investbrain", + "website": "https://investbra.in", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/investbrain.webp", + "config_path": "/opt/investbrain/.env", + "description": "Investbrain is a smart open-source investment tracker that helps you manage, track, and make informed decisions about your investments.", + "install_methods": [ + { + "type": "default", + "script": "ct/investbrain.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 4, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null }, - { - "text": "Default market data provider is Yahoo Finance. Configure others in `.env` with `MARKET_DATA_PROVIDER=yahoo,alphavantage`", - "type": "info" - }, - { - "text": "Refresh market data: `cd /opt/investbrain && php artisan refresh:market-data`", - "type": "info" - }, - { - "text": "Enable AI chat by setting `AI_CHAT_ENABLED=true` and `OPENAI_API_KEY` in `.env`", - "type": "info" - }, - { - "text": "View logs: `ls /opt/investbrain/storage/logs/` (daily rotation: laravel-YYYY-MM-DD.log)", - "type": "info" - }, - { - "text": "Database credentials: `cat ~/investbrain.creds`", - "type": "info" - } - ] + "notes": [ + { + "text": "Database credentials: `cat ~/investbrain.creds`", + "type": "info" + } + ] } diff --git a/install/investbrain-install.sh b/install/investbrain-install.sh index 8c5dc356f..05dee6c1c 100644 --- a/install/investbrain-install.sh +++ b/install/investbrain-install.sh @@ -33,12 +33,13 @@ NODE_VERSION="22" setup_nodejs PG_VERSION="17" setup_postgresql PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db -msg_info "Installing Investbrain" mkdir -p /opt/investbrain fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain" LOCAL_IP=$(hostname -I | awk '{print $1}') APP_KEY=$(openssl rand -base64 32) +msg_info "Installing Investbrain (Patience)" +cd /opt/investbrain cat </opt/investbrain/.env APP_KEY=base64:${APP_KEY} APP_PORT=8000 @@ -91,43 +92,24 @@ MAIL_FROM_ADDRESS="investbrain@${LOCAL_IP}" VITE_APP_NAME=Investbrain EOF - -msg_ok "Setup Investbrain" - -msg_info "Installing Investbrain (Patience)" export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-interaction --no-dev --optimize-autoloader $STD npm install $STD npm run build -msg_ok "Installed Investbrain" - -msg_info "Setting up Storage" -mkdir -p /opt/investbrain/storage/framework/cache -mkdir -p /opt/investbrain/storage/framework/sessions -mkdir -p /opt/investbrain/storage/framework/views -mkdir -p /opt/investbrain/storage/app -mkdir -p /opt/investbrain/storage/logs -chmod -R 775 /opt/investbrain/storage -chown -R www-data:www-data /opt/investbrain/storage -msg_ok "Setup Storage" - -msg_info "Running Migrations" +mkdir -p /opt/investbrain/storage/{framework/cache,framework/sessions,framework/views,app,logs} $STD php artisan migrate --force $STD php artisan storage:link -msg_ok "Ran Migrations" - -msg_info "Clearing and Caching" $STD php artisan cache:clear $STD php artisan view:clear $STD php artisan route:clear $STD php artisan event:clear $STD php artisan route:cache +$STD php artisan event:cache chown -R www-data:www-data /opt/investbrain -chmod -R 755 /opt/investbrain/bootstrap/cache -msg_ok "Cleared and Cached" +chmod -R 775 /opt/investbrain/bootstrap/cache +msg_ok "Installed Investbrain" msg_info "Configuring Nginx" -PHPVER=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION . "\n";') cat </etc/nginx/sites-available/investbrain.conf server { listen 8000 default_server; @@ -148,7 +130,7 @@ server { } location ~ \.php\$ { - fastcgi_pass unix:/var/run/php/php${PHPVER}-fpm.sock; + fastcgi_pass unix:/var/run/php/php${PHP_VERSION}-fpm.sock; fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name; include fastcgi_params; fastcgi_hide_header X-Powered-By; @@ -163,7 +145,6 @@ server { access_log /var/log/nginx/investbrain_access.log; } EOF - ln -sf /etc/nginx/sites-available/investbrain.conf /etc/nginx/sites-enabled/ rm -f /etc/nginx/sites-enabled/default $STD systemctl reload nginx @@ -183,7 +164,6 @@ stdout_logfile_maxbytes=50MB stdout_logfile_backups=10 numprocs=1 EOF - $STD supervisorctl reread $STD supervisorctl update $STD supervisorctl start all @@ -197,14 +177,6 @@ chmod 644 /etc/cron.d/investbrain-scheduler $STD systemctl restart cron msg_ok "Setup Cron for Scheduler" -{ - echo "" - echo "Investbrain Database Credentials" - echo "Database Name: ${PG_DB_NAME}" - echo "Database User: ${PG_DB_USER}" - echo "Database Password: ${PG_DB_PASS}" -} >>~/investbrain.creds - motd_ssh customize cleanup_lxc From 8c8978892320f24143a424194e0cdc8c2e54754e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benito=20Rodr=C3=ADguez?= Date: Mon, 5 Jan 2026 18:19:46 +0100 Subject: [PATCH 4/6] Update Investbrain installation script --- ct/investbrain.sh | 11 +---------- install/investbrain-install.sh | 7 +++---- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ct/investbrain.sh b/ct/investbrain.sh index 6e3c55c59..08aa4f382 100644 --- a/ct/investbrain.sh +++ b/ct/investbrain.sh @@ -47,20 +47,13 @@ function update_script() { cp -r /opt/investbrain/storage /opt/investbrain_backup msg_ok "Created Backup" - rm -rf /opt/investbrain-new - mkdir -p /opt/investbrain-new - fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain-new" + fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain" msg_info "Updating Investbrain" cd /opt/investbrain - cp -r /opt/investbrain-new/* /opt/investbrain/ rm -rf /opt/investbrain/storage - rm -rf /opt/investbrain-new - cp /opt/.env.backup /opt/investbrain/.env cp -r /opt/investbrain_backup/ /opt/investbrain/storage - mkdir -p /opt/investbrain/storage/{framework/cache,framework/sessions,framework/views,app,logs} - export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-interaction --no-dev --optimize-autoloader $STD npm install @@ -73,10 +66,8 @@ function update_script() { $STD php artisan event:clear $STD php artisan route:cache $STD php artisan event:cache - chown -R www-data:www-data /opt/investbrain chmod -R 775 /opt/investbrain/storage /opt/investbrain/bootstrap/cache - rm -rf /opt/.env.backup /opt/investbrain_backup msg_ok "Updated Investbrain" diff --git a/install/investbrain-install.sh b/install/investbrain-install.sh index 05dee6c1c..cfc80c3e0 100644 --- a/install/investbrain-install.sh +++ b/install/investbrain-install.sh @@ -14,7 +14,7 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get update && apt-get install -y \ +$STD apt install -y \ nginx \ supervisor \ redis-server \ @@ -33,12 +33,11 @@ NODE_VERSION="22" setup_nodejs PG_VERSION="17" setup_postgresql PG_DB_NAME="investbrain" PG_DB_USER="investbrain" setup_postgresql_db -mkdir -p /opt/investbrain fetch_and_deploy_gh_release "Investbrain" "investbrainapp/investbrain" "tarball" "latest" "/opt/investbrain" -LOCAL_IP=$(hostname -I | awk '{print $1}') -APP_KEY=$(openssl rand -base64 32) +import_local_ip msg_info "Installing Investbrain (Patience)" +APP_KEY=$(openssl rand -base64 32) cd /opt/investbrain cat </opt/investbrain/.env APP_KEY=base64:${APP_KEY} From a690b701fb3a092b174a0ffc192d04580bf79ff9 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 5 Jan 2026 19:31:48 +0100 Subject: [PATCH 5/6] refactor --- ct/investbrain.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ct/investbrain.sh b/ct/investbrain.sh index 08aa4f382..ec4cdb0a3 100644 --- a/ct/investbrain.sh +++ b/ct/investbrain.sh @@ -11,7 +11,7 @@ var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" -var_version="${var_version:-12}" +var_version="${var_version:-13}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" @@ -30,12 +30,13 @@ function update_script() { fi if check_for_gh_release "Investbrain" "investbrainapp/investbrain"; then + PHP_VERSION="8.4" msg_info "Stopping Services" - systemctl stop nginx php8.4-fpm + systemctl stop nginx php${PHP_VERSION}-fpm supervisorctl stop all msg_ok "Services Stopped" - PHP_VERSION="8.4" PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php + PHP_FPM=YES PHP_MODULE="gd,zip,intl,pdo,pgsql,pdo-pgsql,bcmath,opcache,mbstring,redis" setup_php setup_composer NODE_VERSION="22" setup_nodejs PG_VERSION="17" setup_postgresql @@ -72,7 +73,7 @@ function update_script() { msg_ok "Updated Investbrain" msg_info "Starting Services" - systemctl start php8.4-fpm nginx + systemctl start php${PHP_VERSION}-fpm nginx supervisorctl start all msg_ok "Services Started" From a56d6449d905de5dda9e556d42c91e2ee3399c89 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Mon, 5 Jan 2026 19:32:04 +0100 Subject: [PATCH 6/6] Update investbrain.json --- frontend/public/json/investbrain.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/public/json/investbrain.json b/frontend/public/json/investbrain.json index 19c50e9c6..7ed3fbccc 100644 --- a/frontend/public/json/investbrain.json +++ b/frontend/public/json/investbrain.json @@ -23,7 +23,7 @@ "ram": 2048, "hdd": 4, "os": "debian", - "version": "12" + "version": "13" } } ],