superfast 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +47 -0
  3. data/.kamal/hooks/docker-setup.sample +3 -0
  4. data/.kamal/hooks/post-deploy.sample +14 -0
  5. data/.kamal/hooks/post-proxy-reboot.sample +3 -0
  6. data/.kamal/hooks/pre-build.sample +51 -0
  7. data/.kamal/hooks/pre-connect.sample +47 -0
  8. data/.kamal/hooks/pre-deploy.sample +109 -0
  9. data/.kamal/hooks/pre-proxy-reboot.sample +3 -0
  10. data/.kamal/secrets +17 -0
  11. data/.rubocop.yml +17 -0
  12. data/.ruby-version +1 -0
  13. data/CHANGELOG.md +5 -0
  14. data/CODE_OF_CONDUCT.md +73 -0
  15. data/Dockerfile +77 -0
  16. data/LICENSE +21 -0
  17. data/README.md +64 -0
  18. data/Rakefile +6 -0
  19. data/SECURITY.md +23 -0
  20. data/app/assets/images/.keep +0 -0
  21. data/app/assets/stylesheets/application.css +10 -0
  22. data/app/controllers/application_controller.rb +4 -0
  23. data/app/controllers/concerns/.keep +0 -0
  24. data/app/helpers/application_helper.rb +2 -0
  25. data/app/javascript/application.js +3 -0
  26. data/app/javascript/controllers/application.js +9 -0
  27. data/app/javascript/controllers/hello_controller.js +7 -0
  28. data/app/javascript/controllers/index.js +4 -0
  29. data/app/jobs/application_job.rb +7 -0
  30. data/app/mailers/application_mailer.rb +4 -0
  31. data/app/models/application_record.rb +3 -0
  32. data/app/models/concerns/.keep +0 -0
  33. data/app/views/layouts/application.html.erb +28 -0
  34. data/app/views/layouts/mailer.html.erb +13 -0
  35. data/app/views/layouts/mailer.text.erb +1 -0
  36. data/app/views/pwa/manifest.json.erb +22 -0
  37. data/app/views/pwa/service-worker.js +26 -0
  38. data/assets/fibery.png +0 -0
  39. data/assets/superfast.png +0 -0
  40. data/assets/zulip.png +0 -0
  41. data/bin/brakeman +7 -0
  42. data/bin/bundle +109 -0
  43. data/bin/bundle.cmd +112 -0
  44. data/bin/dev +2 -0
  45. data/bin/docker-entrypoint +14 -0
  46. data/bin/importmap +4 -0
  47. data/bin/jobs +6 -0
  48. data/bin/kamal +27 -0
  49. data/bin/kamal.cmd +30 -0
  50. data/bin/rails +4 -0
  51. data/bin/rake +4 -0
  52. data/bin/rubocop +8 -0
  53. data/bin/setup +34 -0
  54. data/bin/thrust +5 -0
  55. data/config/application.rb +27 -0
  56. data/config/boot.rb +4 -0
  57. data/config/cable.yml +17 -0
  58. data/config/cache.yml +16 -0
  59. data/config/credentials.yml.enc +1 -0
  60. data/config/database.yml +102 -0
  61. data/config/deploy.yml +116 -0
  62. data/config/environment.rb +5 -0
  63. data/config/environments/development.rb +72 -0
  64. data/config/environments/production.rb +91 -0
  65. data/config/environments/test.rb +53 -0
  66. data/config/importmap.rb +8 -0
  67. data/config/initializers/assets.rb +7 -0
  68. data/config/initializers/content_security_policy.rb +25 -0
  69. data/config/initializers/filter_parameter_logging.rb +8 -0
  70. data/config/initializers/inflections.rb +16 -0
  71. data/config/locales/en.yml +31 -0
  72. data/config/puma.rb +41 -0
  73. data/config/queue.yml +18 -0
  74. data/config/recurring.yml +10 -0
  75. data/config/routes.rb +14 -0
  76. data/config/storage.yml +34 -0
  77. data/config.ru +6 -0
  78. data/db/cable_schema.rb +11 -0
  79. data/db/cache_schema.rb +14 -0
  80. data/db/queue_schema.rb +129 -0
  81. data/db/schema.rb +17 -0
  82. data/db/seeds.rb +9 -0
  83. data/lib/superfast/version.rb +5 -0
  84. data/lib/superfast.rb +8 -0
  85. data/lib/tasks/.keep +0 -0
  86. data/log/.keep +0 -0
  87. data/public/400.html +114 -0
  88. data/public/404.html +114 -0
  89. data/public/406-unsupported-browser.html +114 -0
  90. data/public/422.html +114 -0
  91. data/public/500.html +114 -0
  92. data/public/icon.png +0 -0
  93. data/public/icon.svg +3 -0
  94. data/public/robots.txt +1 -0
  95. data/script/.keep +0 -0
  96. data/storage/.keep +0 -0
  97. data/superfast.gemspec +48 -0
  98. data/tmp/.keep +0 -0
  99. data/tmp/pids/.keep +0 -0
  100. data/tmp/storage/.keep +0 -0
  101. data/vendor/.keep +0 -0
  102. data/vendor/javascript/.keep +0 -0
  103. metadata +298 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d28457b362a3a93a5cf98ef933e947b5e08af085ab8a1bb2a182ec8cc4b8a1da
4
+ data.tar.gz: 8cd27e71f677e62d2d9adea0a5a406071c0705a1edcad8fd53b8032801386007
5
+ SHA512:
6
+ metadata.gz: 56a4527fd9a57ab1d5b4316b365ec23b6a0afba2679d60f48fd4db405ea083b63a59218dc5cad6d4b8c6b9160a1473b6cb1f84c7dae88f0e36781755c289f50b
7
+ data.tar.gz: bb0bc04a2072f2ea1b0a618abfcee641f082fd230aa061d242b58e1dd317b6e666726102d782766d1e4b5910ef278ca0ffc5c67595d3619a1c6a17b6657ac819
data/.dockerignore ADDED
@@ -0,0 +1,47 @@
1
+ # See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2
+
3
+ # Ignore git directory.
4
+ /.git/
5
+ /.gitignore
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore all environment files.
11
+ /.env*
12
+
13
+ # Ignore all default key files.
14
+ /config/master.key
15
+ /config/credentials/*.key
16
+
17
+ # Ignore all logfiles and tempfiles.
18
+ /log/*
19
+ /tmp/*
20
+ !/log/.keep
21
+ !/tmp/.keep
22
+
23
+ # Ignore pidfiles, but keep the directory.
24
+ /tmp/pids/*
25
+ !/tmp/pids/.keep
26
+
27
+ # Ignore storage (uploaded files in development and any SQLite databases).
28
+ /storage/*
29
+ !/storage/.keep
30
+ /tmp/storage/*
31
+ !/tmp/storage/.keep
32
+
33
+ # Ignore assets.
34
+ /node_modules/
35
+ /app/assets/builds/*
36
+ !/app/assets/builds/.keep
37
+ /public/assets
38
+
39
+ # Ignore CI service files.
40
+ /.github
41
+
42
+ # Ignore development files
43
+ /.devcontainer
44
+
45
+ # Ignore Docker-related files
46
+ /.dockerignore
47
+ /Dockerfile*
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ echo "Docker set up on $KAMAL_HOSTS..."
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+
3
+ # A sample post-deploy hook
4
+ #
5
+ # These environment variables are available:
6
+ # KAMAL_RECORDED_AT
7
+ # KAMAL_PERFORMER
8
+ # KAMAL_VERSION
9
+ # KAMAL_HOSTS
10
+ # KAMAL_ROLE (if set)
11
+ # KAMAL_DESTINATION (if set)
12
+ # KAMAL_RUNTIME
13
+
14
+ echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ echo "Rebooted kamal-proxy on $KAMAL_HOSTS"
@@ -0,0 +1,51 @@
1
+ #!/bin/sh
2
+
3
+ # A sample pre-build hook
4
+ #
5
+ # Checks:
6
+ # 1. We have a clean checkout
7
+ # 2. A remote is configured
8
+ # 3. The branch has been pushed to the remote
9
+ # 4. The version we are deploying matches the remote
10
+ #
11
+ # These environment variables are available:
12
+ # KAMAL_RECORDED_AT
13
+ # KAMAL_PERFORMER
14
+ # KAMAL_VERSION
15
+ # KAMAL_HOSTS
16
+ # KAMAL_ROLE (if set)
17
+ # KAMAL_DESTINATION (if set)
18
+
19
+ if [ -n "$(git status --porcelain)" ]; then
20
+ echo "Git checkout is not clean, aborting..." >&2
21
+ git status --porcelain >&2
22
+ exit 1
23
+ fi
24
+
25
+ first_remote=$(git remote)
26
+
27
+ if [ -z "$first_remote" ]; then
28
+ echo "No git remote set, aborting..." >&2
29
+ exit 1
30
+ fi
31
+
32
+ current_branch=$(git branch --show-current)
33
+
34
+ if [ -z "$current_branch" ]; then
35
+ echo "Not on a git branch, aborting..." >&2
36
+ exit 1
37
+ fi
38
+
39
+ remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1)
40
+
41
+ if [ -z "$remote_head" ]; then
42
+ echo "Branch not pushed to remote, aborting..." >&2
43
+ exit 1
44
+ fi
45
+
46
+ if [ "$KAMAL_VERSION" != "$remote_head" ]; then
47
+ echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
48
+ exit 1
49
+ fi
50
+
51
+ exit 0
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # A sample pre-connect check
4
+ #
5
+ # Warms DNS before connecting to hosts in parallel
6
+ #
7
+ # These environment variables are available:
8
+ # KAMAL_RECORDED_AT
9
+ # KAMAL_PERFORMER
10
+ # KAMAL_VERSION
11
+ # KAMAL_HOSTS
12
+ # KAMAL_ROLE (if set)
13
+ # KAMAL_DESTINATION (if set)
14
+ # KAMAL_RUNTIME
15
+
16
+ hosts = ENV["KAMAL_HOSTS"].split(",")
17
+ results = nil
18
+ max = 3
19
+
20
+ elapsed = Benchmark.realtime do
21
+ results = hosts.map do |host|
22
+ Thread.new do
23
+ tries = 1
24
+
25
+ begin
26
+ Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
27
+ rescue SocketError
28
+ if tries < max
29
+ puts "Retrying DNS warmup: #{host}"
30
+ tries += 1
31
+ sleep rand
32
+ retry
33
+ else
34
+ puts "DNS warmup failed: #{host}"
35
+ host
36
+ end
37
+ end
38
+
39
+ tries
40
+ end
41
+ end.map(&:value)
42
+ end
43
+
44
+ retries = results.sum - hosts.size
45
+ nopes = results.count { |r| r == max }
46
+
47
+ puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # A sample pre-deploy hook
4
+ #
5
+ # Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
6
+ #
7
+ # Fails unless the combined status is "success"
8
+ #
9
+ # These environment variables are available:
10
+ # KAMAL_RECORDED_AT
11
+ # KAMAL_PERFORMER
12
+ # KAMAL_VERSION
13
+ # KAMAL_HOSTS
14
+ # KAMAL_COMMAND
15
+ # KAMAL_SUBCOMMAND
16
+ # KAMAL_ROLE (if set)
17
+ # KAMAL_DESTINATION (if set)
18
+
19
+ # Only check the build status for production deployments
20
+ if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
21
+ exit 0
22
+ end
23
+
24
+ require "bundler/inline"
25
+
26
+ # true = install gems so this is fast on repeat invocations
27
+ gemfile(true, quiet: true) do
28
+ source "https://rubygems.org"
29
+
30
+ gem "octokit"
31
+ gem "faraday-retry"
32
+ end
33
+
34
+ MAX_ATTEMPTS = 72
35
+ ATTEMPTS_GAP = 10
36
+
37
+ def exit_with_error(message)
38
+ $stderr.puts message
39
+ exit 1
40
+ end
41
+
42
+ class GithubStatusChecks
43
+ attr_reader :remote_url, :git_sha, :github_client, :combined_status
44
+
45
+ def initialize
46
+ @remote_url = `git config --get remote.origin.url`.strip.delete_prefix("https://github.com/")
47
+ @git_sha = `git rev-parse HEAD`.strip
48
+ @github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
49
+ refresh!
50
+ end
51
+
52
+ def refresh!
53
+ @combined_status = github_client.combined_status(remote_url, git_sha)
54
+ end
55
+
56
+ def state
57
+ combined_status[:state]
58
+ end
59
+
60
+ def first_status_url
61
+ first_status = combined_status[:statuses].find { |status| status[:state] == state }
62
+ first_status && first_status[:target_url]
63
+ end
64
+
65
+ def complete_count
66
+ combined_status[:statuses].count { |status| status[:state] != "pending"}
67
+ end
68
+
69
+ def total_count
70
+ combined_status[:statuses].count
71
+ end
72
+
73
+ def current_status
74
+ if total_count > 0
75
+ "Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
76
+ else
77
+ "Build not started..."
78
+ end
79
+ end
80
+ end
81
+
82
+
83
+ $stdout.sync = true
84
+
85
+ puts "Checking build status..."
86
+ attempts = 0
87
+ checks = GithubStatusChecks.new
88
+
89
+ begin
90
+ loop do
91
+ case checks.state
92
+ when "success"
93
+ puts "Checks passed, see #{checks.first_status_url}"
94
+ exit 0
95
+ when "failure"
96
+ exit_with_error "Checks failed, see #{checks.first_status_url}"
97
+ when "pending"
98
+ attempts += 1
99
+ end
100
+
101
+ exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
102
+
103
+ puts checks.current_status
104
+ sleep(ATTEMPTS_GAP)
105
+ checks.refresh!
106
+ end
107
+ rescue Octokit::NotFound
108
+ exit_with_error "Build status could not be found"
109
+ end
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ echo "Rebooting kamal-proxy on $KAMAL_HOSTS..."
data/.kamal/secrets ADDED
@@ -0,0 +1,17 @@
1
+ # Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
2
+ # and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
3
+ # password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
4
+
5
+ # Example of extracting secrets from 1password (or another compatible pw manager)
6
+ # SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
7
+ # KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
8
+ # RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
9
+
10
+ # Use a GITHUB_TOKEN if private repositories are needed for the image
11
+ # GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
12
+
13
+ # Grab the registry password from ENV
14
+ KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
15
+
16
+ # Improve security by using a password manager. Never check config/master.key into git!
17
+ RAILS_MASTER_KEY=$(cat config/master.key)
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Omakase Ruby styling for Rails
2
+ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.3
6
+
7
+ Style/StringLiterals:
8
+ EnforcedStyle: double_quotes
9
+
10
+ Style/StringLiteralsInInterpolation:
11
+ EnforcedStyle: double_quotes
12
+
13
+ # Overwrite or add rules to create your own house style
14
+ #
15
+ # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
16
+ # Layout/SpaceInsideArrayLiteralBrackets:
17
+ # Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-12-07
4
+
5
+ - Initial release
@@ -0,0 +1,73 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ - Demonstrating empathy and kindness toward other people
14
+ - Being respectful of differing opinions, viewpoints, and experiences
15
+ - Giving and gracefully accepting constructive feedback
16
+ - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ - Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ - Trolling, insulting or derogatory comments, and personal or political attacks
23
+ - Public or private harassment
24
+ - Publishing others’ private information, such as a physical or email address, without their explicit permission
25
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **[hey@superfast.sh](mailto:hey@superfast.sh)**. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
49
+
50
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
51
+
52
+ ### 2. Warning
53
+ **Community Impact**: A violation through a single incident or series of actions.
54
+
55
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
56
+
57
+ ### 3. Temporary Ban
58
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
59
+
60
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
61
+
62
+ ### 4. Permanent Ban
63
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
64
+
65
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
66
+
67
+ ## Attribution
68
+
69
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
70
+
71
+ Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder](https://github.com/mozilla/diversity).
72
+
73
+ For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Dockerfile ADDED
@@ -0,0 +1,77 @@
1
+ # syntax=docker/dockerfile:1
2
+ # check=error=true
3
+
4
+ # This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
5
+ # docker build -t superfast .
6
+ # docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name superfast superfast
7
+
8
+ # For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
9
+
10
+ # Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11
+ ARG RUBY_VERSION=3.3.6
12
+ FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
13
+
14
+ # Rails app lives here
15
+ WORKDIR /rails
16
+
17
+ # Install base packages
18
+ RUN apt-get update -qq && \
19
+ apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
20
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
21
+
22
+ # Set production environment
23
+ ENV RAILS_ENV="production" \
24
+ BUNDLE_DEPLOYMENT="1" \
25
+ BUNDLE_PATH="/usr/local/bundle" \
26
+ BUNDLE_WITHOUT="development"
27
+
28
+ # Throw-away build stage to reduce size of final image
29
+ FROM base AS build
30
+
31
+ # Install packages needed to build gems
32
+ RUN apt-get update -qq && \
33
+ apt-get install --no-install-recommends -y build-essential git libpq-dev pkg-config && \
34
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
35
+
36
+ # Install application gems
37
+ COPY Gemfile Gemfile.lock ./
38
+ RUN bundle install && \
39
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
40
+ bundle exec bootsnap precompile --gemfile
41
+
42
+ # Copy application code
43
+ COPY . .
44
+
45
+ # Precompile bootsnap code for faster boot times
46
+ RUN bundle exec bootsnap precompile app/ lib/
47
+
48
+ # Adjust binfiles to be executable on Linux
49
+ RUN chmod +x bin/* && \
50
+ sed -i "s/\r$//g" bin/* && \
51
+ sed -i 's/ruby\.exe$/ruby/' bin/*
52
+
53
+ # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
54
+ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
55
+
56
+
57
+
58
+
59
+ # Final stage for app image
60
+ FROM base
61
+
62
+ # Copy built artifacts: gems, application
63
+ COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
64
+ COPY --from=build /rails /rails
65
+
66
+ # Run and own only the runtime files as a non-root user for security
67
+ RUN groupadd --system --gid 1000 rails && \
68
+ useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
69
+ chown -R rails:rails db log storage tmp
70
+ USER 1000:1000
71
+
72
+ # Entrypoint prepares the database.
73
+ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
74
+
75
+ # Start server via Thruster by default, this can be overwritten at runtime
76
+ EXPOSE 80
77
+ CMD ["./bin/thrust", "./bin/rails", "server"]
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Superfast.sh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+
2
+ <p align="center">
3
+ <a href="https://superfast.sh" target="_blank">
4
+ <img src="assets/superfast.png" alt="Superfast" width="200px">
5
+ </a>
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://superfast.sh">Website</a> •
10
+ <a href="https://github.com/gosuperfast/superfast">GitHub Repository</a> •
11
+ <a href="https://github.com/gosuperfast">Organization</a>
12
+ </p>
13
+
14
+
15
+ &nbsp;
16
+
17
+ Superfast is a blazing-fast, HTML-over-the-Wire publishing platform designed for simplicity, scalability, and performance. Built on Rails, Turbo, and Strada, it empowers content creators with modern tools while maintaining minimal JavaScript dependencies.
18
+
19
+ &nbsp;
20
+
21
+ ## Quick Links
22
+ &nbsp;
23
+
24
+ - [Code of Conduct](CODE_OF_CONDUCT.md)
25
+ - [License](LICENSE)
26
+ - [Security Policy](SECURITY.md)
27
+
28
+ ## Getting Started
29
+ &nbsp;
30
+
31
+
32
+ ## Sponsors
33
+
34
+ Superfast is proudly supported by our sponsors. A big thanks to:
35
+ &nbsp;
36
+ &nbsp;
37
+
38
+
39
+
40
+ [<img src="assets/zulip.png" width="185" height="45" alt="Zulip">](https://zulip.com) &nbsp; &nbsp; &nbsp; [<img src="assets/fibery.png" width="185" height="45" alt="Fibery">](https://fibery.io)
41
+
42
+
43
+
44
+
45
+
46
+ ## Contributing
47
+
48
+ We welcome contributions! Check out our **[Contributing Guide](CONTRIBUTING.md)** for details on how to get involved.
49
+
50
+
51
+ ## License
52
+
53
+ Superfast is released under the **[MIT License](LICENSE)**.
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+ ### 🚀 Beta Launching Soon!
62
+ We're excited to announce that Superfast CMS is preparing for its beta release! Stay tuned for updates and be among the first to experience the future of fast, simple, and scalable content management.
63
+
64
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
data/SECURITY.md ADDED
@@ -0,0 +1,23 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We support the latest version of Superfast with security updates. Please ensure that your software is up to date to benefit from the latest security patches.
6
+
7
+ | Version | Supported |
8
+ |--------------|--------------------|
9
+ | Latest | :white_check_mark: |
10
+ | Older | :x: |
11
+
12
+ ## Reporting a Vulnerability
13
+
14
+ If you discover a security vulnerability, we encourage you to report it responsibly. Please email us at **[support@superfast.sh](mailto:support@superfast.sh)** with details of the vulnerability.
15
+
16
+ Include the following in your report:
17
+ - A detailed description of the vulnerability.
18
+ - Steps to reproduce the issue.
19
+ - Potential impact and severity.
20
+
21
+ We will acknowledge your report promptly and work to address the issue as quickly as possible.
22
+
23
+ Thank you for helping us keep Superfast platform secure!
File without changes
@@ -0,0 +1,10 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css.
3
+ *
4
+ * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
5
+ * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
6
+ * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
7
+ * depending on specificity.
8
+ *
9
+ * Consider organizing styles into separate files for maintainability.
10
+ */
@@ -0,0 +1,4 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3
+ allow_browser versions: :modern
4
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,3 @@
1
+ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
@@ -0,0 +1,9 @@
1
+ import { Application } from "@hotwired/stimulus"
2
+
3
+ const application = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ application.debug = false
7
+ window.Stimulus = application
8
+
9
+ export { application }
@@ -0,0 +1,7 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ this.element.textContent = "Hello World!"
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ // Import and register all your controllers from the importmap via controllers/**/*_controller
2
+ import { application } from "controllers/application"
3
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
4
+ eagerLoadControllersFrom("controllers", application)