From d6118b5774804265544a121a3f3542f155b10c2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:04:14 +0700 Subject: [PATCH 1/3] Bump rexml from 3.2.5 to 3.2.8 in /.template (#514) Bumps [rexml](https://github.com/ruby/rexml) from 3.2.5 to 3.2.8. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.5...v3.2.8) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .template/Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.template/Gemfile.lock b/.template/Gemfile.lock index 6b2e96cb..d5fd605a 100644 --- a/.template/Gemfile.lock +++ b/.template/Gemfile.lock @@ -21,7 +21,8 @@ GEM racc (1.7.1) rainbow (3.1.1) regexp_parser (2.8.1) - rexml (3.2.5) + rexml (3.2.8) + strscan (>= 3.0.9) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -65,6 +66,7 @@ GEM net-ssh (>= 2.7) net-telnet (= 0.1.1) sfl + strscan (3.1.0) unicode-display_width (2.4.2) PLATFORMS From 90db6786d4a46c0d5276c25b3a2a142c72c349f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 09:29:24 +0700 Subject: [PATCH 2/3] Bump rexml from 3.2.6 to 3.2.8 in /rubocop (#517) Bumps [rexml](https://github.com/ruby/rexml) from 3.2.6 to 3.2.8. - [Release notes](https://github.com/ruby/rexml/releases) - [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md) - [Commits](https://github.com/ruby/rexml/compare/v3.2.6...v3.2.8) --- updated-dependencies: - dependency-name: rexml dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- rubocop/Gemfile.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rubocop/Gemfile.lock b/rubocop/Gemfile.lock index c5370be6..1ac275a7 100644 --- a/rubocop/Gemfile.lock +++ b/rubocop/Gemfile.lock @@ -12,7 +12,8 @@ GEM racc (1.7.3) rainbow (3.1.1) regexp_parser (2.8.3) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -40,10 +41,12 @@ GEM rubocop-ast (1.30.0) parser (>= 3.2.1.0) ruby-progressbar (1.13.0) + strscan (3.1.0) unicode-display_width (2.5.0) PLATFORMS arm64-darwin-22 + x86_64-linux DEPENDENCIES rspec From 1fa47e9c7139fc7b6cae360356759505e5932145 Mon Sep 17 00:00:00 2001 From: Xavier MALPARTY <77609814+malparty@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:25:36 +0700 Subject: [PATCH 3/3] [chore] Updating deps (#513) Co-authored-by: Carlos Herrera --- .github/workflows/test_generated_app.yml | 6 +- .github/workflows/test_production_build.yml | 6 +- .github/workflows/test_template.yml | 2 +- .../addons/docker/docker-compose.dev.yml.tt | 2 +- .../addons/docker/docker-compose.test.yml.tt | 2 +- .template/addons/docker/docker-compose.yml.tt | 3 +- .../addons/semaphore/.semaphore/README.md.tt | 49 ------------- .../.semaphore/promotion-production.yml.tt | 42 ----------- .../.semaphore/promotion-staging.yml.tt | 42 ----------- .../semaphore/.semaphore/semaphore.yml.tt | 70 ------------------- .template/addons/semaphore/template.rb | 5 -- .tool-versions | 2 +- Gemfile.tt | 4 +- README.md | 7 +- template.rb | 12 ++-- 15 files changed, 22 insertions(+), 232 deletions(-) delete mode 100644 .template/addons/semaphore/.semaphore/README.md.tt delete mode 100644 .template/addons/semaphore/.semaphore/promotion-production.yml.tt delete mode 100644 .template/addons/semaphore/.semaphore/promotion-staging.yml.tt delete mode 100644 .template/addons/semaphore/.semaphore/semaphore.yml.tt delete mode 100644 .template/addons/semaphore/template.rb diff --git a/.github/workflows/test_generated_app.yml b/.github/workflows/test_generated_app.yml index 71899587..5e5449d6 100644 --- a/.github/workflows/test_generated_app.yml +++ b/.github/workflows/test_generated_app.yml @@ -9,9 +9,9 @@ env: DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }} DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }} - RUBY_VERSION: 3.2.2 - NODE_VERSION: 18 - RAILS_VERSION: 7.1.2 + RUBY_VERSION: 3.3.1 + NODE_VERSION: 22 + RAILS_VERSION: 7.1.3 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/test_production_build.yml b/.github/workflows/test_production_build.yml index 362c9655..5e02e0c2 100644 --- a/.github/workflows/test_production_build.yml +++ b/.github/workflows/test_production_build.yml @@ -6,9 +6,9 @@ env: APP_NAME: rails-templates DOCKER_IMAGE: ${{ github.repository }} DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }} - RUBY_VERSION: 3.2.2 - NODE_VERSION: 18 - RAILS_VERSION: 7.1.2 + RUBY_VERSION: 3.3.1 + NODE_VERSION: 22 + RAILS_VERSION: 7.1.3 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/test_template.yml b/.github/workflows/test_template.yml index 37ceb327..73abfa1f 100644 --- a/.github/workflows/test_template.yml +++ b/.github/workflows/test_template.yml @@ -3,7 +3,7 @@ name: Test the codebase of the template on: push env: - RUBY_VERSION: 3.2.2 + RUBY_VERSION: 3.3.1 concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.template/addons/docker/docker-compose.dev.yml.tt b/.template/addons/docker/docker-compose.dev.yml.tt index d6096c45..092f6857 100644 --- a/.template/addons/docker/docker-compose.dev.yml.tt +++ b/.template/addons/docker/docker-compose.dev.yml.tt @@ -1,4 +1,4 @@ -version: '3.2' +version: '3.8' services: db: diff --git a/.template/addons/docker/docker-compose.test.yml.tt b/.template/addons/docker/docker-compose.test.yml.tt index cb83d3f4..ad14ba96 100644 --- a/.template/addons/docker/docker-compose.test.yml.tt +++ b/.template/addons/docker/docker-compose.test.yml.tt @@ -1,4 +1,4 @@ -version: '3.2' +version: '3.8' services: db: diff --git a/.template/addons/docker/docker-compose.yml.tt b/.template/addons/docker/docker-compose.yml.tt index 0957e933..570afa4f 100644 --- a/.template/addons/docker/docker-compose.yml.tt +++ b/.template/addons/docker/docker-compose.yml.tt @@ -1,4 +1,4 @@ -version: '3.2' +version: '3.8' services: db: @@ -6,6 +6,7 @@ services: container_name: <%= CONTAINERIZED_APP_NAME %>-db environment: - POSTGRES_DB=<%= APP_NAME %>_production + - POSTGRES_PASSWORD=postgres ports: - "5432:5432" diff --git a/.template/addons/semaphore/.semaphore/README.md.tt b/.template/addons/semaphore/.semaphore/README.md.tt deleted file mode 100644 index b7459b1e..00000000 --- a/.template/addons/semaphore/.semaphore/README.md.tt +++ /dev/null @@ -1,49 +0,0 @@ -# Semaphore CI 2.0 - -## Requirements: - -- Install [Semaphore CLI](https://docs.semaphoreci.com/reference/sem-command-line-tool/) - -## Setup the CI - -### Secrets - -Setup the following secrets in order to run the pipeline: - -Secret name: `<%= APP_NAME %>` - -- DOCKER_REGISTRY_HOST -- DOCKER_REGISTRY_USERNAME -- DOCKER_REGISTRY_TOKEN -- HEROKU_API_KEY - -### Deployment dashboard - -After the project is created on Semaphore CI (on first push), -use the sem CLI to create the deployment dashboard. - -``` -# Get the project id -> sem get project <%= APP_NAME %> - -# Create the deployment dashboard -> sem create dashboard <%= APP_NAME %> -> sem edit dashboard <%= APP_NAME %> -``` - -Configure the widgets to show the deployment pipelines - -``` -spec: - widgets: - - name: Production - type: list_pipelines - filters: - pipeline_file: .semaphore/promotion-production.yml - project_id: - - name: Staging - type: list_pipelines - filters: - pipeline_file: .semaphore/promotion-staging.yml - project_id: -``` diff --git a/.template/addons/semaphore/.semaphore/promotion-production.yml.tt b/.template/addons/semaphore/.semaphore/promotion-production.yml.tt deleted file mode 100644 index 188cbbb5..00000000 --- a/.template/addons/semaphore/.semaphore/promotion-production.yml.tt +++ /dev/null @@ -1,42 +0,0 @@ -version: v1.0 - -name: <%= APP_NAME_HUMANIZED %> Production -agent: - machine: - type: e1-standard-2 - os_image: ubuntu1804 - -global_job_config: - env_vars: - - name: HEROKU_APP - value: <%= APP_NAME %>-production - - name: DOCKER_IMAGE - value: <%= DOCKER_IMAGE %> - secrets: - - name: <%= APP_NAME %> - prologue: - commands: - - checkout - - echo "$DOCKER_REGISTRY_TOKEN" | docker login $DOCKER_REGISTRY_HOST --username=$DOCKER_REGISTRY_USERNAME --password-stdin - - export BRANCH_TAG=${SEMAPHORE_GIT_BRANCH/\//-} - -blocks: - - name: Build - task: - jobs: - - name: Build - commands: - - bin/docker-prepare - - docker compose build - - docker compose push web - - - name: Deploy - task: - prologue: - commands: - - heroku container:login - jobs: - - name: Heroku - commands: - - heroku container:push --arg DOCKER_REGISTRY_HOST=$DOCKER_REGISTRY_HOST,DOCKER_IMAGE=$DOCKER_IMAGE,BRANCH_TAG=$BRANCH_TAG --recursive - - heroku container:release web worker diff --git a/.template/addons/semaphore/.semaphore/promotion-staging.yml.tt b/.template/addons/semaphore/.semaphore/promotion-staging.yml.tt deleted file mode 100644 index ee100af3..00000000 --- a/.template/addons/semaphore/.semaphore/promotion-staging.yml.tt +++ /dev/null @@ -1,42 +0,0 @@ -version: v1.0 - -name: <%= APP_NAME_HUMANIZED %> Staging -agent: - machine: - type: e1-standard-2 - os_image: ubuntu1804 - -global_job_config: - env_vars: - - name: HEROKU_APP - value: <%= APP_NAME %>-staging - - name: DOCKER_IMAGE - value: <%= DOCKER_IMAGE %> - secrets: - - name: <%= APP_NAME %> - prologue: - commands: - - checkout - - echo "$DOCKER_REGISTRY_TOKEN" | docker login $DOCKER_REGISTRY_HOST --username=$DOCKER_REGISTRY_USERNAME --password-stdin - - export BRANCH_TAG=${SEMAPHORE_GIT_BRANCH/\//-} - -blocks: - - name: Build - task: - jobs: - - name: Build - commands: - - bin/docker-prepare - - docker compose build - - docker compose push web - - - name: Deploy - task: - prologue: - commands: - - heroku container:login - jobs: - - name: Heroku - commands: - - heroku container:push --arg DOCKER_REGISTRY_HOST=$DOCKER_REGISTRY_HOST,DOCKER_IMAGE=$DOCKER_IMAGE,BRANCH_TAG=$BRANCH_TAG --recursive - - heroku container:release web worker diff --git a/.template/addons/semaphore/.semaphore/semaphore.yml.tt b/.template/addons/semaphore/.semaphore/semaphore.yml.tt deleted file mode 100644 index caa42592..00000000 --- a/.template/addons/semaphore/.semaphore/semaphore.yml.tt +++ /dev/null @@ -1,70 +0,0 @@ -version: v1.0 - -name: <%= APP_NAME_HUMANIZED %> -agent: - machine: - type: e1-standard-2 - os_image: ubuntu1804 -auto_cancel: - running: - when: "branch != 'main'" - -global_job_config: - env_vars: - - name: COMPOSE_FILE - value: docker-compose.test.yml - secrets: - - name: <%= APP_NAME %> - prologue: - commands: - - checkout - - export BRANCH_TAG=${SEMAPHORE_GIT_BRANCH/\//-} - - echo "$DOCKER_REGISTRY_TOKEN" | docker login $DOCKER_REGISTRY_HOST --username=$DOCKER_REGISTRY_USERNAME --password-stdin - -blocks: - - name: Build - task: - jobs: - - name: Build - commands: - - >- - if ([ $SEMAPHORE_GIT_BRANCH != 'main' ] && [ $SEMAPHORE_GIT_BRANCH != 'development' ]); - then (echo "Pulling built image for the branch"; docker compose pull test || true); - else (echo "Skipping docker pull"); - fi || true - - bin/docker-prepare - - docker compose build - - docker compose push test - - - name: Tests - task: - prologue: - commands: - - docker compose pull - jobs: - - name: Linters - commands: - - docker compose run test yarn lint - - name: Nginx configuration validate - commands: - - docker compose run test nginx -c /etc/nginx/conf.d/default.conf -t - - name: Unit tests - commands: - - docker compose run test bundle exec rspec --exclude-pattern "spec/systems/**/*_spec.rb" --profile --format progress - - name: System tests - commands: - - docker compose run test bundle exec rspec spec/systems --profile --format progress - epilogue: - on_fail: - commands: - - artifact push job tmp/screenshots - -promotions: - - name: Staging - pipeline_file: promotion-staging.yml - auto_promote: - when: "branch = 'development' AND result = 'passed'" - - name: Production - pipeline_file: promotion-production.yml - auto_promote: - when: "branch = 'main' AND result = 'passed'" diff --git a/.template/addons/semaphore/template.rb b/.template/addons/semaphore/template.rb deleted file mode 100644 index 263e4e32..00000000 --- a/.template/addons/semaphore/template.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -use_source_path __dir__ - -directory '.semaphore' diff --git a/.tool-versions b/.tool-versions index df6fb92d..3403b199 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ nodejs >= 18 -ruby 3.2.2 +ruby 3.3.1 diff --git a/Gemfile.tt b/Gemfile.tt index 07c0a5c9..12ca9d68 100644 --- a/Gemfile.tt +++ b/Gemfile.tt @@ -2,7 +2,7 @@ source 'https://rubygems.org' ruby '<%= RUBY_VERSION %>' # Backend -gem 'rails', '7.1.2' # Latest stable +gem 'rails', '~> 7.1' # Latest stable gem 'pg' # Use Postgresql as database gem 'puma' # Use Puma as the app server gem 'mini_magick' # A ruby wrapper for ImageMagick or GraphicsMagick command line @@ -53,7 +53,7 @@ group :development, :test do # Code Analysis gem 'bullet' # help to kill N+1 queries and unused eager loading gem 'brakeman', require: false # A static analysis security vulnerability scanner for Ruby on Rails applications - gem 'parser', '3.2.2.3' # Use correct parser version to avoid parser warnings + gem 'parser', '~> 3.3' # Use correct parser version to avoid parser warnings gem 'rubocop', require: false # A Ruby static code analyzer and formatter, based on the community Ruby style guide. gem 'rubocop-rails', require: false # A RuboCop extension focused on enforcing Rails best practices and coding conventions. gem 'rubocop-rspec', require: false # Code style checking for RSpec files diff --git a/README.md b/README.md index ef8ec384..acc90cfc 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ with building complex applications over the years. ### Requirements -- Install ruby and set your local ruby version to `3.2.2` -- Install rails `7.1.2` -- Install node `18.19.0` (For creating web application) +- Install ruby and set your local ruby version to `3.3.1` +- Install rails `7.1.3` +- Install node `22.1.0` (For creating web application) > 📝 If running on Apple M1, to build docker image, please make sure to set platform to AMD64 by `export DOCKER_DEFAULT_PLATFORM=linux/amd64` @@ -49,7 +49,6 @@ Available Addons: - `docker` - `nginx` - `phrase` -- `semaphore` - `bootstrap` - `slim` - `devise` diff --git a/template.rb b/template.rb index 0b6690c5..d7d75df3 100644 --- a/template.rb +++ b/template.rb @@ -9,9 +9,9 @@ APP_NAME_HUMANIZED = app_name.split(/[-_]/).map(&:capitalize).join(' ').gsub(/ Web$/, '') DOCKER_REGISTRY_HOST = 'docker.io' DOCKER_IMAGE = "nimblehq/#{CONTAINERIZED_APP_NAME}".freeze -RUBY_VERSION = '3.2.2' -POSTGRES_VERSION = '15.2' -REDIS_VERSION = '6.2.7' +RUBY_VERSION = '3.3.1' +POSTGRES_VERSION = '16.3' +REDIS_VERSION = '7.0.9' # Variants API_VARIANT = options[:api] || ENV['API'] == 'true' WEB_VARIANT = !API_VARIANT @@ -22,8 +22,8 @@ }.freeze if WEB_VARIANT - NODE_VERSION = '18.19.0' - NODE_SOURCE_VERSION = '18' # Used in Dockerfile https://github.com/nodesource/distributions + NODE_VERSION = '22.1.0' + NODE_SOURCE_VERSION = '22' # Used in Dockerfile https://github.com/nodesource/distributions end def apply_template!(template_root) @@ -95,7 +95,6 @@ def ask_for_all_variant_addons @install_github_action = yes?(install_addon_prompt('Github Action and Wiki')) @install_openapi = API_VARIANT || yes?(install_addon_prompt('OpenAPI')) @install_mock_server = @install_openapi && yes?(install_addon_prompt('Mock Server')) - @install_semaphore = yes?(install_addon_prompt('SemaphoreCI')) @install_nginx = yes?(install_addon_prompt('Nginx')) @install_phrase = yes?(install_addon_prompt('Phrase')) @install_crud = WEB_VARIANT && yes?(install_addon_prompt('Crud (includes Devise, Bootstrap and Slim)')) @@ -112,7 +111,6 @@ def ask_for_web_variant_addons def apply_optional_addons apply '.template/addons/github/template.rb' if @install_github_action apply '.template/addons/openapi/template.rb' if @install_openapi - apply '.template/addons/semaphore/template.rb' if @install_semaphore apply '.template/addons/nginx/template.rb' if @install_nginx apply '.template/addons/phrase/template.rb' if @install_phrase apply '.template/addons/devise/template.rb' if @install_devise