Pat James


200 Experience
0 Lessons Completed
0 Questions Solved


Posted in Deploy Ubuntu 22.04 Jammy Jellyfish Discussion

Running into problems Rails 7.0.4 with deploy

00:16 bundler:install
The Gemfile's dependencies are satisfied, skipping installation
00:16 deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 rake aborted!
01 ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage

scratching at straws

Yarn init and Yarn install OK

yarn --version

all look ok

package.json there

ssh into server and ran
$HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
as per
Viktor Smári 1,790 XP · on Apr 26, 2022 suggestion.

Could not locate Gemfile or .bundle/ directory

echo $PATH

ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux]
Bundler version 2.4.3
which bundler

rbenv local

as you can see from above the capistrano reports that the gems are installed also
gem env
RubyGems Environment:

  • RUBY VERSION: 3.2.0 (2022-12-25 patchlevel 0) [x86_64-linux]
  • INSTALLATION DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0
  • USER INSTALLATION DIRECTORY: /home/deploy/.local/share/gem/ruby/3.2.0
  • RUBY EXECUTABLE: /home/deploy/.rbenv/versions/3.2.0/bin/ruby
  • GIT EXECUTABLE: /usr/bin/git
  • EXECUTABLE DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/bin
  • SPEC CACHE DIRECTORY: /home/deploy/.local/share/gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /home/deploy/.rbenv/versions/3.2.0/etc
    • ruby
    • x86_64-linux
    • /home/deploy/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0
    • /home/deploy/.local/share/gem/ruby/3.2.0
    • :update_sources => true
    • :verbose => true
    • :backtrace => true
    • :bulk_threshold => 1000
    • /home/deploy/.rbenv/versions/3.2.0/bin
    • /home/deploy/.rbenv/libexec
    • /home/deploy/.rbenv/plugins/ruby-build/bin
    • /home/deploy/.rbenv/plugins/rbenv-vars/bin
    • /home/deploy/.rbenv/plugins/ruby-build/bin
    • /home/deploy/.rbenv/shims
    • /home/deploy/.rbenv/bin
    • /usr/local/sbin
    • /usr/local/bin
    • /usr/sbin
    • /usr/bin
    • /sbin
    • /bin
    • /usr/games
    • /usr/local/games
    • /snap/bin

Posted in Deploy Ubuntu 22.04 Jammy Jellyfish Discussion

/home/deploy/myapp/.rbenv-vars, works, but just wondering if it is possible to get the same result with credentials.yml.enc .

Posted in How to use Devise with Hotwire & Turbo.js Discussion

As of Dec31 2022, Rails 7.0.4
"@hotwired/turbo-rails": "7.2.0" seems to work ok straight out of the box, so no need for "@hotwired/turbo":"",

However, I have to move the

 class DeviseTurboController < ApplicationController ...

Out of the devise initialiser and into its own app/controller/devise_turbo-controller.rb file

Posted in Devise User with separate Profile

After lots of searching this seems pretty simple, for example,
say I need three sign ins , one for admin, one for suppliers and one for members.

To create a login for say supplier run
rails generate devise supplier
This does three things.

  1. Adds routes
  2. Create a Supplier model or add the devise modules to an existing model
  3. Creates a migration to add the appropriate columns and indexes to your model.

Note: If you have an existing model that you want to us devise on, simple run the generator, it will do the above taking into account any existing columns such as email that may already be present in your model.

Posted in How to use ESBuild in Rails with JSBundling Discussion

I keep running into this issue when I run ./bin/dev
everything else seems to run

Error: Can't find stylesheet to import.
16:49:51 css.1 | ╷
16:49:51 css.1 | 1 │ @import 'bootstrap/scss/bootstrap';
16:49:51 css.1 | │
16:49:51 css.1 | ╵
16:49:51 css.1 | app/assets/stylesheets/application.bootstrap.scss 1:9 root stylesheet

Rails 7.0.4
Ruby ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
yarn 3.2.3
npm -v 8.19.1 not sure if this is even needed

/* Error: Can't find stylesheet to import.

  • ,
  • 1 | @import 'bootstrap/scss/bootstrap';
  • |
  • '
  • app/assets/stylesheets/application.bootstrap.scss 1:9 root stylesheet */

body::before {
font-family: "Source Code Pro", "SF Mono", Monaco, Inconsolata, "Fira Mono",
"Droid Sans Mono", monospace, monospace;
white-space: pre;
display: block;
padding: 1em;
margin-bottom: 1em;
border-bottom: 2px solid black;
content: "Error: Can't find stylesheet to import.\a \2577 \a 1 \2502 @import 'bootstrap/scss/bootstrap';\a \2502 \2575 \a app/assets/stylesheets/application.bootstrap.scss 1:9 root stylesheet";

any ideas

Oh and thanks for responding

Hey Austin,
I use digital ocean to host the production server,
but I have not been able to find the console,
Do you spin up a separate server for development, what text editor do you use?

I have been using cloud 9 and an IDE but was wondering if anyone is running an IDE on Digital Ocean

Posted in Deploy Ubuntu 20.04 Focal Fossa Discussion

Getting the error no running passenger app at /home/deploy/project-portalMK5/
the problem was in the
Change myapp to the name of your app. We'll use this same folder later on when we define our Capistrano deploy_to folder.

server {
listen 80;
listen [::]:80;

server_name _;
root /home/deploy/myapp/current/public; #bug was here should have been deploy not root

passenger_enabled on;
passenger_app_env production;

Posted in Deploy Ubuntu 20.04 Focal Fossa Discussion

I am unable to run the app in production
Your Ruby version is 2.7.0, but your Gemfile specified 3.1.2
however ruby -v
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
also deploy@agility:~/project-portalMK5/current$ rbenv versions

  • 3.1.2 (set by /home/deploy/project-portalMK5/current/.ruby-version) also Gemfile source "" git_source(:github) { |repo| "{repo}.git" } ruby "3.1.2" also also .ruby-version 3.1.2 I have spent hours getting nowhere, appreciate any help.

Posted in Deploy Ubuntu 22.04 Jammy Jellyfish Discussion

deploy failed with yarn install, however this stack-overflow solved my problem

ssh into the production server and ran
sudo apt remove cmdtest
sudo apt remove yarn
curl -sS | sudo apt-key add -
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y
yarn install

then proceeded with cap production deploy , now have production up and running

Hi Everyone,
Going through the process of setting up a new rails project
If I use rails new Rails generates a file importmap.rb in the config folder
If I use rails new -j esbuild —css bootstrap the install does not create the importmap.rb
Is there a work around for this.
Pat SY StellaAustralis