Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 41 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# WeatherForge Environment Configuration
# Copy this file to .env and update with your actual values

# Docker User/Group Configuration
# Run `id -u` and `id -g` to get your IDs, then update these values
# This prevents permission issues with volume mounts
USER_ID=1000
GROUP_ID=1000

# Rails Configuration
RAILS_ENV=development
RAILS_MASTER_KEY=your_rails_master_key_here

# PostgreSQL Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_USER=weatherforge
DB_PASSWORD=weatherforge_dev_password
DB_NAME=weatherforge_development
DB_NAME_TEST=weatherforge_test
DB_SSL_MODE=disable

# PostgreSQL Docker Configuration
POSTGRES_PASSWORD=weatherforge_dev_password

# Redis Configuration
REDIS_URL=redis://localhost:6379/0

# OpenAQ API Configuration
# Get your API key from: https://openaq.org/
OPENAQ_API_KEY=your_openaq_api_key_here
OPENAQ_BASE_URL=https://api.openaq.org/v3

# Optional: Rate limiting for API calls
OPENAQ_RATE_LIMIT_PER_MINUTE=300

# Optional: Sentry for error tracking (production)
# SENTRY_DSN=your_sentry_dsn_here

# Optional: New Relic for performance monitoring (production)
# NEW_RELIC_LICENSE_KEY=your_new_relic_key_here
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

services:
postgres:
image: postgres:17-alpine
image: postgis/postgis:17-3.5-alpine
env:
POSTGRES_USER: weatherforge
POSTGRES_PASSWORD: postgres
Expand All @@ -104,7 +104,7 @@ jobs:

env:
RAILS_ENV: test
DATABASE_URL: postgresql://weatherforge:postgres@localhost:5432/weatherforge_test
DATABASE_URL: postgis://weatherforge:postgres@localhost:5432/weatherforge_test
REDIS_URL: redis://localhost:6379/0
DB_PASSWORD: ""
DB_HOST: localhost
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
/.bundle
/vendor/bundle

# Ignore all environment files.
# Ignore all environment files (except .env.example).
/.env*
!/.env.example

# Ignore all logfiles and tempfiles.
/log/*
Expand Down
81 changes: 81 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# syntax=docker/dockerfile:1
# Development Dockerfile for WeatherForge
# Optimized for rapid development with volume mounts and hot reloading

ARG RUBY_VERSION=3.4.5
ARG NODE_VERSION=22.12.0

FROM ruby:${RUBY_VERSION}-slim

# Set build args for this stage
ARG NODE_VERSION=22.12.0
ARG USER_ID=1000
ARG GROUP_ID=1000

# Install system dependencies for development
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y \
build-essential \
curl \
git \
libpq-dev \
libvips \
libyaml-dev \
node-gyp \
pkg-config \
postgresql-client \
python-is-python3 \
vim \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Install Node.js for JavaScript bundling
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
rm -rf /tmp/node-build-master

# Set working directory
WORKDIR /rails

# Set development environment
ENV RAILS_ENV=development \
BUNDLE_PATH=/usr/local/bundle \
NODE_ENV=development

# Create non-root user matching host user ID to avoid permission issues
# This will be overridden by docker-compose if USER_ID/GROUP_ID are provided

RUN groupadd --gid ${GROUP_ID} rails || true && \
useradd --uid ${USER_ID} --gid ${GROUP_ID} --create-home --shell /bin/bash rails || true && \
mkdir -p /rails/tmp /rails/log /rails/storage && \
chown -R ${USER_ID}:${GROUP_ID} /rails /usr/local/bundle

# Switch to non-root user
USER ${USER_ID}:${GROUP_ID}

# Install bundler
RUN gem install bundler -v '~> 2.6'

# Copy dependency files first (for layer caching)
COPY --chown=${USER_ID}:${GROUP_ID} Gemfile Gemfile.lock ./

# Install gems with full build tools available
RUN bundle install

# Copy package files
COPY --chown=${USER_ID}:${GROUP_ID} package.json package-lock.json ./

# Install node modules
RUN npm ci

# Copy application code
COPY --chown=${USER_ID}:${GROUP_ID} . .

# Precompile bootsnap for faster boot times
RUN bundle exec bootsnap precompile --gemfile app/ lib/ || true

# Expose port 3000
EXPOSE 3000

# Default command (can be overridden by docker-compose)
CMD ["bin/rails", "server", "-b", "0.0.0.0"]
8 changes: 6 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ source "https://rubygems.org"
gem "rails", "~> 8.1.0"
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 2.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
Expand Down Expand Up @@ -78,9 +76,15 @@ gem "binding_of_caller", "~> 1.0", ">= 1.0.1"
gem "lograge", "~> 0.14.0"
gem "dotenv-rails", "~> 3.2"
gem "rswag", "~> 2.17"
gem "activerecord-postgis-adapter", "~> 11.1", ">= 11.1.1"
gem "rgeo", "~> 3.0", ">= 3.0.1"
gem "rgeo-geojson", "~> 2.2"
gem "geocoder", "~> 1.8", ">= 1.8.6"


gem "rspec-rails", "~> 8.0", ">= 8.0.2", group: [ :development, :test ]
gem "factory_bot_rails", "~> 6.5", ">= 6.5.1", group: [ :development, :test ]
gem "faker", "~> 3.5", ">= 3.5.3", group: [ :development, :test ]
gem "shoulda-matchers", "~> 7.0", group: :test
gem "kaminari", "~> 1.2", ">= 1.2.2"
gem "webmock", "~> 3.26", ">= 3.26.1"
35 changes: 28 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ GEM
activemodel (= 8.1.1)
activesupport (= 8.1.1)
timeout (>= 0.4.0)
activerecord-postgis-adapter (11.1.1)
activerecord (~> 8.1.0)
rgeo-activerecord (~> 8.1.0)
activestorage (8.1.1)
actionpack (= 8.1.1)
activejob (= 8.1.1)
Expand Down Expand Up @@ -101,6 +104,9 @@ GEM
chartkick (5.2.1)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
crack (1.0.1)
bigdecimal
rexml
crass (1.0.6)
csv (3.3.5)
dartsass-rails (0.5.1)
Expand Down Expand Up @@ -138,6 +144,9 @@ GEM
fugit (1.12.1)
et-orbi (~> 1.4)
raabro (~> 1.4)
geocoder (1.8.6)
base64 (>= 0.1.0)
csv (>= 3.0.0)
globalid (1.3.0)
activesupport (>= 6.1)
google-protobuf (4.33.2)
Expand All @@ -155,6 +164,7 @@ GEM
google-protobuf (4.33.2-x86_64-linux-musl)
bigdecimal
rake (>= 13)
hashdiff (1.2.1)
httparty (0.23.2)
csv
mini_mime (>= 1.0.0)
Expand Down Expand Up @@ -225,6 +235,7 @@ GEM
minitest (6.0.0)
prism (~> 1.5)
msgpack (1.8.0)
multi_json (1.19.1)
multi_xml (0.6.0)
net-imap (0.6.2)
date
Expand Down Expand Up @@ -333,6 +344,14 @@ GEM
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
rexml (3.4.4)
rgeo (3.0.1)
rgeo-activerecord (8.1.0)
activerecord (>= 8.1, < 8.2)
rgeo (>= 3.0)
rgeo-geojson (2.2.0)
multi_json (~> 1.15)
rgeo (>= 1.0.0)
rouge (4.6.1)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
Expand Down Expand Up @@ -443,12 +462,6 @@ GEM
fugit (~> 1.11)
railties (>= 7.1)
thor (>= 1.3.1)
sqlite3 (2.8.1-aarch64-linux-gnu)
sqlite3 (2.8.1-aarch64-linux-musl)
sqlite3 (2.8.1-arm-linux-gnu)
sqlite3 (2.8.1-arm-linux-musl)
sqlite3 (2.8.1-x86_64-linux-gnu)
sqlite3 (2.8.1-x86_64-linux-musl)
sshkit (1.25.0)
base64
logger
Expand Down Expand Up @@ -480,6 +493,10 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.26.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
Expand All @@ -497,6 +514,7 @@ PLATFORMS
x86_64-linux-musl

DEPENDENCIES
activerecord-postgis-adapter (~> 11.1, >= 11.1.1)
better_errors (~> 2.10, >= 2.10.1)
binding_of_caller (~> 1.0, >= 1.0.1)
bootsnap
Expand All @@ -509,6 +527,7 @@ DEPENDENCIES
dotenv-rails (~> 3.2)
factory_bot_rails (~> 6.5, >= 6.5.1)
faker (~> 3.5, >= 3.5.3)
geocoder (~> 1.8, >= 1.8.6)
httparty (~> 0.23.2)
image_processing (~> 1.2)
jbuilder
Expand All @@ -521,6 +540,8 @@ DEPENDENCIES
puma (>= 5.0)
rails (~> 8.1.0)
redis (~> 5.4, >= 5.4.1)
rgeo (~> 3.0, >= 3.0.1)
rgeo-geojson (~> 2.2)
rspec-rails (~> 8.0, >= 8.0.2)
rswag (~> 2.17)
rubocop (~> 1.82, >= 1.82.1)
Expand All @@ -533,12 +554,12 @@ DEPENDENCIES
solid_cable
solid_cache
solid_queue
sqlite3 (>= 2.1)
stimulus-rails
thruster
turbo-rails
tzinfo-data
web-console
webmock (~> 3.26, >= 3.26.1)

BUNDLED WITH
2.7.2
Loading
Loading