Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1cad9b83fb | |||
| 780ee76dc3 | |||
| 4d8e17f59f | |||
| 21c27e22da | |||
| 2e978089b5 | |||
| 803fe7147e | |||
| 6490364a5d | |||
| 2ad773952e | |||
| 138e71107e | |||
| bde399f589 | |||
| 8a43602363 | |||
| 5a56790fd4 | |||
| 892f681174 |
@@ -0,0 +1,10 @@
|
|||||||
|
.git
|
||||||
|
.env
|
||||||
|
node_modules
|
||||||
|
packages
|
||||||
|
vendor
|
||||||
|
tests
|
||||||
|
.DS_Store
|
||||||
|
vapor.yml
|
||||||
|
.vapor
|
||||||
|
storage
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
name: Build and push Docker images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GIT_HUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
id: extract-version
|
||||||
|
run: |
|
||||||
|
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
file: ./docker/Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
investbrainapp/investbrain:latest
|
||||||
|
investbrainapp/investbrain:${{ env.version }}
|
||||||
|
ghcr.io/investbrainapp/investbrain:latest
|
||||||
|
ghcr.io/investbrainapp/investbrain:${{ env.version }}
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ Investbrain is a smart open-source investment tracker that helps you manage, tra
|
|||||||
|
|
||||||
## Under the hood
|
## Under the hood
|
||||||
|
|
||||||
Investbrain is a Laravel PHP web application that leverages Livewire and Tailwind for its frontend. Most databases should work, including MySQL and SQLite. Out of the box, we feature three market data providers: [Yahoo Finance](https://finance.yahoo.com/), [Finnhub](https://finnhub.io/pricing-stock-api-market-data), and [Alpha Vantage](https://www.alphavantage.co/support/). But we also offer an extensible market data provider interface for intrepid developers to create their own! We also offer an integration with OpenAI for our ["chat with your holdings"](#chat-with-your-holdings) capability. Finally, of course we have robust support for i18n, a11y, and dark mode.
|
Investbrain is a Laravel PHP web application that leverages Livewire and Tailwind for its frontend. Most databases should work, including MySQL and SQLite. Out of the box, we feature three market data providers: [Yahoo Finance](https://finance.yahoo.com/), [Finnhub](https://finnhub.io/pricing-stock-api-market-data), and [Alpha Vantage](https://www.alphavantage.co/support/). But we also offer an extensible market data provider interface for intrepid developers to create their own! We also offer integrations with OpenAI and Ollama for our ["chat with your holdings"](#chat-with-your-holdings) capability. Finally, of course we have robust support for i18n, a11y, and dark mode.
|
||||||
|
|
||||||
## Self hosting
|
## Self hosting
|
||||||
|
|
||||||
@@ -109,11 +109,11 @@ Feel free to submit a PR with any custom providers you create.
|
|||||||
|
|
||||||
## Import / Export
|
## Import / Export
|
||||||
|
|
||||||
Investbrain includes a convenient feature which allows you to import and export portfolios and transaction data.
|
Investbrain includes a convenient feature which allows you to maintain the portability of your portfolios and transaction data.
|
||||||
|
|
||||||
### Import
|
### Import
|
||||||
|
|
||||||
Imports are "upserted" to the database. If the record does not already exist in the database, the record will be created. However, when a portfolio or transaction exists (the record's ID matches an existing record), the record will be updated. This way, you can simultaneously create new records, but also bulk update records.
|
Imports are "upserted" to the database. If the record does not already exist in the database, the record will be created. However, when a portfolio or transaction exists (i.e. the record's ID matches an existing record), the record will be updated. This way, you can simultaneously create new records, but also bulk update records.
|
||||||
|
|
||||||
### Export
|
### Export
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
FROM php:8.3-fpm
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
COPY . /var/www/app
|
||||||
|
WORKDIR /var/www/app
|
||||||
|
|
||||||
|
# Set permissions
|
||||||
|
RUN chown -R www-data:www-data . \
|
||||||
|
&& chmod -R 775 ./storage \
|
||||||
|
&& chmod +x ./docker/entrypoint.sh \
|
||||||
|
# Install common php extension dependencies
|
||||||
|
&& apt-get update && apt-get install -y \
|
||||||
|
libfreetype-dev \
|
||||||
|
libjpeg62-turbo-dev \
|
||||||
|
libpng-dev \
|
||||||
|
zlib1g-dev \
|
||||||
|
libzip-dev \
|
||||||
|
unzip \
|
||||||
|
libicu-dev \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
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
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
# Install composer
|
||||||
|
COPY --from=composer:2.6.5 /usr/bin/composer /usr/local/bin/composer
|
||||||
|
|
||||||
|
# Serve on port 80
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Set up healthcheck
|
||||||
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 CMD curl -f http://localhost || exit 1
|
||||||
|
|
||||||
|
# Run everything else
|
||||||
|
ENTRYPOINT ["/bin/bash", "./docker/entrypoint.sh"]
|
||||||
|
CMD ["./docker/entrypoint.sh"]
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
cd /var/www/app
|
cd /var/www/app
|
||||||
|
|
||||||
echo "====================== Running entrypoint script... ====================== "
|
echo -e "\n====================== Running entrypoint script... ====================== "
|
||||||
if [ ! -f ".env" ]; then
|
if [ ! -f ".env" ]; then
|
||||||
echo " > Ope, gotta create an .env file!"
|
echo " > Ope, gotta create an .env file!"
|
||||||
|
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====================== Installing Composer dependencies... ====================== "
|
echo -e "\n====================== Installing Composer dependencies... ====================== "
|
||||||
/usr/local/bin/composer install
|
/usr/local/bin/composer install
|
||||||
|
|
||||||
echo "====================== Validating environment... ====================== "
|
echo -e "\n====================== Validating environment... ====================== "
|
||||||
if [ $(stat -c '%U' .) != "www-data" ]; then
|
if [ $(stat -c '%U' .) != "www-data" ]; then
|
||||||
echo " > Setting correct permissions for pwd..."
|
echo " > Setting correct permissions for pwd..."
|
||||||
chown -R www-data:www-data .
|
chown -R www-data:www-data .
|
||||||
@@ -30,11 +30,11 @@ if [ ! -L "public/storage" ]; then
|
|||||||
/usr/local/bin/php artisan storage:link
|
/usr/local/bin/php artisan storage:link
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "====================== Installing NPM dependencies and building frontend... ====================== "
|
echo -e "\n====================== Installing NPM dependencies and building frontend... ====================== "
|
||||||
/usr/bin/npm install
|
/usr/bin/npm install
|
||||||
/usr/bin/npm run build
|
/usr/bin/npm run build
|
||||||
|
|
||||||
echo "====================== Running migrations... ====================== "
|
echo -e "\n====================== Running migrations... ====================== "
|
||||||
run_migrations() {
|
run_migrations() {
|
||||||
/usr/local/bin/php artisan migrate --force
|
/usr/local/bin/php artisan migrate --force
|
||||||
}
|
}
|
||||||
@@ -43,12 +43,12 @@ DELAY=5
|
|||||||
until run_migrations; do
|
until run_migrations; do
|
||||||
RETRIES=$((RETRIES-1))
|
RETRIES=$((RETRIES-1))
|
||||||
if [ $RETRIES -le 0 ]; then
|
if [ $RETRIES -le 0 ]; then
|
||||||
echo "Database is not ready after multiple attempts. Exiting..."
|
echo " > Database is not ready after multiple attempts. Exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Waiting for database to be ready... retrying in $DELAY seconds."
|
echo " > Waiting for database to be ready... retrying in $DELAY seconds."
|
||||||
sleep $DELAY
|
sleep $DELAY
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "====================== Spinning up Supervisor daemon... ====================== "
|
echo -e "\n====================== Spinning up Supervisor daemon... ====================== "
|
||||||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user