modulorails 1.5.2.pre.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.claude/skills/release-modulorails/SKILL.md +150 -0
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +55 -8
- data/Gemfile.lock +75 -26
- data/README.md +69 -9
- data/lib/generators/modulorails/claude_code/claude_code_generator.rb +64 -0
- data/lib/generators/modulorails/claude_code/templates/.gitlab-ci.yml.tt +120 -0
- data/lib/generators/modulorails/claude_code/templates/.modulorails-gitlab-ci +6 -0
- data/lib/generators/modulorails/claude_code/templates/bin/init-firewall.sh.tt +118 -0
- data/lib/generators/modulorails/docker/compose/compose_generator.rb +7 -6
- data/lib/generators/modulorails/docker/config/config_generator.rb +11 -5
- data/lib/generators/modulorails/docker/config/templates/config/database.yml.tt +7 -2
- data/lib/generators/modulorails/docker/devcontainer/devcontainer_generator.rb +52 -0
- data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/Dockerfile.tt +53 -0
- data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/compose.yml.tt +97 -0
- data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/devcontainer.json.tt +80 -0
- data/lib/generators/modulorails/docker/docker_generator.rb +7 -0
- data/lib/generators/modulorails/docker/dockerfile/dockerfile_generator.rb +15 -11
- data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/{rails/Dockerfile.prod.tt → Dockerfile.prod.tt} +31 -12
- data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/dockerignore.tt +120 -0
- data/lib/generators/modulorails/docker/entrypoint/entrypoint_generator.rb +11 -5
- data/lib/generators/modulorails/docker/entrypoint/templates/entrypoints/docker-entrypoint.sh.tt +5 -0
- data/lib/generators/modulorails/githooks/githooks_generator.rb +5 -3
- data/lib/generators/modulorails/githooks/templates/dc.sh +30 -0
- data/lib/generators/modulorails/githooks/templates/dcr.sh +47 -0
- data/lib/generators/modulorails/githooks/templates/post-rewrite.sh +1 -1
- data/lib/generators/modulorails/githooks/templates/pre-merge-commit.sh +1 -1
- data/lib/generators/modulorails/githooks/templates/refresh_generations.sh +17 -9
- data/lib/generators/modulorails/gitlabci/gitlabci_generator.rb +7 -1
- data/lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt +15 -13
- data/lib/generators/modulorails/gitlabci/templates/bin/test.sh.tt +36 -0
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/production.yaml.tt +4 -4
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/review.yaml.tt +4 -4
- data/lib/generators/modulorails/gitlabci/templates/config/deploy/staging.yaml.tt +7 -7
- data/lib/generators/modulorails/moduloproject/moduloproject_generator.rb +8 -3
- data/lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt +21 -51
- data/lib/generators/modulorails/rubocop/rubocop_generator.rb +8 -3
- data/lib/generators/modulorails/rubocop/templates/rubocop.yml.tt +7 -1
- data/lib/generators/modulorails/self_update/self_update_generator.rb +4 -0
- data/lib/generators/modulorails/sidekiq/sidekiq_generator.rb +95 -38
- data/lib/generators/modulorails/sidekiq/templates/config/initializers/sidekiq.rb.tt +4 -4
- data/lib/modulorails/configuration.rb +17 -7
- data/lib/modulorails/data.rb +41 -12
- data/lib/modulorails/generators/base.rb +1 -1
- data/lib/modulorails/railtie.rb +4 -1
- data/lib/modulorails/version.rb +1 -1
- data/lib/modulorails.rb +15 -5
- metadata +17 -10
- data/lib/generators/modulorails/docker/compose/templates/docker-compose.yml.tt +0 -81
- data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/modulotech/Dockerfile.prod.tt +0 -66
- data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/modulotech/Dockerfile.tt +0 -30
- data/lib/generators/modulorails/docker/entrypoint/templates/entrypoints/webpack-entrypoint.sh.tt +0 -7
- data/lib/generators/modulorails/githooks/templates/dockeruby.rb +0 -124
- data/lib/generators/modulorails/sidekiq/templates/entrypoints/sidekiq-entrypoint.sh.tt +0 -7
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Created by https://www.gitignore.io/api/osx,rails
|
|
2
|
+
|
|
3
|
+
dump.rdb
|
|
4
|
+
|
|
5
|
+
coverage
|
|
6
|
+
*.xlsx
|
|
7
|
+
|
|
8
|
+
### OSX ###
|
|
9
|
+
*.DS_Store
|
|
10
|
+
.AppleDouble
|
|
11
|
+
.LSOverride
|
|
12
|
+
|
|
13
|
+
# Icon must end with two \r
|
|
14
|
+
Icon
|
|
15
|
+
# Thumbnails
|
|
16
|
+
._*
|
|
17
|
+
# Files that might appear in the root of a volume
|
|
18
|
+
.DocumentRevisions-V100
|
|
19
|
+
.fseventsd
|
|
20
|
+
.Spotlight-V100
|
|
21
|
+
.TemporaryItems
|
|
22
|
+
.Trashes
|
|
23
|
+
.VolumeIcon.icns
|
|
24
|
+
.com.apple.timemachine.donotpresent
|
|
25
|
+
# Directories potentially created on remote AFP share
|
|
26
|
+
.AppleDB
|
|
27
|
+
.AppleDesktop
|
|
28
|
+
Network Trash Folder
|
|
29
|
+
Temporary Items
|
|
30
|
+
.apdisk
|
|
31
|
+
|
|
32
|
+
### Rails ###
|
|
33
|
+
*.rbc
|
|
34
|
+
capybara-*.html
|
|
35
|
+
/db/*.sqlite3
|
|
36
|
+
/db/*.sqlite3-journal
|
|
37
|
+
/public/system
|
|
38
|
+
/public/uploads
|
|
39
|
+
/coverage/
|
|
40
|
+
/spec/tmp
|
|
41
|
+
**.orig
|
|
42
|
+
rerun.txt
|
|
43
|
+
pickle-email-*.html
|
|
44
|
+
|
|
45
|
+
config/initializers/secret_token.rb
|
|
46
|
+
|
|
47
|
+
# Only include if you have production secrets in this file, which is no longer a Rails default
|
|
48
|
+
# config/secrets.yml
|
|
49
|
+
|
|
50
|
+
# dotenv
|
|
51
|
+
.env
|
|
52
|
+
.env.sh
|
|
53
|
+
|
|
54
|
+
## Environment normalization:
|
|
55
|
+
/.bundle
|
|
56
|
+
/vendor/bundle
|
|
57
|
+
|
|
58
|
+
# these should all be checked in to normalize the environment:
|
|
59
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
|
60
|
+
|
|
61
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
62
|
+
.rvmrc
|
|
63
|
+
|
|
64
|
+
# if using bower-rails ignore default bower_components path bower.json files
|
|
65
|
+
/vendor/assets/bower_components
|
|
66
|
+
*.bowerrc
|
|
67
|
+
bower.json
|
|
68
|
+
|
|
69
|
+
# Ignore pow environment settings
|
|
70
|
+
.powenv
|
|
71
|
+
|
|
72
|
+
# Ignore Byebug command history file.
|
|
73
|
+
.byebug_history
|
|
74
|
+
|
|
75
|
+
**/.classpath
|
|
76
|
+
**/.dockerignore
|
|
77
|
+
**/.env
|
|
78
|
+
**/.gitignore
|
|
79
|
+
**/.project
|
|
80
|
+
**/.settings
|
|
81
|
+
**/.toolstarget
|
|
82
|
+
**/.vs
|
|
83
|
+
**/.vscode
|
|
84
|
+
**/*.*proj.user
|
|
85
|
+
**/*.dbmdl
|
|
86
|
+
**/*.jfm
|
|
87
|
+
**/azds.yaml
|
|
88
|
+
**/charts
|
|
89
|
+
**/docker-compose*
|
|
90
|
+
**/compose*
|
|
91
|
+
**/Dockerfile*
|
|
92
|
+
**/node_modules
|
|
93
|
+
**/npm-debug.log
|
|
94
|
+
**/obj
|
|
95
|
+
**/secrets.dev.yaml
|
|
96
|
+
**/values.dev.yaml
|
|
97
|
+
README.md
|
|
98
|
+
|
|
99
|
+
.browserslistrc
|
|
100
|
+
.gitignore
|
|
101
|
+
.gitlab
|
|
102
|
+
.gitlab-ci.yml
|
|
103
|
+
.modulorails-gitlab-ci
|
|
104
|
+
.nvmrc
|
|
105
|
+
.rubocop.yml
|
|
106
|
+
.ruby-gemset
|
|
107
|
+
.ruby-version
|
|
108
|
+
|
|
109
|
+
/public/packs
|
|
110
|
+
/public/packs-test
|
|
111
|
+
/node_modules
|
|
112
|
+
/yarn-error.log
|
|
113
|
+
yarn-debug.log*
|
|
114
|
+
.yarn-integrity
|
|
115
|
+
|
|
116
|
+
/log/*
|
|
117
|
+
/tmp
|
|
118
|
+
|
|
119
|
+
rspec.xml
|
|
120
|
+
rspec_results.txt
|
|
@@ -9,18 +9,23 @@ module Modulorails
|
|
|
9
9
|
|
|
10
10
|
class EntrypointGenerator < Modulorails::Generators::DockerBase
|
|
11
11
|
|
|
12
|
-
VERSION =
|
|
12
|
+
VERSION = 2
|
|
13
13
|
|
|
14
14
|
desc 'This generator creates Docker entrypoints'
|
|
15
15
|
|
|
16
16
|
protected
|
|
17
17
|
|
|
18
18
|
def create_config
|
|
19
|
+
Modulorails.deprecator.warn(<<~MESSAGE)
|
|
20
|
+
Modulorails::Docker::EntrypointGenerator is deprecated and will be removed in version 2.0.
|
|
21
|
+
Use Moduloproject 3.0 (available later) to initialize new projects with Docker configuration.
|
|
22
|
+
MESSAGE
|
|
23
|
+
|
|
19
24
|
create_docker_entrypoint
|
|
20
|
-
|
|
25
|
+
remove_webpack_entrypoint
|
|
21
26
|
|
|
22
27
|
if File.exist?('entrypoints/sidekiq-entrypoint.sh') || File.exist?('bin/sidekiq-entrypoint')
|
|
23
|
-
SidekiqGenerator.new([], {}, {}).invoke('
|
|
28
|
+
SidekiqGenerator.new([], {}, {}).invoke('remove_entrypoint')
|
|
24
29
|
end
|
|
25
30
|
rescue StandardError => e
|
|
26
31
|
warn("[Modulorails] Error: cannot generate Docker entrypoints: #{e.message}")
|
|
@@ -28,8 +33,9 @@ module Modulorails
|
|
|
28
33
|
|
|
29
34
|
private
|
|
30
35
|
|
|
31
|
-
def
|
|
32
|
-
|
|
36
|
+
def remove_webpack_entrypoint
|
|
37
|
+
remove_file('entrypoints/webpack-entrypoint.sh')
|
|
38
|
+
remove_file('bin/webpack-entrypoint')
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
def create_docker_entrypoint
|
data/lib/generators/modulorails/docker/entrypoint/templates/entrypoints/docker-entrypoint.sh.tt
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/bin/sh -e
|
|
2
2
|
|
|
3
|
+
# For non-rails command (webpack, bun, yarn, etc.), we skip all rails-related processes and checks.
|
|
4
|
+
if ! echo "${@}" | grep -qE '\b(rails|bin/rails)\b'; then
|
|
5
|
+
exec "${@}"
|
|
6
|
+
fi
|
|
7
|
+
|
|
3
8
|
# Enable jemalloc for reduced memory usage and latency.
|
|
4
9
|
jemalloc_lib=$(find /usr/lib/ -name "libjemalloc.so.2" 2>/dev/null | head -n 1)
|
|
5
10
|
|
|
@@ -6,7 +6,7 @@ module Modulorails
|
|
|
6
6
|
|
|
7
7
|
class GithooksGenerator < Modulorails::Generators::Base
|
|
8
8
|
|
|
9
|
-
VERSION =
|
|
9
|
+
VERSION = 2
|
|
10
10
|
|
|
11
11
|
protected
|
|
12
12
|
|
|
@@ -21,8 +21,10 @@ module Modulorails
|
|
|
21
21
|
private
|
|
22
22
|
|
|
23
23
|
def create_hook_executor
|
|
24
|
-
template '
|
|
25
|
-
chmod 'bin/
|
|
24
|
+
template 'dc.sh', 'bin/dc'
|
|
25
|
+
chmod 'bin/dc', 0o755
|
|
26
|
+
template 'dcr.sh', 'bin/dcr'
|
|
27
|
+
chmod 'bin/dcr', 0o755
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def create_refresh_generations_script
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Function to run the main docker command
|
|
4
|
+
run_command() {
|
|
5
|
+
local docker_args="$1"
|
|
6
|
+
|
|
7
|
+
# Build the docker command
|
|
8
|
+
local command="docker compose --project-name \"\$(basename \$(pwd))_devcontainer\" -f .devcontainer/compose.yml"
|
|
9
|
+
|
|
10
|
+
# Execute the command with additional arguments
|
|
11
|
+
eval "$command $docker_args"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
main() {
|
|
15
|
+
# Check for apk command to determine if we're in an Alpine Linux container
|
|
16
|
+
if ! command -v apk >/dev/null 2>&1; then
|
|
17
|
+
# Escape arguments and pass them to the docker command
|
|
18
|
+
local escaped_args=()
|
|
19
|
+
for arg in "$@"; do
|
|
20
|
+
escaped_args+=("$(printf '%q' "$arg")")
|
|
21
|
+
done
|
|
22
|
+
run_command "${escaped_args[*]}"
|
|
23
|
+
else
|
|
24
|
+
# Execute the given arguments without wrapping
|
|
25
|
+
exec "$@"
|
|
26
|
+
fi
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# Pass all the script's arguments to the main function
|
|
30
|
+
main "$@"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Function to run the main docker command
|
|
4
|
+
run_command() {
|
|
5
|
+
local docker_args="$1"
|
|
6
|
+
|
|
7
|
+
# Get Git configuration
|
|
8
|
+
local git_email
|
|
9
|
+
git_email=$(git config --get user.email)
|
|
10
|
+
local git_name
|
|
11
|
+
git_name=$(git config --get user.name)
|
|
12
|
+
|
|
13
|
+
# Check if the shell is a TTY
|
|
14
|
+
local tty_option
|
|
15
|
+
if [ -t 1 ]; then
|
|
16
|
+
tty_option='-ti'
|
|
17
|
+
else
|
|
18
|
+
tty_option=''
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Build the docker command
|
|
22
|
+
local command="docker compose -f .devcontainer/compose.yml build && \
|
|
23
|
+
docker compose --project-name \"\$(basename \$(pwd))_devcontainer\" -f .devcontainer/compose.yml run --rm $tty_option \
|
|
24
|
+
-e \"GIT_AUTHOR_EMAIL=$git_email\" -e \"GIT_AUTHOR_NAME=$git_name\" \
|
|
25
|
+
-e \"GIT_COMMITTER_EMAIL=$git_email\" -e \"GIT_COMMITTER_NAME=$git_name\" app"
|
|
26
|
+
|
|
27
|
+
# Execute the command with additional arguments
|
|
28
|
+
eval "$command $docker_args"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
main() {
|
|
32
|
+
# Check for apk command to determine if we're in an Alpine Linux container
|
|
33
|
+
if ! command -v apk >/dev/null 2>&1; then
|
|
34
|
+
# Escape arguments and pass them to the docker command
|
|
35
|
+
local escaped_args=()
|
|
36
|
+
for arg in "$@"; do
|
|
37
|
+
escaped_args+=("$(printf '%q' "$arg")")
|
|
38
|
+
done
|
|
39
|
+
run_command "${escaped_args[*]}"
|
|
40
|
+
else
|
|
41
|
+
# Execute the given arguments without wrapping
|
|
42
|
+
exec "$@"
|
|
43
|
+
fi
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Pass all the script's arguments to the main function
|
|
47
|
+
main "$@"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
exec ./bin/
|
|
2
|
+
exec ./bin/dc ./bin/refresh_generations
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
bundle install
|
|
5
|
-
git add Gemfile.lock
|
|
3
|
+
modified_files=$(git diff --cached --name-only)
|
|
6
4
|
|
|
7
|
-
if
|
|
5
|
+
if echo "$modified_files" | grep -q "Gemfile.lock"
|
|
6
|
+
then
|
|
7
|
+
echo 'Regenerate Gemfile.lock'
|
|
8
|
+
bundle install
|
|
9
|
+
git add Gemfile.lock
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if [ "$(cat Gemfile.lock | grep i18n-js | wc -l)" -gt 0 ] && echo "$modified_files" | grep -q "translations.js"
|
|
8
13
|
then
|
|
9
14
|
echo 'Regenerate JS translations'
|
|
10
15
|
rake i18n:js:export
|
|
11
16
|
git add app/assets/javascripts/i18n/translations.js
|
|
12
17
|
fi
|
|
13
18
|
|
|
14
|
-
echo
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
if echo "$modified_files" | grep -q "schema.rb"
|
|
20
|
+
then
|
|
21
|
+
echo 'Regenerate DB schema'
|
|
22
|
+
export RAILS_ENV=test
|
|
23
|
+
bundle exec rake db:drop db:create db:schema:load db:migrate
|
|
24
|
+
git add db/schema.rb
|
|
25
|
+
export RAILS_ENV=development
|
|
26
|
+
fi
|
|
19
27
|
|
|
20
28
|
if [ "$(git diff --cached --name-only | wc -l)" -ne 0 ]; then
|
|
21
29
|
echo "Commit regenerated files by $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"
|
|
@@ -4,13 +4,18 @@ require 'modulorails/generators/base'
|
|
|
4
4
|
|
|
5
5
|
class Modulorails::GitlabciGenerator < Modulorails::Generators::Base
|
|
6
6
|
|
|
7
|
-
VERSION =
|
|
7
|
+
VERSION = 2
|
|
8
8
|
|
|
9
9
|
desc 'This generator creates a template for a .gitlab-ci.yml file at root'
|
|
10
10
|
|
|
11
11
|
protected
|
|
12
12
|
|
|
13
13
|
def create_config
|
|
14
|
+
Modulorails.deprecator.warn(<<~MESSAGE)
|
|
15
|
+
Modulorails::GitlabciGenerator is deprecated and will be removed in version 2.0.
|
|
16
|
+
Use Moduloproject 3.0 (available later) to initialize new projects with GitLab CI configuration.
|
|
17
|
+
MESSAGE
|
|
18
|
+
|
|
14
19
|
remove_old_keepfile('.modulorails-gitlab-ci')
|
|
15
20
|
remove_old_keepfile('.modulorails-gitlabci')
|
|
16
21
|
|
|
@@ -24,6 +29,7 @@ class Modulorails::GitlabciGenerator < Modulorails::Generators::Base
|
|
|
24
29
|
|
|
25
30
|
# Update the gitlab-ci template
|
|
26
31
|
template '.gitlab-ci.yml'
|
|
32
|
+
template 'bin/test.sh', 'bin/test'
|
|
27
33
|
template 'config/deploy/production.yaml' if @production_url.present?
|
|
28
34
|
template 'config/deploy/staging.yaml' if @staging_url.present?
|
|
29
35
|
template 'config/deploy/review.yaml' if @review_base_url.present?
|
|
@@ -7,16 +7,6 @@ include:
|
|
|
7
7
|
|
|
8
8
|
variables:
|
|
9
9
|
IMAGE_NAME: <%= @image_name %>
|
|
10
|
-
<%- if @adapter =~ /mysql/ -%>
|
|
11
|
-
MYSQL_DATABASE: <%= @image_name %>_test
|
|
12
|
-
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
|
|
13
|
-
<%= @environment_name %>_DATABASE_HOST: mysql
|
|
14
|
-
<%- else -%>
|
|
15
|
-
POSTGRES_DB: <%= @image_name %>_test
|
|
16
|
-
POSTGRES_USER: postgres
|
|
17
|
-
POSTGRES_PASSWORD: postgres
|
|
18
|
-
<%= @environment_name %>_DATABASE_HOST: postgres
|
|
19
|
-
<%- end -%>
|
|
20
10
|
|
|
21
11
|
stages:
|
|
22
12
|
- test
|
|
@@ -25,6 +15,8 @@ stages:
|
|
|
25
15
|
|
|
26
16
|
build_integration_image:
|
|
27
17
|
extends: .build_integration_image
|
|
18
|
+
variables:
|
|
19
|
+
DOCKERFILE: .devcontainer/Dockerfile
|
|
28
20
|
|
|
29
21
|
test:
|
|
30
22
|
extends: .test
|
|
@@ -37,13 +29,23 @@ test:
|
|
|
37
29
|
- redis:7-alpine
|
|
38
30
|
variables:
|
|
39
31
|
RAILS_ENV: test
|
|
32
|
+
<%- if @adapter =~ /mysql/ -%>
|
|
33
|
+
MYSQL_DATABASE: <%= @image_name %>-test
|
|
34
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
|
|
35
|
+
DATABASE_TEST_URL: 'mysql2://root@mysql/<%= @image_name %>-test'
|
|
36
|
+
<%- else -%>
|
|
37
|
+
POSTGRES_DB: <%= @image_name %>-test
|
|
38
|
+
POSTGRES_USER: postgres
|
|
39
|
+
POSTGRES_PASSWORD: postgres
|
|
40
|
+
DATABASE_TEST_URL: 'postgresql://postgres:postgres@postgres/<%= @image_name %>-test'
|
|
41
|
+
<%- end -%>
|
|
40
42
|
script:
|
|
41
|
-
-
|
|
42
|
-
- bundle exec rake db:migrate:reset
|
|
43
|
-
- bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml
|
|
43
|
+
- bin/test
|
|
44
44
|
|
|
45
45
|
docker_build:
|
|
46
46
|
extends: .docker_buildx_push
|
|
47
|
+
variables:
|
|
48
|
+
DOCKERFILE: Dockerfile
|
|
47
49
|
only:
|
|
48
50
|
- merge_requests
|
|
49
51
|
- staging
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
export RAILS_ENV=test
|
|
4
|
+
|
|
5
|
+
if ! grep -q rspec Gemfile
|
|
6
|
+
then
|
|
7
|
+
echo 'Install RSpec and add some tests:'
|
|
8
|
+
echo ' bundle add rspec-rails rspec_junit_formatter'
|
|
9
|
+
echo ' bundle exec rails generate rspec:install'
|
|
10
|
+
exit 0
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
if [ -z "$1" ]
|
|
14
|
+
then
|
|
15
|
+
bundle exec rake db:drop db:create db:schema:load db:migrate
|
|
16
|
+
<%- case @js_engine -%>
|
|
17
|
+
<%- when :webpacker -%>
|
|
18
|
+
bundle exec yarn install
|
|
19
|
+
bundle exec rails webpacker:compile
|
|
20
|
+
<%- when :bun -%>
|
|
21
|
+
bun install
|
|
22
|
+
bun run build
|
|
23
|
+
bun run build:css
|
|
24
|
+
<%- end -%>
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [ -z "$CI" ]
|
|
28
|
+
then
|
|
29
|
+
# For dev environment, we use the options specified in `.rspec` file
|
|
30
|
+
bundle exec rspec --profile "$@"
|
|
31
|
+
elif grep -q rspec_junit_formatter Gemfile
|
|
32
|
+
then
|
|
33
|
+
bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml --profile "$@"
|
|
34
|
+
else
|
|
35
|
+
bundle exec rspec --format progress --profile "$@"
|
|
36
|
+
fi
|
|
@@ -18,9 +18,9 @@ ingress:
|
|
|
18
18
|
resources:
|
|
19
19
|
requests:
|
|
20
20
|
cpu: 100m
|
|
21
|
-
memory:
|
|
21
|
+
memory: 1024Mi
|
|
22
22
|
limits:
|
|
23
|
-
memory:
|
|
23
|
+
memory: 1024Mi
|
|
24
24
|
|
|
25
25
|
autoscaling:
|
|
26
26
|
enabled: true
|
|
@@ -47,10 +47,10 @@ sidekiq:
|
|
|
47
47
|
# resources:
|
|
48
48
|
# requests:
|
|
49
49
|
# cpu: 100m
|
|
50
|
-
# memory:
|
|
50
|
+
# memory: 1024Mi
|
|
51
51
|
# limits:
|
|
52
52
|
# cpu: 100m
|
|
53
|
-
# memory:
|
|
53
|
+
# memory: 1024Mi
|
|
54
54
|
# autoscaling:
|
|
55
55
|
# enabled: true
|
|
56
56
|
# minReplicas: 1
|
|
@@ -18,9 +18,9 @@ ingress:
|
|
|
18
18
|
resources:
|
|
19
19
|
requests:
|
|
20
20
|
cpu: 100m
|
|
21
|
-
memory:
|
|
21
|
+
memory: 1024Mi
|
|
22
22
|
limits:
|
|
23
|
-
memory:
|
|
23
|
+
memory: 1024Mi
|
|
24
24
|
|
|
25
25
|
autoscaling:
|
|
26
26
|
enabled: true
|
|
@@ -46,10 +46,10 @@ sidekiq:
|
|
|
46
46
|
# resources:
|
|
47
47
|
# requests:
|
|
48
48
|
# cpu: 100m
|
|
49
|
-
# memory:
|
|
49
|
+
# memory: 1024Mi
|
|
50
50
|
# limits:
|
|
51
51
|
# cpu: 100m
|
|
52
|
-
# memory:
|
|
52
|
+
# memory: 1024Mi
|
|
53
53
|
# autoscaling:
|
|
54
54
|
# enabled: true
|
|
55
55
|
# minReplicas: 1
|
|
@@ -18,14 +18,14 @@ ingress:
|
|
|
18
18
|
resources:
|
|
19
19
|
requests:
|
|
20
20
|
cpu: 100m
|
|
21
|
-
memory:
|
|
21
|
+
memory: 1024Mi
|
|
22
22
|
limits:
|
|
23
|
-
memory:
|
|
23
|
+
memory: 1024Mi
|
|
24
24
|
|
|
25
25
|
autoscaling:
|
|
26
26
|
enabled: true
|
|
27
27
|
minReplicas: 1
|
|
28
|
-
maxReplicas:
|
|
28
|
+
maxReplicas: 2
|
|
29
29
|
targetCPUUtilizationPercentage: 80
|
|
30
30
|
|
|
31
31
|
database:
|
|
@@ -42,16 +42,16 @@ redis:
|
|
|
42
42
|
enabled: true
|
|
43
43
|
|
|
44
44
|
sidekiq:
|
|
45
|
-
enabled:
|
|
45
|
+
enabled: false
|
|
46
46
|
# resources:
|
|
47
47
|
# requests:
|
|
48
48
|
# cpu: 100m
|
|
49
|
-
# memory:
|
|
49
|
+
# memory: 1024Mi
|
|
50
50
|
# limits:
|
|
51
51
|
# cpu: 100m
|
|
52
|
-
# memory:
|
|
52
|
+
# memory: 1024Mi
|
|
53
53
|
# autoscaling:
|
|
54
54
|
# enabled: true
|
|
55
55
|
# minReplicas: 1
|
|
56
|
-
# maxReplicas:
|
|
56
|
+
# maxReplicas: 2
|
|
57
57
|
# targetCPUUtilizationPercentage: 80
|
|
@@ -4,16 +4,21 @@ require 'rails/generators'
|
|
|
4
4
|
|
|
5
5
|
class Modulorails::ModuloprojectGenerator < Modulorails::Generators::Base
|
|
6
6
|
|
|
7
|
-
VERSION =
|
|
7
|
+
VERSION = 2
|
|
8
8
|
|
|
9
9
|
desc 'This generator creates templates for Moduloproject'
|
|
10
10
|
|
|
11
11
|
def create_config
|
|
12
|
+
Modulorails.deprecator.warn(<<~MESSAGE)
|
|
13
|
+
Modulorails::ModuloprojectGenerator is deprecated and will be removed in version 2.0.
|
|
14
|
+
This generator will be moved to Moduloproject 3.0 (available later).
|
|
15
|
+
MESSAGE
|
|
16
|
+
|
|
12
17
|
remove_old_keepfile(".modulorails-#{generator_name}")
|
|
13
|
-
template 'config/environments/production.rb'
|
|
18
|
+
template 'config/environments/production.rb', force: true
|
|
14
19
|
copy_file('config/environments/production.rb', 'config/environments/staging.rb')
|
|
15
20
|
update_application_rb
|
|
16
|
-
create_file('config/locales/fr.yml', "
|
|
21
|
+
create_file('config/locales/fr.yml', "fr: {}\n")
|
|
17
22
|
rescue StandardError => e
|
|
18
23
|
warn("[Modulorails] Error: cannot generate Moduloproject configuration: #{e.message}")
|
|
19
24
|
end
|
data/lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt
CHANGED
|
@@ -6,55 +6,25 @@ Rails.application.configure do
|
|
|
6
6
|
# Code is not reloaded between requests.
|
|
7
7
|
config.enable_reloading = false
|
|
8
8
|
|
|
9
|
-
# Eager load code on boot
|
|
10
|
-
# your application in memory, allowing both threaded web servers
|
|
11
|
-
# and those relying on copy on write to perform better.
|
|
12
|
-
# Rake tasks automatically ignore this option for performance.
|
|
9
|
+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
|
13
10
|
config.eager_load = true
|
|
14
11
|
|
|
15
|
-
#
|
|
16
|
-
# config.eager_load_paths += %W[
|
|
17
|
-
# #{config.root}/lib/constraints
|
|
18
|
-
# ]
|
|
19
|
-
|
|
20
|
-
# Full error reports are disabled and caching is turned on.
|
|
12
|
+
# Full error reports are disabled.
|
|
21
13
|
config.consider_all_requests_local = false
|
|
22
|
-
config.action_controller.perform_caching = true
|
|
23
|
-
|
|
24
|
-
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
|
25
|
-
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
|
26
|
-
# config.require_master_key = true
|
|
27
|
-
|
|
28
|
-
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
|
|
29
|
-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
|
30
14
|
|
|
31
|
-
#
|
|
32
|
-
|
|
15
|
+
# Turn on fragment caching in view templates.
|
|
16
|
+
config.action_controller.perform_caching = true
|
|
33
17
|
|
|
34
|
-
#
|
|
35
|
-
config.
|
|
18
|
+
# Cache assets for far-future expiry since they are all digest stamped.
|
|
19
|
+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
|
36
20
|
|
|
37
21
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
38
22
|
# config.asset_host = "http://assets.example.com"
|
|
39
23
|
|
|
40
|
-
# Specifies the header that your server uses for sending files.
|
|
41
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
|
42
|
-
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
|
43
|
-
|
|
44
24
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
45
25
|
config.active_storage.service = :local
|
|
46
26
|
|
|
47
|
-
# Mount Action Cable outside main process or domain.
|
|
48
|
-
# config.action_cable.mount_path = nil
|
|
49
|
-
# host = URI(ENV.fetch('URL', 'http://localhost:3000/')).host
|
|
50
|
-
# config.action_cable.url = "wss://#{host}/cable"
|
|
51
|
-
# config.action_cable.disable_request_forgery_protection = true
|
|
52
|
-
# config.action_cable.allowed_request_origins = [
|
|
53
|
-
# %r{(https|wss)://host}
|
|
54
|
-
# ]
|
|
55
|
-
|
|
56
27
|
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
57
|
-
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
|
58
28
|
config.assume_ssl = true
|
|
59
29
|
|
|
60
30
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
@@ -63,27 +33,26 @@ Rails.application.configure do
|
|
|
63
33
|
# Skip http-to-https redirect for the default health check endpoint.
|
|
64
34
|
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
|
65
35
|
|
|
66
|
-
# Log to STDOUT
|
|
36
|
+
# Log to STDOUT with the current request id as a default log tag.
|
|
37
|
+
config.log_tags = [ :request_id ]
|
|
67
38
|
config.logger = ActiveSupport::Logger.new(STDOUT)
|
|
68
39
|
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
|
69
40
|
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
|
70
41
|
|
|
71
|
-
#
|
|
72
|
-
config.log_tags = [:request_id]
|
|
73
|
-
|
|
74
|
-
# Info include generic and useful information about system operation, but avoids logging too much
|
|
75
|
-
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
|
76
|
-
# want to log everything, set the level to "debug".
|
|
42
|
+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
|
77
43
|
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
78
44
|
|
|
79
|
-
#
|
|
45
|
+
# Prevent health checks from clogging up the logs.
|
|
46
|
+
config.silence_healthcheck_path = "/up"
|
|
47
|
+
|
|
48
|
+
# Don't log any deprecations.
|
|
49
|
+
config.active_support.report_deprecations = false
|
|
50
|
+
|
|
51
|
+
# Use Redis as a cache store
|
|
80
52
|
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'], expires_in: 6.hours }
|
|
81
53
|
|
|
82
|
-
#
|
|
54
|
+
# Replace the default in-process and non-durable queuing backend for Active Job.
|
|
83
55
|
# config.active_job.queue_adapter = :sidekiq
|
|
84
|
-
# config.active_job.queue_name_prefix = "<%= Modulorails.data.rails_name.underscore %>_production"
|
|
85
|
-
|
|
86
|
-
config.action_mailer.perform_caching = false
|
|
87
56
|
|
|
88
57
|
# Ignore bad email addresses and do not raise email delivery errors.
|
|
89
58
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
@@ -93,17 +62,18 @@ Rails.application.configure do
|
|
|
93
62
|
# the I18n.default_locale when a translation cannot be found).
|
|
94
63
|
config.i18n.fallbacks = true
|
|
95
64
|
|
|
96
|
-
# Don't log any deprecations.
|
|
97
|
-
config.active_support.report_deprecations = false
|
|
98
|
-
|
|
99
65
|
# Do not dump schema after migrations.
|
|
100
66
|
config.active_record.dump_schema_after_migration = false
|
|
101
67
|
|
|
68
|
+
# Only use :id for inspections in production.
|
|
69
|
+
config.active_record.attributes_for_inspect = [ :id ]
|
|
70
|
+
|
|
102
71
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
103
72
|
# config.hosts = [
|
|
104
73
|
# "example.com", # Allow requests from example.com
|
|
105
74
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
106
75
|
# ]
|
|
76
|
+
#
|
|
107
77
|
# Skip DNS rebinding protection for the default health check endpoint.
|
|
108
78
|
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
109
79
|
end
|