Compare commits

...

6 Commits

Author SHA1 Message Date
hackerESQ 997b5420ee Merge pull request #44 from investbrainapp/create-docker-image
Use the investbrainapp/investbrain docker image
2024-12-17 18:28:03 -06:00
hackerESQ 643bbe3af2 wait for db to be ready in order to migrate 2024-12-16 21:54:59 -06:00
hackerESQ f85f0f19b9 wip 2024-12-16 21:33:45 -06:00
hackerESQ 3f9a1bafa0 Merge pull request #37 from investbrainapp/feat-use-openai-compatible-endpoints
Feat use openai compatible endpoints
2024-12-06 16:10:54 -06:00
hackerESQ 6f72a03ecf fix: specifically use factory import 2024-12-06 16:10:27 -06:00
hackerESQ 5b8e4c634e fix: remove validation which could prevent selfhosting w ollama 2024-12-06 16:09:03 -06:00
9 changed files with 29 additions and 71 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ QUEUE_CONNECTION=redis
CACHE_STORE=redis
REDIS_CLIENT=predis
REDIS_HOST=127.0.0.1
REDIS_HOST=investbrain-redis
REDIS_PATH=/tmp/database_server.sock
REDIS_PASSWORD=null
REDIS_PORT=6379
+12 -3
View File
@@ -3,9 +3,7 @@ networks:
driver: bridge
services:
app:
build:
context: .
dockerfile: docker/Dockerfile
image: investbrainapp/investbrain:latest
container_name: investbrain-app
restart: unless-stopped
tty: true
@@ -15,8 +13,18 @@ services:
- .:/var/www/app:delegated
depends_on:
- mysql
- redis
networks:
- investbrain-network
redis:
image: redis:alpine
container_name: investbrain-redis
restart: unless-stopped
tty: true
networks:
- investbrain-network
volumes:
- investbrain-redis:/data
nginx:
image: nginx:alpine
container_name: investbrain-nginx
@@ -46,4 +54,5 @@ services:
networks:
- investbrain-network
volumes:
investbrain-redis:
investbrain-mysql:
-1
View File
@@ -1 +0,0 @@
dump.rdb
-47
View File
@@ -1,47 +0,0 @@
FROM php:8.3-fpm
ENV DEBIAN_FRONTEND noninteractive
# Set the working directory
COPY . /var/www/app
WORKDIR /var/www/app
# Install common php extension dependencies
RUN apt-get update && apt-get install -y \
libfreetype-dev \
libjpeg62-turbo-dev \
libpng-dev \
zlib1g-dev \
libzip-dev \
unzip \
libicu-dev \
git \
curl \
redis \
supervisor \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gd \
zip \
pdo_mysql \
mysqli \
intl
# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest
# Copy over supervisor configuration
COPY ./docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Update permissions
RUN chown -R www-data:www-data . \
&& chmod -R 775 ./storage \
&& chmod +x ./docker/entrypoint.sh
# install composer
COPY --from=composer:2.6.5 /usr/bin/composer /usr/local/bin/composer
# Run everything else
CMD ["./docker/entrypoint.sh"]
Executable → Regular
+14 -4
View File
@@ -9,9 +9,6 @@ if [ ! -f ".env" ]; then
cp .env.example .env
fi
echo "====================== Checking for updates... ====================== "
/usr/bin/git pull
echo "====================== Installing Composer dependencies... ====================== "
/usr/local/bin/composer install
@@ -38,7 +35,20 @@ echo "====================== Installing NPM dependencies and building frontend..
/usr/bin/npm run build
echo "====================== Running migrations... ====================== "
/usr/local/bin/php artisan migrate --force
run_migrations() {
/usr/local/bin/php artisan migrate --force
}
RETRIES=30
DELAY=5
until run_migrations; do
RETRIES=$((RETRIES-1))
if [ $RETRIES -le 0 ]; then
echo "Database is not ready after multiple attempts. Exiting..."
exit 1
fi
echo "Waiting for database to be ready... retrying in $DELAY seconds."
sleep $DELAY
done
echo "====================== Spinning up Supervisor daemon... ====================== "
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
-2
View File
@@ -1,2 +0,0 @@
# Redis RDB and AOF file location
dir /var/www/app/docker
-7
View File
@@ -11,13 +11,6 @@ autorestart=true
stdout_logfile=/var/log/supervisor/php.log
stderr_logfile=/var/log/supervisor/php_error.log
[program:redis]
command=redis-server /var/www/app/docker/redis.conf
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/redis.log
stderr_logfile=/var/log/supervisor/redis_error.log
[program:scheduler]
command=php artisan schedule:work
autorestart=true
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "investbrain",
"name": "app",
"lockfileVersion": 3,
"requires": true,
"packages": {
@@ -5,7 +5,7 @@ use App\Models\AiChat;
use App\Models\Holding;
use Illuminate\Database\Eloquent\Model;
use Livewire\Volt\Component;
use OpenAI;
use OpenAI\Factory;
use OpenAI\Responses\StreamResponse;
new class extends Component {
@@ -202,10 +202,6 @@ new class extends Component {
$organization = config('openai.organization');
$baseUri = config('openai.base_uri');
if (! is_string($apiKey) || ($organization !== null && ! is_string($organization))) {
throw new \InvalidArgumentException('The OpenAI API Key is missing. Please publish the [openai.php] configuration file and set the [api_key].');
}
return OpenAI::factory()
->withApiKey($apiKey)
->withOrganization($organization)