Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d9fcf1c
add UPGRADE_PLAN.md
elg0nz May 20, 2025
fa0e9b2
WIP
elg0nz May 21, 2025
fef836a
I've updated Ruby to 3.2.8 and Rails to 8.0.2.
google-labs-jules[bot] Jun 13, 2025
58a3f51
add dockerfile & docker-compose
elg0nz Jun 13, 2025
c27f4b3
Merge remote-tracking branch 'origin/update-ruby-rails' into ruby-and…
elg0nz Jun 13, 2025
3a22196
I've added a GitHub Actions workflow for CI.
google-labs-jules[bot] Jun 15, 2025
a2da4bd
Fix: Explicitly require StripeEventHelper in initializer
google-labs-jules[bot] Jun 15, 2025
d95787d
Fix: Remove protected_attributes_continued gem
google-labs-jules[bot] Jun 15, 2025
6cfbc38
Feat: Add Dockerized .devcontainer setup with Docker Compose
google-labs-jules[bot] Jun 15, 2025
29bbf09
wip
elg0nz Jun 15, 2025
804be41
Merge branch 'ruby-and-rails-upgrade' into update-ruby-rails
elg0nz Jun 15, 2025
e0f8a49
fix gemfile
elg0nz Jun 16, 2025
52c6760
fix ci
elg0nz Jun 17, 2025
55fdc93
fix RAILS_ENV
elg0nz Jun 17, 2025
9609d55
Fix observer dep
elg0nz Jun 17, 2025
228ddd6
update brakeman
elg0nz Jun 19, 2025
98a6849
updating rubocop and standard
elg0nz Jun 19, 2025
2bf4a79
fix the CI healthcheck
elg0nz Jun 19, 2025
8d2b935
add .devcontainer
elg0nz Jun 19, 2025
a058671
Apply standardrb auto-corrections
elg0nz Jun 19, 2025
ba104a4
fix(lint): Resolve all standardrb offenses
elg0nz Jun 19, 2025
f02508c
chore(ci): Remove redundant ruby-ci.yml workflow
elg0nz Jun 19, 2025
537683c
update sass gems
elg0nz Jun 19, 2025
69d39bd
fix ci.yml
elg0nz Jul 20, 2025
6fbf746
update app_record and other items
elg0nz Jul 21, 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
1 change: 1 addition & 0 deletions .devcontainer/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Placeholder to ensure the .devcontainer directory is created.
58 changes: 58 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Use an official Ruby image as a parent image
FROM ruby:3.2.8-bullseye

# Set environment variables
ENV LANG C.UTF-8
ENV RAILS_ENV development
ENV RACK_ENV development
ENV PORT 3000

# Install system dependencies
# - build-essential: For compiling native extensions
# - libpq-dev: For the pg gem (PostgreSQL client library)
# - nodejs, yarn: For JavaScript runtime and package management (if needed by Rails asset pipeline)
# - postgresql-client: For psql command-line utility
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
nodejs \
yarn \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

# Create a non-root user
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
# Add user to sudoers with no password (optional, for convenience)
&& apt-get update && apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*

# Set up work directory
WORKDIR /workspace

# Copy Gemfile and Gemfile.lock
COPY Gemfile Gemfile.lock ./

# Install gems for the non-root user to avoid permission issues with host mounts
# Ensure bundle path is writable by the user
USER $USERNAME
RUN mkdir -p /home/$USERNAME/.bundle \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME/.bundle \
&& bundle install --jobs $(nproc) --retry 3

# Copy the rest of the application code
USER root
COPY . .
RUN chown -R $USERNAME:$USERNAME /workspace

# Switch back to non-root user
USER $USERNAME

# Expose port 3000 and set the default command
EXPOSE 3000
CMD ["bin/rails", "server", "-b", "0.0.0.0"]
48 changes: 48 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "Arooo Dockerized Dev",
"dockerComposeFile": [
"../docker-compose.yml"
],
"service": "app",
"runServices": ["app", "db"],
"workspaceFolder": "/app",
// Features like node and postgres client are now handled by the Dockerfile for the 'app' service.
// We can keep common-utils if desired for the general container experience, or remove if not needed.
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"configureZshAsDefaultShell": "true",
"installOhMyZsh": "true"
}
},
"customizations": {
"vscode": {
"extensions": [
"Shopify.ruby-lsp",
"Shopify.rubocop-lsp",
"rebornix.Ruby",
"castwide.solargraph",
"KoichiSasada.vscode-rdbg",
"ms-azuretools.vscode-docker",
"GitHub.codespaces",
"GitHub.vscode-pull-request-github",
"standard.vscode-standard"
],
"settings": {
// Since rbenv/rvm are not explicitly installed in the Dockerfile (it uses system ruby),
// 'none' is appropriate. If a version manager were added to Dockerfile, this might change.
"rubyLsp.rubyVersionManager": "none",
"editor.formatOnSave": true
}
}
},
// Ports are now forwarded by docker-compose.yml, but listing the primary app port here is good for Codespaces UI.
"forwardPorts": [3000],
// The Dockerfile and docker-compose setup should handle gem installation and user setup.
// postCreateCommand might still be useful for other setup, or could be removed/simplified.
// For example, ensuring the database is created if it's the first time.
"postCreateCommand": "cp -n config/database.example.yml config/database.yml && cp -n config/application.example.yml config/application.yml && bundle check || bundle install && bundle exec rails db:prepare",
// The user is defined in the Dockerfile and docker-compose.yml for the app service.
// Ensure this matches if not 'vscode', or remove if service user is different and correctly set.
"remoteUser": "vscode"
}
33 changes: 33 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'
services:
app:
build:
context: . # Use the Dockerfile in the .devcontainer directory
dockerfile: Dockerfile
volumes:
- ..:/workspace:cached # Mount the project root (one level up) to /workspace in the container
ports:
- "3000:3000" # Map port 3000 on the host to port 3000 in the container
depends_on:
- db
environment:
- DATABASE_URL=postgres://arooo_user:arooo_password@db:5432/arooo_development
- RAILS_ENV=development
- RACK_ENV=development
# Add any other necessary environment variables for the app service here
# e.g., GITHUB_CLIENT_KEY, GITHUB_CLIENT_SECRET, etc.
# These would ideally be sourced from a .env file or user secrets in Codespaces

db:
image: postgres:15 # Or your preferred PostgreSQL version
volumes:
- postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data
environment:
- POSTGRES_USER=arooo_user
- POSTGRES_PASSWORD=arooo_password
- POSTGRES_DB=arooo_development
ports:
- "5432:5432" # Optionally map PostgreSQL port to host (for external tools)

volumes:
postgres_data: # Defines the named volume for data persistence
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ name: Ruby CI
on:
push:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'
pull_request:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'

jobs:
rspec:
name: rspec
runs-on: ubuntu-latest

services:
Expand All @@ -29,14 +30,15 @@ jobs:
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
options: --health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4.3'
bundler-cache: true

- name: Bundle install
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ruby_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: standardrb lint
on:
push:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'
pull_request:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
Expand All @@ -22,11 +22,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4.3'
bundler-cache: true

- name: lint
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: brakeman
on:
push:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
- 'bin/*'
pull_request:
branches:
- main
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
Expand All @@ -22,11 +22,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4.3'
bundler-cache: true

- name: brakeman
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.7
3.4.3
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.4.3
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,46 @@ $ bundle exec rake spec
1. `bundle exec rails server` don't forget to use http://localhost:3000 and not https
1. `bundle exec rails console` Optional - useful for looking at and changing your local data)

### Development Container Setup (Recommended for VS Code Users)

This project supports [VS Code Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers), which provides a fully configured development environment, including all necessary tools, extensions, and a running PostgreSQL database. This is the recommended way to get started if you use VS Code.

**Prerequisites:**

* [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running.
* [Visual Studio Code](https://code.visualstudio.com/) installed.
* The [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed in VS Code.

**Getting Started:**

1. **Clone the Repository:** If you haven't already, clone this repository to your local machine.
```bash
git clone <your-fork-url>
cd arooo
```
2. **Open in Dev Container:**
* Open the cloned `arooo` directory in VS Code.
* VS Code should automatically detect the `.devcontainer/devcontainer.json` file and show a notification in the bottom-right corner asking if you want to "Reopen in Container." Click it.
* Alternatively, open the Command Palette (Cmd+Shift+P or Ctrl+Shift+P), type "Dev Containers: Reopen in Container", and select it.
3. **First-Time Setup:** The first time you open the project in the dev container, it will build the Docker image and set up the environment. This might take a few minutes. The `postCreateCommand` defined in `devcontainer.json` will automatically:
* Copy `config/database.example.yml` to `config/database.yml` (if it doesn't exist).
* Copy `config/application.example.yml` to `config/application.yml` (if it doesn't exist).
* Run `bundle install` to install all gem dependencies.
* Run `bundle exec rails db:prepare` to set up your development database.
4. **Start the Rails Server:** Once the container is ready and VS Code is connected, open a new terminal within VS Code (Terminal > New Terminal). This terminal is inside the dev container. Then, start the Rails server:
```bash
bundle exec rails s -p 3000 -b '0.0.0.0'
```
5. **Access the Application:** Open your web browser and navigate to [http://localhost:3000](http://localhost:3000).
6. **OAuth Setup (Manual Step):** For features requiring GitHub or Google OAuth (like login), you'll still need to manually:
* Create OAuth applications on GitHub and Google as described in the "[Set up an application for local OAuth](#set-up-an-application-for-local-oauth)" section below.
* Add your `CLIENT_ID` and `CLIENT_SECRET` to the `config/application.yml` file inside the dev container. (Remember, this file is created from `application.example.yml` if it didn't exist).
* Restart the Rails server after updating `config/application.yml`.

This setup provides a consistent environment matching the project's requirements, with Ruby, PostgreSQL, and necessary VS Code extensions pre-configured.

---

### Docker setup (optional)

1. Install docker and docker compose
Expand Down
37 changes: 31 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
FROM ruby:2.7.1-slim
FROM ruby:3.4.3-slim

# Install essential packages, PostgreSQL client, and a JavaScript runtime
RUN apt-get update -qq && \
apt-get install -y build-essential curl cmake git libpq-dev tzdata
apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
libpq-dev \
nodejs \
npm \
tzdata && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN mkdir /app
# Set the working directory in the container
WORKDIR /app

RUN gem install bundler -v 2.0.1
# Copy Gemfile and Gemfile.lock to leverage Docker cache
COPY Gemfile Gemfile.lock .ruby-version ./

# Install Bundler. Use a version compatible with your Gemfile.lock (e.g., if BUNDLED WITH is 2.6.9, this covers it)
RUN gem install bundler -v '~> 2.6' --conservative --minimal-deps

# Configure Bundler to install gems to /usr/local/bundle (shared volume via docker-compose)
ENV BUNDLE_PATH /usr/local/bundle

# Install gems
RUN bundle install --jobs $(nproc) --retry 3

# Copy the rest of the application code into the container
COPY . .

# Expose the port Rails runs on
EXPOSE 3000

# Default command to start the application (can be overridden)
CMD ["bash"]
Loading