diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..1321e56 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,3 @@ +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version +ARG RUBY_VERSION=3.3.0 +FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION diff --git a/.devcontainer/compose.yaml b/.devcontainer/compose.yaml new file mode 100644 index 0000000..02debc1 --- /dev/null +++ b/.devcontainer/compose.yaml @@ -0,0 +1,57 @@ +name: "phlexui-web" + +services: + rails-app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + + volumes: + - ../..:/workspaces:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + networks: + - default + + # Uncomment the next line to use a non-root user for all processes. + # user: vscode + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + ports: + - 45678:45678 + depends_on: + - selenium + - redis + - postgres + + selenium: + image: seleniarm/standalone-chromium + restart: unless-stopped + networks: + - default + + redis: + image: redis:7.2 + restart: unless-stopped + networks: + - default + volumes: + - redis-data:/data + + postgres: + image: postgres:16.1 + restart: unless-stopped + networks: + - default + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + +volumes: + redis-data: + postgres-data: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fe8a631 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,48 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ruby +{ + "name": "phlexui-web", + "dockerComposeFile": "compose.yaml", + "service": "rails-app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/rails/devcontainer/features/activestorage": {}, + "ghcr.io/rails/devcontainer/features/postgres-client": {} + }, + + "containerEnv": { + "CAPYBARA_SERVER_PORT": "45678", + "SELENIUM_HOST": "selenium", + "REDIS_URL": "redis://redis:6379/1", + "DB_HOST": "postgres" + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [3000, 5432, 6379], + + // Configure tool-specific properties. + // "customizations": {}, + "customizations": { + "vscode": { + "extensions": [ + "Shopify.ruby-lsp", + "testdouble.vscode-standard-ruby" + ] + }, + "settings": { + "rubyLsp.rubyVersionManager": { + "identifier": "rbenv" + } + } + }, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root", + + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "bin/setup" +} diff --git a/Gemfile b/Gemfile index 2ac8345..98ca222 100644 --- a/Gemfile +++ b/Gemfile @@ -86,5 +86,6 @@ gem "rack-www" # used to redirect www to non-www subdomain gem "rollbar" gem "phlex-rails" -gem "phlex_ui" +# gem "phlex_ui" # gem "phlex_ui", path: "../phlex_ui" +gem "phlex_ui", git: "https://github.com/PhlexUI/phlex_ui.git" diff --git a/Gemfile.lock b/Gemfile.lock index c690d5d..a9f38a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,13 @@ +GIT + remote: https://github.com/PhlexUI/phlex_ui.git + revision: ab73874f4a437a92c8c721fff8f37cfad6196cd1 + specs: + phlex_ui (0.1.10) + activesupport (>= 6.0) + phlex (~> 1.10) + rouge (~> 4.2.0) + zeitwerk (~> 2.6) + GEM remote: https://rubygems.org/ specs: @@ -92,7 +102,6 @@ GEM debug (1.9.1) irb (~> 1.10) reline (>= 0.3.8) - diff-lcs (1.5.1) dotenv (2.8.1) dotenv-rails (2.8.1) dotenv (= 2.8.1) @@ -164,7 +173,6 @@ GEM octokit (5.6.1) faraday (>= 1, < 3) sawyer (~> 0.9) - paco (0.2.3) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -174,11 +182,6 @@ GEM phlex-rails (1.2.1) phlex (~> 1.10.0) railties (>= 6.1, < 8) - phlex_ui (0.1.8) - phlex (~> 1.10) - rouge (~> 4.2.0) - ruby-next (~> 1.0) - zeitwerk (~> 2.6) postmark (1.25.0) json postmark-rails (0.22.1) @@ -234,7 +237,6 @@ GEM regexp_parser (2.8.3) reline (0.4.1) io-console (~> 0.5) - require-hooks (0.2.2) rexml (3.2.6) rollbar (3.4.2) rouge (4.2.1) @@ -254,15 +256,6 @@ GEM rubocop-performance (1.20.2) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) - ruby-next (1.0.2) - paco (~> 0.2) - require-hooks (~> 0.2) - ruby-next-core (= 1.0.2) - ruby-next-parser (>= 3.2.2.0) - unparser (~> 0.6.0) - ruby-next-core (1.0.2) - ruby-next-parser (3.2.2.0) - parser (>= 3.0.3.1) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -305,9 +298,6 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) - unparser (0.6.13) - diff-lcs (~> 1.3) - parser (>= 3.3.0) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) @@ -342,7 +332,7 @@ DEPENDENCIES octokit (~> 5.0) pg (~> 1.1) phlex-rails - phlex_ui + phlex_ui! postmark-rails pry puma (~> 5.0) diff --git a/config/database.yml b/config/database.yml index c631246..99fffbf 100644 --- a/config/database.yml +++ b/config/database.yml @@ -20,6 +20,12 @@ default: &default # For details on connection pooling, see Rails configuration guide # https://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + <% if ENV["DB_HOST"] %> + host: <%= ENV["DB_HOST"] %> + username: postgres + password: postgres + <% end %> + development: <<: *default