Add a runnable example compose stack for WarpEngine
examples/compose boots everything the engine's workflow assumes: mysql, a minimal Rails host consuming the engine as a path gem, an SSH drop area sharing the softwares volume with the app, and — behind the ci profile — gitea plus woodpecker (agent attached to the stack network so pipeline steps reach droparea/app by service name). host_app doubles as a reference for a brand-new host: Gemfile, the two initializers, apipie + engine mounts in routes.rb; on first boot the entrypoint runs the install generator and db:prepare. The README gains a detailed bring-up walkthrough: quickstart, publishing a release by hand over scp + /update (verified end to end from a clean slate), and the full gitea/woodpecker OAuth wiring.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
require_relative "boot"
|
||||
|
||||
require "rails"
|
||||
require "active_model/railtie"
|
||||
require "active_record/railtie"
|
||||
require "action_controller/railtie"
|
||||
require "action_view/railtie"
|
||||
require "action_dispatch/railtie"
|
||||
|
||||
Bundler.require(*Rails.groups)
|
||||
require "warp_engine"
|
||||
|
||||
module HostApp
|
||||
class Application < Rails::Application
|
||||
config.load_defaults 8.0
|
||||
|
||||
config.time_zone = "UTC"
|
||||
config.active_record.default_timezone = :utc
|
||||
|
||||
# Demo stack: reachable as localhost, gitea-network hostnames, etc.
|
||||
config.hosts.clear
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup"
|
||||
@@ -0,0 +1,8 @@
|
||||
development:
|
||||
adapter: mysql2
|
||||
encoding: utf8mb4
|
||||
username: root
|
||||
password: <%= ENV.fetch("MYSQL_ROOT_PASSWORD", "warpengine") %>
|
||||
host: mysql
|
||||
port: 3306
|
||||
database: warp_engine_example
|
||||
@@ -0,0 +1,3 @@
|
||||
require_relative "application"
|
||||
|
||||
Rails.application.initialize!
|
||||
@@ -0,0 +1,10 @@
|
||||
Rails.application.configure do
|
||||
config.enable_reloading = true
|
||||
config.eager_load = false
|
||||
config.consider_all_requests_local = true
|
||||
|
||||
config.active_record.migration_error = :page_load
|
||||
config.active_record.verbose_query_logs = true
|
||||
|
||||
config.logger = ActiveSupport::Logger.new($stdout)
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
Apipie.configure do |config|
|
||||
config.app_name = "WarpEngine Example Host"
|
||||
config.api_base_url = ""
|
||||
config.doc_base_url = "/api/docs"
|
||||
config.api_controllers_matcher = [
|
||||
"#{WarpEngine::Engine.root}/app/controllers/**/*.rb"
|
||||
]
|
||||
config.validate = false
|
||||
config.translate = false
|
||||
config.default_version = "1.0"
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
Rails.application.config.to_prepare do
|
||||
WarpEngine.configure do |c|
|
||||
c.file_container_path = ENV.fetch("FILE_CONTAINER_PATH", "/softwares")
|
||||
c.image_container_path = ENV.fetch("IMAGE_CONTAINER_PATH", "/images")
|
||||
|
||||
# Beállítatlan secret esetén a /update endpoint minden kérést elutasít.
|
||||
c.update_secret = ENV["UPDATE_SECRET"]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
Rails.application.routes.draw do
|
||||
apipie
|
||||
|
||||
# Keep the engine mount the last entry so the host's own routes win.
|
||||
mount WarpEngine::Engine => "/"
|
||||
end
|
||||
Reference in New Issue
Block a user