Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Docker Image #52

Merged
merged 59 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
16d5b80
wip
hackeresq Jan 26, 2025
cf7c5fc
wip
hackeresq Jan 26, 2025
dc69bfa
make php extensions required
hackeresq Jan 26, 2025
bc34519
wip
hackeresq Jan 26, 2025
e0b5610
wip
hackeresq Jan 26, 2025
4f5894e
wip
hackeresq Jan 26, 2025
9a3e030
wip
hackeresq Jan 26, 2025
ec15e2b
wip
hackeresq Jan 26, 2025
7571636
wip
hackeresq Jan 26, 2025
b1fcf51
wip
hackeresq Jan 26, 2025
e93459a
wip
hackeresq Jan 26, 2025
1189325
wip
hackeresq Jan 26, 2025
8da153a
wip
hackeresq Jan 26, 2025
4bbb71d
wip
hackeresq Jan 26, 2025
7bacc28
wip
hackeresq Jan 26, 2025
11cdf97
wip
hackeresq Jan 26, 2025
6d92b49
wip
hackeresq Jan 26, 2025
a31f807
wip
hackeresq Jan 26, 2025
1684f3e
wip
hackeresq Jan 26, 2025
fa25a82
wip
hackeresq Jan 26, 2025
92bdf14
wip
hackeresq Jan 26, 2025
801d373
wip
hackeresq Jan 26, 2025
4120b1a
set permission in entry script
hackeresq Jan 26, 2025
575fecb
wip
hackeresq Jan 26, 2025
7245f4c
wip
hackeresq Jan 26, 2025
6205664
wip
hackeresq Jan 26, 2025
00067c5
wip
hackeresq Jan 26, 2025
5ade4b3
wip
hackeresq Jan 26, 2025
25112cb
wip
hackeresq Jan 26, 2025
0c7d4a8
wip
hackeresq Jan 26, 2025
390b137
wiiiip
hackeresq Jan 26, 2025
c19f13e
wip
hackeresq Jan 26, 2025
6f2324a
wip
hackeresq Jan 26, 2025
416a820
getting close
hackeresq Jan 26, 2025
d463ec6
last one
hackeresq Jan 26, 2025
84171da
bump php version
hackeresq Jan 26, 2025
e651eb8
bump front end
hackeresq Jan 26, 2025
6d5a5f4
update readme for new install instructions
hackeresq Jan 26, 2025
c6642e0
updat example env
hackeresq Jan 26, 2025
e8ec94b
add in-line docs to env
hackeresq Jan 26, 2025
05174e9
wip
hackeresq Jan 26, 2025
ec20194
ensure storage is there
hackeresq Jan 26, 2025
51c43e9
make sure key is set
hackeresq Jan 26, 2025
b27edd9
wip
hackeresq Jan 26, 2025
395eb31
wip
hackeresq Jan 27, 2025
1201c24
cleanup
hackeresq Jan 27, 2025
497efcf
wip
hackeresq Jan 27, 2025
46707c1
wip
hackeresq Jan 27, 2025
a0e9cfb
wip
hackeresq Jan 27, 2025
72a8aac
wip
hackeresq Jan 27, 2025
b71e9e2
make info messages pop
hackeresq Jan 27, 2025
b3ca2e5
wip
hackeresq Jan 27, 2025
99749bd
this is it
hackeresq Jan 27, 2025
60577d0
wip
hackeresq Jan 27, 2025
cff3c02
wip
hackeresq Jan 27, 2025
64c84fe
wip
hackeresq Jan 27, 2025
118232e
update readme
hackeresq Jan 27, 2025
47cd1b6
wip
hackeresq Jan 27, 2025
778d799
cleanup
hackeresq Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ tests
.DS_Store
vapor.yml
.vapor
storage
storage/app/livewire-tmp/*
storage/app/public/profile-photos/*
storage/framework/cache/*
storage/framework/sessions/*
storage/framework/testing/*
storage/framework/views/*
storage/framework/logs/*
33 changes: 24 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
APP_NAME=Investbrain
APP_ENV=production
# Generate a secure key using `openssl rand -base64 32`
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC

# Port for NGINX to listen on
APP_PORT=8000

# Used internally to generate absolute links
APP_URL="http://localhost:${APP_PORT}"
SELF_HOSTED=true
REGISTRATION_ENABLED=true

# ASSET_URL="http://localhost:8000" # (optional) webroot for static assets (css, js, images, etc)
# Webroot for static assets (css, js, images, etc)
ASSET_URL="${APP_URL}"

# Enables or disables new user registration
REGISTRATION_ENABLED=true

# Enable or disable AI chat feature
AI_CHAT_ENABLED=false

# API key for OpenAI (for Llama support, see docs)
OPENAI_API_KEY=
OPENAI_ORGANIZATION=

# Market data provider to use (comma separated list)
MARKET_DATA_PROVIDER=yahoo
MARKET_DATA_REFRESH=30
ALPHAVANTAGE_API_KEY=
FINNHUB_API_KEY=

# Cadence to refresh market data (in minutes)
MARKET_DATA_REFRESH=30
DAILY_CHANGE_TIME=

#### Advanced configurations ####
ENABLED_LOGIN_PROVIDERS=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
Expand All @@ -29,9 +40,13 @@ LINKEDIN_CLIENT_SECRET=
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=

APP_NAME=Investbrain
APP_TIMEZONE=UTC
APP_ENV=production
APP_DEBUG=true
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
SELF_HOSTED=true

DB_CONNECTION=mysql
DB_HOST=investbrain-mysql
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ Investbrain is a Laravel PHP web application that leverages Livewire and Tailwin

## Self hosting

For ease of installation, we _highly recommend_ installing Investbrain using the provided [Docker Compose](https://github.com/investbrainapp/investbrain/blob/main/docker-compose.yml) file, which downloads all the necessary dependencies and seamlessly builds everything you need to get started quickly!
For ease of installation, we _highly recommend_ installing Investbrain using the provided [Docker Compose](https://github.com/investbrainapp/investbrain/blob/main/docker-compose.yml) file, which uses the official Investbrain Docker image and includes all the necessary dependencies to seamlessly build everything you need to get started quickly!

Before getting started, you should already have the following installed on your machine: [Docker Engine](https://docs.docker.com/engine/install/), [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), and a wild sense of adventure.
Before getting started, you should already have [Docker Engine](https://docs.docker.com/engine/install/) installed on your machine.

Ready? Let's get started!

First, you can clone this repository:
**1. Copy Docker Compose file**

```bash
git clone https://github.com/investbrainapp/investbrain.git && cd investbrain
```
Grab a copy of the [docker-compose.yml](https://github.com/investbrainapp/investbrain/blob/main/docker-compose.yml)** file and paste the contents into the directory where you plan to install Investbrain.

Then, build the Docker image and bring up the container (this will take a few minutes):
**2. Set your environment**

```bash
docker compose up
```
Adjust the `environment` properties in the Docker Compose file to your preferences.

_Particularly_, you need to set the `APP_KEY` value to a complex random value. If you're unsure, you can run `openssl rand -base64 32` from your terminal to generate a strong application key.

> Tip: Want to know what options are available? You can reference the [.env.example](https://github.com/investbrainapp/investbrain/blob/main/.env.example) file in this respository for available environment configurations.

In the previous step, all of the default configurations are set automatically. This includes creating a .env file and setting the required Laravel `APP_KEY`.
**3. Run `docker compose up`**

If everything worked as expected, you should now be able to access Investbrain in the browser at. You should create an account by visiting:
This might take a few minutes. But if everything worked as expected, you should now be able to access Investbrain in the browser by visiting:

```bash
http://localhost:8000/register
Expand Down Expand Up @@ -135,6 +135,7 @@ There are several optional configurations available when installing using the re
| ------------- | ------------- | ------------- |
| APP_URL | The URL where your Investbrain installation will be accessible | http://localhost |
| APP_PORT | The HTTP port exposed by the NGINX container | 8000 |
| APP_KEY | Must be set during install - encryption key for various security-related functions | `null` |
| MARKET_DATA_PROVIDER | The market data provider to use (either `yahoo`, `alphavantage`, or `finnhub`) | yahoo |
| ALPHAVANTAGE_API_KEY | If using the Alpha Vantage provider | `null` |
| FINNHUB_API_KEY | If using the Finnhub provider | `null` |
Expand All @@ -149,7 +150,7 @@ There are several optional configurations available when installing using the re
| REGISTRATION_ENABLED | Whether to enable registration of new users | `true` |


> Note: These options affect the [docker-compose.yml](https://github.com/investbrainapp/investbrain/blob/main/docker-compose.yml) file, so if you decide to make any changes to these default configurations, you'll have to restart the Docker containers before your changes take effect.
> Note: These options affect the [docker-compose.yml](https://github.com/investbrainapp/investbrain/blob/main/docker-compose.yml) file and are cached during run-time. If change any .env values, you'll have to restart the containers before your changes take effect.

## Updating

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"keywords": ["stocks", "dividends", "investments", "tracking"],
"license": "CC-BY-NC 4.0",
"require": {
"php": "^8.2",
"php": "^8.3",
"ext-gd": "*",
"ext-mbstring": "*",
"ext-zip": "*",
"finnhub/client": "master@dev",
"laravel/framework": "^11.35",
"laravel/jetstream": "^5.1",
Expand Down
Loading