FreedomBen / dory

Your development proxy for docker
MIT License
156 stars 24 forks source link

Installing Canvas using ./script/docker_dev_setup.sh but having an issue with dory #60

Open mike32jacobs opened 1 year ago

mike32jacobs commented 1 year ago

@FreedomBen I am wondering if you could help me figure out my issue. I am trying to install a development version of Canvas LMS using this Quick Start Guide. Input:

./script/docker_dev_setup.sh

The first time I ran it, I had the following output:

|\   ____\|\   __  \|\   ___  \|\  \    /  /|\   __  \|\   ____\
\ \  \___|\ \  \|\  \ \  \\ \  \ \  \  /  / | \  \|\  \ \  \___|_
 \ \  \    \ \   __  \ \  \\ \  \ \  \/  / / \ \   __  \ \_____  \
  \ \  \____\ \  \ \  \ \  \\ \  \ \    / /   \ \  \ \  \|____|\  \
   \ \_______\ \__\ \__\ \__\\ \__\ \__/ /     \ \__\ \__\____\_\  \
    \|_______|\|__|\|__|\|__| \|__|\|__|/       \|__|\|__|\_________\
                                                         \|_________|

Welcome! This script will guide you through the process of setting up a
Canvas development environment.
  Log file is /home/mike/canvas-lms/log/docker_dev_setup.log

> It looks like you're using Linux. Let's set that up.

> Checking Dependencies...
script/common/utils/common.sh: line 159: ((: 0
0
0
0 : syntax error in expression (error token is "0
0
0 ")
        Canvas recommends using dory for a reverse proxy allowing you to
        access canvas at http://canvas.docker. Detailed instructions
        are available at https://github.com/FreedomBen/dory.
        If you want to install it, run 'gem install dory' then rerun this script.
Would you like to skip dory? [y/n] n
Install dory then rerun this script.

So, I stalled dory and ran the script again. Input:

./script/docker_dev_setup.sh

Output after installing dory:


  ________  ________  ________   ___      ___ ________  ________
|\   ____\|\   __  \|\   ___  \|\  \    /  /|\   __  \|\   ____\
\ \  \___|\ \  \|\  \ \  \\ \  \ \  \  /  / | \  \|\  \ \  \___|_
 \ \  \    \ \   __  \ \  \\ \  \ \  \/  / / \ \   __  \ \_____  \
  \ \  \____\ \  \ \  \ \  \\ \  \ \    / /   \ \  \ \  \|____|\  \
   \ \_______\ \__\ \__\ \__\\ \__\ \__/ /     \ \__\ \__\____\_\  \
    \|_______|\|__|\|__|\|__| \|__|\|__|/       \|__|\|__|\_________\
                                                         \|_________|

Welcome! This script will guide you through the process of setting up a
Canvas development environment.
  Log file is /home/mike/canvas-lms/log/docker_dev_setup.log

> It looks like you're using Linux. Let's set that up.

> Checking Dependencies...
script/common/utils/common.sh: line 159: ((: 0
0
0
0 : syntax error in expression (error token is "0
0
0 ")

> Starting dory...
/usr/local/bin/dory:25:in `load': cannot load such file -- /var/lib/gems/3.0.0/gems/dory-1.2.0/bin/dory (LoadError)
        from /usr/local/bin/dory:25:in `<main>'
/usr/local/bin/dory:25:in `load': cannot load such file -- /var/lib/gems/3.0.0/gems/dory-1.2.0/bin/dory (LoadError)
        from /usr/local/bin/dory:25:in `<main>'

> Something went wrong with dory! Exiting script.

  /o\ Something went wrong. Check /home/mike/canvas-lms/log/docker_dev_setup.log for details.

I am wondering if you have any ideas. I keep running into a wall, so I thought you would be the person who could help.

FreedomBen commented 1 year ago

It looks like there's a syntax error in script/common/utils/common.sh , although it's not clear if that is relevant to the dory failure.

Unfortunately that's a tough one. How did you install ruby? Did you use the system package manager (like apt or dnf) or did you use something like chruby ?

mike32jacobs commented 1 year ago

I used apt.

mike32jacobs commented 1 year ago

Here is the function where the syntax error appears to be taking place.

function check_dependencies {
  message "Checking Dependencies..."
  missing_packages=()
  wrong_version=()
  IFS=',' read -r -a DEPS <<< "$dependencies"
  for dependency in "${DEPS[@]}"; do
    IFS=' ' read -r -a dep <<< "$dependency"
    if ! installed "${dep[0]}"; then
      missing_packages+=("$dependency")
      continue
    fi
    if [[ ${#dep[@]} -gt 1 ]]; then
      version=$(eval "${dep[0]}" version |grep -oE "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")
      if (( $(echo "$version ${dep[1]}" | awk '{print ($1 < $2)}') )); then
        wrong_version+=("$dependency or higher. Found: ${dep[0]} $version.")
      fi
    fi
  done
  if [[ ${#missing_packages[@]} -gt 0 ]] || [[ ${#wrong_version[@]} -gt 0 ]]; then
    message "Some additional dependencies need to be installed before continuing."
    print_missing_dependencies
  fi
}

As far as the other error message goes:

/usr/local/bin/dory:25:in `load': cannot load such file -- /var/lib/gems/3.0.0/gems/dory-1.2.0/bin/dory (LoadError)
        from /usr/local/bin/dory:25:in `<main>'
/usr/local/bin/dory:25:in `load': cannot load such file -- /var/lib/gems/3.0.0/gems/dory-1.2.0/bin/dory (LoadError)
        from /usr/local/bin/dory:25:in `<main>'

I open this file and see:

#!/usr/bin/ruby3.0
#
# This file was generated by RubyGems.
#
# The application 'dory' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
  str = str.b[/\A_(.*)_\z/, 1]
  if str and Gem::Version.correct?(str)
    version = str
    ARGV.shift
  end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('dory', 'dory', version)
else
gem "dory", version
load Gem.bin_path("dory", "dory", version)
end

The error appears to be here:

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('dory', 'dory', version)
else
mike32jacobs commented 1 year ago

Potentially, the problem is the following path

/var/lib/gems/3.0.0/gems/dory-1.2.0/bin/dory

There is no directory entitled "dory-1.2.0". There is a file a somewhere close.

/var/lib/gems/3.0.0/dory-1.2.0.gem

I am wondering if you have any ideas, or if you think I should post this to other people on the forum. I appreciate your time.

drgrice1 commented 1 year ago

This same problem happens for me. Just run "dory status" to get the described issue. That is what the Canvas script/common/utils/dory_setup.sh file is trying to do. Note that it sources script/common/utils/common.sh, and that is what gives the syntac error, but it is not related to the actual issue.

If I instead run "sudo dory status" I get

[*] Nginx proxy:  Running as docker container dory_dinghy_http_proxy
[*] Dnsmasq:  Running as docker container dory_dnsmasq
[*] Resolv is not configured

Everything needs to be run via sudo it seems, but the Canvas scripts don't do that.

WillGreen commented 1 year ago

I'm seeing this same issue with the current version of Canvas LMS on Ubuntu 20.04. I'm using the system provided Ruby 2.7 installed with apt. I can also confirm I get the error if I run dory status without sudo.

Did anyone find a solution to this?

> Starting dory...
Traceback (most recent call last):
    1: from /usr/local/bin/dory:23:in `<main>'
/usr/local/bin/dory:23:in `load': cannot load such file -- /var/lib/gems/2.7.0/gems/dory-1.2.0/bin/dory (LoadError)
Traceback (most recent call last):
    1: from /usr/local/bin/dory:23:in `<main>'
/usr/local/bin/dory:23:in `load': cannot load such file -- /var/lib/gems/2.7.0/gems/dory-1.2.0/bin/dory (LoadError)
drscottlobo commented 1 year ago

I am having the same issue

berlin2123 commented 1 year ago

If sudo dory status seems ok, and sudo docker ps shows the dory_dinghy_http_proxy runs fine, you can just ignore the err massage by comment the exit 1 inside script/common/utils/dory_setup.sh file:

function start_dory {
  message 'Starting dory...'
  if sudo dory status | grep -q 'not running'; then
    confirm_command 'sudo dory up'
  elif ! sudo dory status; then
    message "Something went wrong with dory! Exiting script."
    #exit 1                                                           # comment this line to continue 
  else
    message 'Looks like dory is already running. Moving on...'
  fi
}
neilsf commented 7 months ago

What worked for me: