instructure / canvas-lms

The open LMS by Instructure, Inc.
https://github.com/instructure/canvas-lms/wiki
GNU Affero General Public License v3.0
5.45k stars 2.44k forks source link

./script/docker_dev_setup.sh on linux #2095

Open sijpkes opened 1 year ago

sijpkes commented 1 year ago

Summary:

Script fails an throws numerous errors on Ubuntu 22.04, it also takes my network down every time. I think it has something to do with dory but I'm not familiar with docker so it's beyond me.

Steps to reproduce:

  1. Run the ./script_dev_setup.sh on Ubuntu 22.04.1 LTS

Additional notes:

Script output


> 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...
OK to run 'dory up'? [y/n] y
docker: Error response from daemon: driver failed programming external connectivity on endpoint dory_dinghy_http_proxy (28c3f017c60a27caca9667ef20c73ae0dca41ef76d78da0034263eab8ba01ff1): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.
Failed to start docker container 'dory_dinghy_http_proxy' .  Command 'docker run -d -p 80:80 -p 443:443  -v /var/run/docker.sock:/tmp/docker.sock -e 'CONTAINER_NAME=dory_dinghy_http_proxy' --name 'dory_dinghy_http_proxy' freedomben/dory-http-proxy:2.5.9.1' failed
Error starting nginx proxy
docker: Error response from daemon: driver failed programming external connectivity on endpoint dory_dnsmasq (2c588d0294c2db4d5420d3e0c11ac14bf82f528e2f3332660c1d2ff68a22e251): Error starting userland proxy: listen tcp4 0.0.0.0:53: bind: address already in use.
Ardena commented 1 year ago

I know the engineers who work on Linux do not use Dory with Canvas. I believe they use something called Traefik instead. Dory is based on dinghy-http-proxy, which as far as I know only works with MacOS. We don't have a lot of engineers who work on Linux, so the setup script is very biased toward Mac usage.

Instead of using the script, you might want to try the Quick Start guide instead (assuming you're doing this locally. The production start guide is different and doesn't use Dory, but If you're doing that, I definitely don't think the setup script is what you want).

mike32jacobs commented 1 year ago

@sijpkes, I am having the same issue. I am trying to install Canvas on a remote server (vultr: Ubuntu 22.04 x64). I am wondering if you found a solution to the issue. script output:

> 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

@Ardena , You say that you know that Canvas engineers don't use dory. The script tells us that it is optional. Would you recommend skipping it? I had previously run the script and I got this 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.
Ardena commented 1 year ago

In working more with the script myself this week, I noticed it does have a strong preference for dory. I know that some of variables and config files are set up to work better with dory or dinghy http proxy, but I don't use Linux and am not sure of the set up for Linux. For @sijpkes if it's taking your network down, I would recommend skipping dory and just the script run. I personally ran into issues with pieces of puma dev listening on the ports I was trying to set up with dinghy http proxy and getting in the way, and it sounds like you may be having something similar. If you have previously set up any other proxying software, it seems likely that it would be conflicting and causing issues. I'm not familiar with Linux, though, so you're a bit on your own for troubleshooting that part.

@mike32jacobs your issue is a little different. It looks like you've probably installed Dory at some point in the past, but it's not starting up correctly now. For you, I'd probably try making sure the gem is installed to your current Ruby and trying it again. Or you can get rid of dory a bit more thoroughly and do your own http proxying some other way. I found from the script that it was checking type "dory" and that was still returning something for me, so I got rid of that file and it was able to bypass dory.

mike32jacobs commented 1 year ago

@Ardena Thanks for you response. I am not sure what you mean when you say "do your own http proxying some other way." Do you think I should try:

sudo apt remove dory

and then install something else? I am sorry if my question seems basic, but I am not sure where to start. Thanks for your time.

sijpkes commented 1 year ago

I know the engineers who work on Linux do not use Dory with Canvas. I believe they use something called Traefik instead. Dory is based on dinghy-http-proxy, which as far as I know only works with MacOS. We don't have a lot of engineers who work on Linux, so the setup script is very biased toward Mac usage.

Instead of using the script, you might want to try the Quick Start guide instead (assuming you're doing this locally. The production start guide is different and doesn't use Dory, but If you're doing that, I definitely don't think the setup script is what you want).

Thank you for this suggestion @Ardena, I've tried your suggestion (I finally got back to testing this today as I have other work I am busy on) but I really just wanted this setup to test LTI development and I wanted to have all the dockerized upload endpoints that are included with that. If I setup the production I believe I wouldn't have access to these endpoints (e.g. the Files upload area etc.).

cgravatt commented 1 year ago

Dory should work fine. I use it in the docker containerized setup on Ubuntu 22.04.2 LTS. The error you posted earlier suggests that dory failed because something is already using port 80. Check to see what you have running on port 80.

docker: Error response from daemon: driver failed programming external connectivity on endpoint dory_dinghy_http_proxy (28c3f017c60a27caca9667ef20c73ae0dca41ef76d78da0034263eab8ba01ff1): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use.
geet-h17 commented 8 months ago

same issue while running ./script/docker_dev_setup.sh

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

Checking Dependencies...

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

' /usr/local/bin/dory:25:in load': cannot load such file -- /var/lib/gems/3.1.0/gems/dory-1.2.0/bin/dory (LoadError) from /usr/local/bin/dory:25:in
'

Something went wrong with dory! Exiting script.

/o\ Something went wrong. Check /home/appsecdocker/canvas-lms/log/docker_dev_setup.log for details. appsecdocker@localhost:~/canvas-lms$

joecrop commented 7 months ago

The issue for me was that I installed dory with sudo gem install dory. This caused dory to only be executable by root.