Skip to content

Commit

Permalink
feat: Resolves maybe-finance#306; Add Windows compatibility and Docke…
Browse files Browse the repository at this point in the history
…r setup Upgraded README.md file

Added support for Windows system by including different versions of dependencies in Gemfile. Also introduced Docker setup to the project via a docker-compose file for easy setup and environment consistency. Files for Windows-specific development workflow and a Docker setup guide were also added to the README. Lastly, a .gitignore update included to ignore files from JetBrains products and Docker's PostgreSQL volume data.
  • Loading branch information
yeskiy committed Feb 5, 2024
1 parent 97789bc commit d4fddf1
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 19 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@

/app/assets/builds/*
!/app/assets/builds/.keep


# Ignore .idea files for folks using JetBrains products
.idea


# Ignore pgdata for for folks using Docker version of PostgreSQL
pgdata
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ GEM
racc (~> 1.4)
nokogiri (1.16.0-x86_64-linux)
racc (~> 1.4)
nokogiri (1.16.0-x64-mingw-ucrt)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
Expand Down Expand Up @@ -339,12 +341,16 @@ GEM
railties (>= 6.0.0)
tailwindcss-rails (2.3.0-x86_64-linux)
railties (>= 6.0.0)
tailwindcss-rails (2.3.0-x64-mingw-ucrt)
railties (>= 6.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2024.1)
tzinfo (>= 1.0.0)
unicode-display_width (2.5.0)
useragent (0.16.10)
web-console (4.2.1)
Expand All @@ -368,6 +374,7 @@ PLATFORMS
x86-linux
x86_64-darwin
x86_64-linux
x64-mingw-ucrt

DEPENDENCIES
bcrypt (~> 3.1.7)
Expand Down
2 changes: 2 additions & 0 deletions Procfile.windows.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: rails server
css: rails tailwindcss:watch
88 changes: 69 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ _If you're looking for the previous React codebase, you can find it at [maybe-fi

We spent the better part of 2021/2022 building a personal finance + wealth management app called, Maybe. Very full-featured, including an "Ask an Advisor" feature which connected users with an actual CFP/CFA to help them with their finances (all included in your subscription).

The business end of things didn't work out, and so we shut things down mid-2023.
The business end of things didn't work out, and so we shut things down in mid-2023.

We spent the better part of $1,000,000 building the app (employees + contractors, data providers/services, infrastructure, etc.).

Expand All @@ -24,46 +24,96 @@ As we started digging into the changes that would be required to get the app ful

We're now building the app in Ruby on Rails. We realize that's a controversial choice, but we believe it's the right one for the project. Rails is a mature, stable, and well-documented framework that's been around for over 20 years built on a language that's been around for over 30 years.

From the start our focus with this is to make it as easy as possible for you to both contribute to and deploy the app, and this move to Rails is a big part of that.
From the start, our focus with this is to make it as easy as possible for you to both contribute to and deploy the app, and this move to Rails is a big part of that.

## Codebase

The codebase is vanilla [Rails](https://rubyonrails.org/) and [Postgres](https://www.postgresql.org/). Quite a simple setup.

## Setup
# Getting Started
## Requirements
## Devcontainer
This project supports devcontainer, so the only requirement is [Docker](https://www.docker.com) and [VSCode](https://code.visualstudio.com/) or any other editor that supports devcontainer and Ruby.
> **Note:** If you're using VSCode, you need to install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
You'll need:
> **Note:** If you're using Windows, you need to have **[WSL2](https://learn.microsoft.com/en-us/windows/wsl/)** installed and running on your machine to use Docker (since devcontainer uses Docker to run the app). **[Here](https://docs.microsoft.com/en-us/windows/wsl/install)** is the official documentation to install **[WSL2](https://learn.microsoft.com/en-us/windows/wsl/)**.
- ruby >3 (specific version is in `Gemfile`)
- postgresql (if using stock `config/database.yml`)
### Linux
- Ruby `>3` (a specific version is in `Gemfile`)
- Postgresql `>9.3` (if using stock `config/database.yml`)
- Docker *(optional)*

If you prefer devcontainer, this project supports it (entirely optional).
### Windows
- Ruby+Devkit `>3` (a specific version is in `Gemfile`) (You can use **[RubyInstaller](https://rubyinstaller.org/downloads/)** or **[Chocolatey](https://chocolatey.org/packages/ruby)** (*devkit is not included in the Choco installer*) )
- Postgresql `>9.3` (if using stock `config/database.yml`) (You can use **[Postgresql Official Download page](https://www.postgresql.org/download/windows/)** or **[Chocolatey](https://chocolatey.org/packages/postgresql)**)
- Docker *(optional)* (You can use **[Docker Desktop](https://www.docker.com/products/docker-desktop)**)

> **Note:** If you want to skip the installation of Postgresql, you can use [docker-compose.yaml](docker-compose.yaml) to run a Postgresql container.
Run the following commands after cloning the repo:

## Setup
Run the following commands after cloning the repo:
### Dependencies setup
```shell
cd maybe
cp .env.example .env
bundle install
rails db:setup
bin/dev
```

And visit [http://localhost:3000](http://localhost:3000)
### Database setup
> **Note:** It will create the database, run the migrations, and seed the database. Please make sure you have Postgresql installed and running.
>
> If you want to use the docker-compose file, you can run `docker compose up -d` to start the Postgresql container.
```shell
rails db:setup
```

### Email
### Env setup
```shell
cp .env.example .env
```

### Email Setup (Optional)
In development, we use `letter_opener` to automatically open emails in your browser. However, if you self-host, you'll likely want some basic email sending abilities.

You can use any SMTP-based mail service and then simply drop in your SMTP credentials in the `.env` file.
You can use any SMTP-based mail service and then drop in your SMTP credentials in the `.env` file.

[Resend](https://resend.com) or [Brevo (formerly SendInBlue)](https://www.brevo.com/) is a great option for personal use as they have a very generous free plan.

# Running the app
## Quickly start the app with:
```shell
bin/dev
```
And visit [http://localhost:3000](http://localhost:3000)

## Project commands
### Server
```shell
rails s
```
### TailwindCSS watcher
```shell
rails tailwindcss:watch
```

[Resend](https://resend.com) is a great option for personal use as they have a very generous free plan.
### Database setup
```shell
rails db:setup
```

### Run tests
```shell
rails test
```
or
```shell
rake test
```

## Contributing
# Contributing

Before contributing, you'll likely find it helpful to [understand context and general vision/direction](https://github.com/maybe-finance/maybe/wiki).

It's still very early days for this so your mileage will vary here and lots of things will break.
It is still very early days for this, so your mileage will vary here and lots of things will break.

But almost any contribution will be beneficial at this point. Check the [current Issues](https://github.com/maybe-finance/maybe/issues) to see where you can jump in!

Expand All @@ -81,6 +131,6 @@ If you've got feature ideas, simply [open a new issue](https://github.com/maybe-

![Repo Activity](https://repobeats.axiom.co/api/embed/7866c9790deba0baf63ca1688b209130b306ea4e.svg "Repobeats analytics image")

## Copyright & license
# Copyright & license

Maybe is distributed under an [AGPLv3 license](https://github.com/maybe-finance/maybe/blob/main/LICENSE). "Maybe" is a trademark of Maybe Finance, Inc.
18 changes: 18 additions & 0 deletions bin/dev.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if ((gem list foreman -i) -ne "true")
{
Write-Host "Installing foreman..."
gem install foreman
}

# Default to port 3000 if not specified
if ($env:PORT -eq $null)
{
$env:PORT = "3000"
}

# Let the debug gem allow remote connections,
# but avoid loading until `debugger` is called
$env:RUBY_DEBUG_OPEN = "true"
$env:RUBY_DEBUG_LAZY = "true"

foreman start -f Procfile.windows.dev $args
19 changes: 19 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.9'
services:
postgres:
image: postgres:16-alpine
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- "5432:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data

redis:
image: redis:7.2-alpine
restart: always
ports:
- "6379:6379"

0 comments on commit d4fddf1

Please sign in to comment.