Skip to content

Commit 60ea7dd

Browse files
Hello world
First open source release of Campfire 🎉
0 parents  commit 60ea7dd

File tree

669 files changed

+36158
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

669 files changed

+36158
-0
lines changed

.dockerignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2+
3+
# Ignore git directory.
4+
/.git/
5+
/.git*
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore all environment files.
11+
/.env*
12+
!/.env.example
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore pidfiles, but keep the directory.
21+
/tmp/pids/*
22+
!/tmp/pids/
23+
!/tmp/pids/.keep
24+
25+
# Ignore storage (uploaded files in development and any SQLite databases).
26+
/storage/*
27+
!/storage/
28+
!/storage/.keep
29+
30+
# Ignore development credentials
31+
/config/credentials.yml.enc
32+
33+
# Ignore deployment files
34+
/config/deploy*.yml
35+
/bin/deploy
36+
/bin/deploy-*
37+
/bin/release
38+
39+
# Ignore master.key (should be set in environment)
40+
/config/master.key
41+
42+
# Ignore editor noise
43+
/.vscode
44+
45+
# Ignore ignore
46+
.dockerignore
47+
48+
# Ignore test files
49+
/test/

.env.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<% if (session_token = `op signin --account basecamp --raw`.strip) != "" %># Generated by mrsk envify
2+
MRSK_REGISTRY_PASSWORD=<%= `op read "op://Deploy/Docker Hub MRSK/password" -n --session #{session_token}` %>
3+
RAILS_MASTER_KEY=<%= `op read "op://Development/Chat-in-a-box/RAILS_MASTER_KEY" -n --session #{session_token}` %>
4+
<% else raise ArgumentError, "Session token missing" end %>

.gitattributes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2+
3+
# Mark the database schema as having been generated.
4+
db/schema.rb linguist-generated
5+
6+
# Mark any vendored files as having been vendored.
7+
vendor/* linguist-vendored

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
scan:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: .ruby-version
21+
bundler-cache: true
22+
23+
- name: Scan for security vulnerabilities
24+
run: bin/brakeman
25+
26+
lint:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up Ruby
33+
uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: .ruby-version
36+
bundler-cache: true
37+
38+
- name: Lint code for consistent style
39+
run: bin/rubocop
40+
41+
test:
42+
runs-on: ubuntu-latest
43+
services:
44+
redis:
45+
image: redis
46+
ports:
47+
- 6379:6379
48+
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
49+
steps:
50+
- name: Install packages
51+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libsqlite3-0 libvips curl ffmpeg
52+
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Ruby
57+
uses: ruby/setup-ruby@v1
58+
env:
59+
REDIS_URL: redis://localhost:6379/0
60+
with:
61+
ruby-version: .ruby-version
62+
bundler-cache: true
63+
64+
- name: Run tests
65+
run: bin/rails db:setup test
66+
67+
test_system:
68+
runs-on: ubuntu-latest
69+
services:
70+
redis:
71+
image: redis
72+
ports:
73+
- 6379:6379
74+
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
75+
steps:
76+
- name: Install packages
77+
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y libsqlite3-0 libvips curl ffmpeg
78+
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Set up Ruby
83+
uses: ruby/setup-ruby@v1
84+
env:
85+
REDIS_URL: redis://localhost:6379/0
86+
with:
87+
ruby-version: .ruby-version
88+
bundler-cache: true
89+
90+
- name: Run tests
91+
run: bin/rails db:setup test:system

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2+
#
3+
# If you find yourself ignoring temporary files generated by your text editor
4+
# or operating system, you probably want to add a global ignore instead:
5+
# git config --global core.excludesfile '~/.gitignore_global'
6+
7+
# Ignore bundler config.
8+
/.bundle
9+
10+
# Ignore the default SQLite database.
11+
/db/*.sqlite3
12+
/db/*.sqlite3-*
13+
14+
# Ignore all logfiles and tempfiles.
15+
/log/*
16+
/tmp/*
17+
!/log/.keep
18+
!/tmp/.keep
19+
20+
# Ignore pidfiles, but keep the directory.
21+
/tmp/pids/*
22+
!/tmp/pids/
23+
!/tmp/pids/.keep
24+
25+
# Ignore uploaded files in development.
26+
/storage/*
27+
!/storage/.keep
28+
/tmp/storage/*
29+
!/tmp/storage/
30+
!/tmp/storage/.keep
31+
32+
/public/assets
33+
34+
# Ignore master key for decrypting credentials and more.
35+
/config/master.key
36+
37+
# Ignore production envs
38+
/.env
39+
40+
# Ignore dartsass builds
41+
app/assets/builds/*
42+
43+
# Ignore our exported zipfiles
44+
/*.zip

.pumaenv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CONFIG=./config/puma_dev.rb
2+
3+
# Mitigate Ruby crash on macOS (see https://github.com/rails/rails/issues/38560)
4+
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
5+

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Omakase Ruby styling for Rails
2+
inherit_gem: { rubocop-rails-omakase: rubocop.yml }

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.4.5

Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Make sure it matches the Ruby version in .ruby-version and Gemfile
4+
ARG RUBY_VERSION=3.3.1
5+
FROM ruby:$RUBY_VERSION-slim AS base
6+
7+
# Rails app lives here
8+
WORKDIR /rails
9+
10+
# Set production environment
11+
ENV RAILS_ENV="production" \
12+
BUNDLE_DEPLOYMENT="1" \
13+
BUNDLE_PATH="/usr/local/bundle" \
14+
BUNDLE_WITHOUT="development"
15+
16+
17+
# Throw-away build stage to reduce size of final image
18+
FROM base AS build
19+
20+
# Install packages need to build gems
21+
RUN apt-get update -qq && \
22+
apt-get install -y build-essential git pkg-config
23+
24+
# Install application gems
25+
COPY Gemfile Gemfile.lock ./
26+
RUN bundle install && \
27+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
28+
29+
# Copy application code
30+
COPY . .
31+
32+
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
33+
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
34+
35+
36+
# Final stage for app image
37+
FROM base
38+
39+
# Configure environment defaults
40+
ENV HTTP_IDLE_TIMEOUT=60
41+
ENV HTTP_READ_TIMEOUT=300
42+
ENV HTTP_WRITE_TIMEOUT=300
43+
44+
# Install packages needed to run the application
45+
RUN apt-get update -qq && \
46+
apt-get install --no-install-recommends -y libsqlite3-0 libvips curl ffmpeg redis && \
47+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
48+
49+
# Run and own the application files as a non-root user for security
50+
RUN useradd rails
51+
USER rails:rails
52+
53+
# Copy built artifacts: gems, application
54+
COPY --from=build --chown=rails:rails /usr/local/bundle /usr/local/bundle
55+
COPY --from=build --chown=rails:rails /rails /rails
56+
57+
# Set version and revision
58+
ARG APP_VERSION
59+
ENV APP_VERSION=$APP_VERSION
60+
ARG GIT_REVISION
61+
ENV GIT_REVISION=$GIT_REVISION
62+
63+
# Expose ports for HTTP and HTTPS
64+
EXPOSE 80 443
65+
66+
# Start the server by default, this can be overwritten at runtime
67+
CMD ["bin/boot"]

Gemfile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
source "https://rubygems.org"
2+
3+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4+
5+
# Rails
6+
gem "rails", github: "rails/rails", branch: "main"
7+
8+
# Drivers
9+
gem "sqlite3", "~> 1.4"
10+
gem "redis", "~> 4.0"
11+
12+
# Deployment
13+
gem "puma", "~> 6.4"
14+
15+
# Jobs
16+
gem "resque", "~> 2.6.0"
17+
gem "resque-pool", "~> 0.7.1"
18+
19+
# Assets
20+
gem "propshaft", github: "rails/propshaft"
21+
gem "importmap-rails", github: "rails/importmap-rails"
22+
23+
# Hotwire
24+
gem "turbo-rails", github: "hotwired/turbo-rails"
25+
gem "stimulus-rails"
26+
27+
# Media handling
28+
gem "image_processing", ">= 1.2"
29+
30+
# Telemetry
31+
gem "sentry-ruby"
32+
gem "sentry-rails"
33+
34+
# Other
35+
gem "bcrypt"
36+
gem "web-push"
37+
gem "rqrcode"
38+
gem "rails_autolink"
39+
gem "geared_pagination"
40+
gem "jbuilder"
41+
gem "net-http-persistent"
42+
gem "kredis"
43+
gem "platform_agent"
44+
gem "thruster"
45+
46+
group :development, :test do
47+
gem "debug"
48+
gem "rubocop-rails-omakase", require: false
49+
gem "faker", require: false
50+
gem "brakeman", require: false
51+
end
52+
53+
group :test do
54+
gem "capybara"
55+
gem "mocha"
56+
gem "selenium-webdriver"
57+
gem "webmock", require: false
58+
end

0 commit comments

Comments
 (0)