From f27da88acc5f77885bb9dc42567b8eabb8789814 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 14:50:48 +0200 Subject: [PATCH 1/6] only ignore vendor/bundle - we now have files in vendor we need --- .dockerignore | 3 ++- .gitignore | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index dda9a6cd..907eb5b0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,7 @@ .bundle/ .dockerignore .git/ +.github/ .gitignore .vagrant/ db/*.sqlite3 @@ -8,4 +9,4 @@ docker-compose.yml Gemfile.lock node_modules/ screenshots/ -vendor/ +vendor/bundle diff --git a/.gitignore b/.gitignore index 5b801045..f0ff9336 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # Ignore bundler config. /.bundle /.vendor +/vendor/bundle # Ignore the default SQLite database. /db/*.sqlite3 From dbe44f106fb49551b137bdaec02cee6ee6eefd5e Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 14:52:06 +0200 Subject: [PATCH 2/6] update docker build - remove build container, we dont need this anymore - no yarn, no nodejs --- Dockerfile | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index c53ee6c4..e082d192 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,3 @@ -FROM ruby:3.1.2-alpine as build - -ENV APP_HOME /hdm -WORKDIR $APP_HOME - -COPY . $APP_HOME -COPY config/hdm.yml.template $APP_HOME/config/hdm.yml - FROM ruby:3.1.2-alpine RUN apk add --update --no-cache \ @@ -24,14 +16,18 @@ RUN apk add --update --no-cache \ sqlite-dev \ # not needed for gems, but for runtime git \ - # yarn \ # works without this but produces a short error, that yarn is not found tzdata -RUN gem install bundler -v 2.3.11 +# RUN gem install bundler -v 2.3.11 + +ENV APP_HOME /hdm +WORKDIR $APP_HOME + +COPY . $APP_HOME +COPY config/hdm.yml.template $APP_HOME/config/hdm.yml -COPY --from=build /hdm /hdm -WORKDIR /hdm +RUN bundle check || (bundle config set --local without 'test' && bundle install) -RUN bundle check || bundle install --without test +EXPOSE 3000 CMD ["/hdm/bin/entry.sh"] From e680002b7945cb97f9501a38b3036afec98fa626 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 14:52:55 +0200 Subject: [PATCH 3/6] add mini_racer as JS engine --- Gemfile | 1 + Gemfile.lock | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Gemfile b/Gemfile index 4dd36d0a..d9e5feed 100644 --- a/Gemfile +++ b/Gemfile @@ -75,3 +75,4 @@ gem 'gitable', require: "gitable/uri" # dependencies & sec fixes # gem "nokogiri", ">= 1.13.2" # needs ruby >= 2.6.0 +gem 'mini_racer' # minimal Google V8 JS engine for execjs diff --git a/Gemfile.lock b/Gemfile.lock index 359fee4d..c5d1cfca 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,6 +145,9 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + libv8-node (16.10.0.0) + libv8-node (16.10.0.0-x86_64-darwin) + libv8-node (16.10.0.0-x86_64-linux) listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -162,6 +165,8 @@ GEM mime-types-data (3.2022.0105) mini_mime (1.1.2) mini_portile2 (2.8.0) + mini_racer (0.6.2) + libv8-node (~> 16.10.0.0) minitest (5.15.0) multi_json (1.15.0) multi_xml (0.6.0) @@ -359,6 +364,7 @@ DEPENDENCIES importmap-rails jquery-rails listen (~> 3.2) + mini_racer puma (~> 5.6) puppet puppetdb-ruby From 34f1ede510401d022598c8f680464dcc4ac55b1e Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 14:54:04 +0200 Subject: [PATCH 4/6] auto upgrade through db:migrate --- db/schema.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 003c0a70..9c34e2e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,15 +10,14 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[6.1].define(version: 2021_08_31_130006) do - +ActiveRecord::Schema[7.0].define(version: 2021_08_31_130006) do create_table "users", force: :cascade do |t| t.string "first_name" t.string "last_name" t.string "email" t.string "password_digest" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.boolean "admin", default: false, null: false t.index ["email"], name: "index_users_on_email", unique: true end From c8ed809cc7fb373861b0b46319cd4f6a36b506a4 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 14:54:27 +0200 Subject: [PATCH 5/6] fix loading issue if this file is missing in the manifests.js the app cannot run properly --- app/assets/config/manifest.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 31970504..bae6a19e 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -4,3 +4,4 @@ //= link_tree ../../../vendor/javascript .js //= link bootstrap //= link jquery +//= link application.css From 6247f74a4256a09870cc485702fbed4796eb1a08 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 14 Jun 2022 15:02:10 +0200 Subject: [PATCH 6/6] remove yarn and nodejs references --- .dockerignore | 1 - .gitignore | 7 ------- .rubocop_todo.yml | 6 ------ .tool-versions | 1 - .travis.yml | 3 --- MANUAL_INSTALL.md | 1 - 6 files changed, 19 deletions(-) diff --git a/.dockerignore b/.dockerignore index 907eb5b0..e62079b9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,6 +7,5 @@ db/*.sqlite3 docker-compose.yml Gemfile.lock -node_modules/ screenshots/ vendor/bundle diff --git a/.gitignore b/.gitignore index f0ff9336..0e777972 100644 --- a/.gitignore +++ b/.gitignore @@ -38,17 +38,10 @@ /public/packs /public/packs-test -/node_modules -/yarn-error.log -yarn-debug.log* -.yarn-integrity # macOS .DS_Store -# nodejs and yarn -package-lock.json - # HDM Settings /config/hdm.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 75ad05f8..8a413133 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -668,12 +668,6 @@ Style/SingleArgumentDig: Style/SpecialGlobalVars: EnforcedStyle: use_perl_names -# Offense count: 2 -# Cop supports --auto-correct. -Style/StderrPuts: - Exclude: - - 'bin/yarn' - # Offense count: 785 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. diff --git a/.tool-versions b/.tool-versions index 7ec2dbc2..7e402d08 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1 @@ ruby 2.5.3 -nodejs 12.14.0 diff --git a/.travis.yml b/.travis.yml index 504727c0..35ca81b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,14 +4,11 @@ rvm: 2.5.8 cache: bundler: true - yarn: true before_install: - yes | gem update --system --force - gem install bundler - - nvm install v14.16.0 install: - bundle install - - yarn install - cp config/hdm.yml.template config/hdm.yml diff --git a/MANUAL_INSTALL.md b/MANUAL_INSTALL.md index e8e6c732..ede6ca6a 100644 --- a/MANUAL_INSTALL.md +++ b/MANUAL_INSTALL.md @@ -33,7 +33,6 @@ As root do: bundle config set --local path 'vendor/bundle' bundle config set --local with 'development' bundle install - yarn install --check-files ### **Configure hdm**