Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

Dockerized this app #159

Closed
wants to merge 5 commits into from
Closed

Dockerized this app #159

wants to merge 5 commits into from

Conversation

jhsu802701
Copy link

I made the following changes:

@armahillo
Copy link
Contributor

What issue is this closing? Please tag the issue in the PR.

@jhsu802701
Copy link
Author

This pull request resolves issues #156 and #157 .

@NickSchimek
Copy link
Member

Does this support live reload? Otherwise, I believe one would have to rebuild the image each time to see changes in the browser while developing.

@jhsu802701
Copy link
Author

Live reload works. If you edit a page, you do NOT need to rebuild the Docker container - just refresh the browser.

That said, it takes no more than a few seconds to stop the Jekyll server with Ctrl-C, enter "bin/dserver" to restart it, and view the app in your browser again.

@NickSchimek
Copy link
Member

I tried to build the image, however it is not working.

➜  rubyforgood.org git:(dockerize) docker-compose up
Creating network "rubyforgoodorg_default" with the default driver
Creating volume "rubyforgoodorg_bundle_path" with default driver
Creating rubyforgoodorg_web_1 ... done
Attaching to rubyforgoodorg_web_1
web_1  | -------------------
web_1  | gem install bundler
web_1  | Successfully installed bundler-2.1.4
web_1  | 1 gem installed
web_1  | --------------
web_1  | bundle install
web_1  | There was an error while trying to write to
web_1  | `/home/winner/bundle/vendor/ruby/2.5.0`. It is likely that you need to grant
web_1  | write permissions for that path.
web_1  | ------------------------
web_1  | bundle exec jekyll build
web_1  | bundler: command not found: jekyll
web_1  | Install missing gem executables with `bundle install`
web_1  | -----------------------------
web_1  | Starting up the Jekyll server
web_1  | You can view this app in your local web browser at
web_1  | http://localhost:4000/
web_1  | bundler: command not found: jekyll
web_1  | Install missing gem executables with `bundle install`
rubyforgoodorg_web_1 exited with code 127

@NickSchimek
Copy link
Member

Live reload works. If you edit a page, you do NOT need to rebuild the Docker container - just refresh the browser.

With live reload, refreshing of the browser is automatically done. https://jekyllrb.com/news/2018/01/02/jekyll-3-7-0-released/

@jhsu802701
Copy link
Author

Nick: Does it work if you run "bin/dnuke" first to remove all Docker containers, images, and networks? What's your setup?

@jhsu802701
Copy link
Author

My screen output from /etc/os-release:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

My screen output from bin/dserver:

$ bin/dserver
Creating network "rubyforgoodorg_default" with the default driver
Building web
Step 1/4 : FROM ruby:2.5.8
2.5.8: Pulling from library/ruby
e4c3d3e4f7b0: Pull complete
101c41d0463b: Pull complete
8275efcd805f: Pull complete
751620502a7a: Pull complete
0a5e725150a2: Pull complete
8b056d478557: Pull complete
e385651c04a4: Pull complete
1998b3679b35: Pull complete
Digest: sha256:c790a101d80a26e058c5ebe20bdb8843cbed62cd60e4fb5bf4132943d6fa2688
Status: Downloaded newer image for ruby:2.5.8
 ---> b7280b81558d
Step 2/4 : RUN useradd -m -s /bin/bash -u 1000 winner
 ---> Running in 9a7330047764
Removing intermediate container 9a7330047764
 ---> 3b7b71bb8215
Step 3/4 : USER winner
 ---> Running in 8c30a0567f48
Removing intermediate container 8c30a0567f48
 ---> cfb28096210f
Step 4/4 : WORKDIR /home/winner/myapp
 ---> Running in 1b1d3e9b0634
Removing intermediate container 1b1d3e9b0634
 ---> f6742a6a9dce
Successfully built f6742a6a9dce
Successfully tagged rubyforgoodorg_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating rubyforgoodorg_web_1 ... done
Attaching to rubyforgoodorg_web_1
web_1  | -------------------
web_1  | gem install bundler
web_1  | Successfully installed bundler-2.1.4
web_1  | 1 gem installed
web_1  | --------------
web_1  | bundle install
web_1  | Using concurrent-ruby 1.1.7
web_1  | Using i18n 0.9.5
web_1  | Using minitest 5.14.2
web_1  | Using thread_safe 0.3.6
web_1  | Using tzinfo 1.2.7
web_1  | Using zeitwerk 2.4.0
web_1  | Using activesupport 6.0.3.3
web_1  | Using public_suffix 3.1.1
web_1  | Using addressable 2.7.0
web_1  | Using bundler 2.1.4
web_1  | Using coffee-script-source 1.11.1
web_1  | Using execjs 2.7.0
web_1  | Using coffee-script 2.4.1
web_1  | Using colorator 1.1.0
web_1  | Using ruby-enum 0.8.0
web_1  | Using commonmarker 0.17.13
web_1  | Using unf_ext 0.0.7.7
web_1  | Using unf 0.1.4
web_1  | Using simpleidn 0.1.1
web_1  | Using dnsruby 1.61.4
web_1  | Using eventmachine 1.2.7
web_1  | Using http_parser.rb 0.6.0
web_1  | Using em-websocket 0.5.2
web_1  | Using ffi 1.13.1
web_1  | Using ethon 0.12.0
web_1  | Using multipart-post 2.1.1
web_1  | Using faraday 1.0.1
web_1  | Using forwardable-extended 2.6.0
web_1  | Using gemoji 3.0.1
web_1  | Using sawyer 0.8.2
web_1  | Using octokit 4.18.0
web_1  | Using typhoeus 1.4.0
web_1  | Using github-pages-health-check 1.16.1
web_1  | Using rb-fsevent 0.10.4
web_1  | Using rb-inotify 0.10.1
web_1  | Using sass-listen 4.0.0
web_1  | Using sass 3.7.4
web_1  | Using jekyll-sass-converter 1.5.2
web_1  | Using listen 3.2.1
web_1  | Using jekyll-watch 2.2.1
web_1  | Using rexml 3.2.4
web_1  | Using kramdown 2.3.0
web_1  | Using liquid 4.0.3
web_1  | Using mercenary 0.3.6
web_1  | Using pathutil 0.16.2
web_1  | Using rouge 3.19.0
web_1  | Using safe_yaml 1.0.5
web_1  | Using jekyll 3.9.0
web_1  | Using jekyll-avatar 0.7.0
web_1  | Using jekyll-coffeescript 1.1.1
web_1  | Using jekyll-commonmark 1.3.1
web_1  | Using jekyll-commonmark-ghpages 0.1.6
web_1  | Using jekyll-default-layout 0.1.4
web_1  | Using jekyll-feed 0.13.0
web_1  | Using jekyll-gist 1.5.0
web_1  | Using jekyll-github-metadata 2.13.0
web_1  | Using mini_portile2 2.4.0
web_1  | Using nokogiri 1.10.10
web_1  | Using html-pipeline 2.14.0
web_1  | Using jekyll-mentions 1.5.1
web_1  | Using jekyll-optional-front-matter 0.3.2
web_1  | Using jekyll-paginate 1.1.0
web_1  | Using jekyll-readme-index 0.3.0
web_1  | Using jekyll-redirect-from 0.15.0
web_1  | Using jekyll-relative-links 0.6.1
web_1  | Using rubyzip 2.3.0
web_1  | Using jekyll-remote-theme 0.4.1
web_1  | Using jekyll-seo-tag 2.6.1
web_1  | Using jekyll-sitemap 1.4.0
web_1  | Using jekyll-swiss 1.0.0
web_1  | Using jekyll-theme-architect 0.1.1
web_1  | Using jekyll-theme-cayman 0.1.1
web_1  | Using jekyll-theme-dinky 0.1.1
web_1  | Using jekyll-theme-hacker 0.1.1
web_1  | Using jekyll-theme-leap-day 0.1.1
web_1  | Using jekyll-theme-merlot 0.1.1
web_1  | Using jekyll-theme-midnight 0.1.1
web_1  | Using jekyll-theme-minimal 0.1.1
web_1  | Using jekyll-theme-modernist 0.1.1
web_1  | Using jekyll-theme-primer 0.5.4
web_1  | Using jekyll-theme-slate 0.1.1
web_1  | Using jekyll-theme-tactile 0.1.1
web_1  | Using jekyll-theme-time-machine 0.1.1
web_1  | Using jekyll-titles-from-headings 0.5.3
web_1  | Using jemoji 0.11.1
web_1  | Using kramdown-parser-gfm 1.1.0
web_1  | Using minima 2.5.1
web_1  | Using unicode-display_width 1.7.0
web_1  | Using terminal-table 1.8.0
web_1  | Using github-pages 207
web_1  | Bundle complete! 1 Gemfile dependency, 90 gems now installed.
web_1  | Bundled gems are installed into `/home/winner/bundle/vendor`
web_1  | ------------------------
web_1  | bundle exec jekyll build
web_1  | Configuration file: /home/winner/myapp/_config.yml
web_1  |        Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.
web_1  |             Source: /home/winner/myapp
web_1  |        Destination: /home/winner/myapp/_site
web_1  |  Incremental build: disabled. Enable with --incremental
web_1  |       Generating... 
web_1  |                     done in 0.37 seconds.
web_1  |  Auto-regeneration: disabled. Use --watch to enable.
web_1  | -----------------------------
web_1  | Starting up the Jekyll server
web_1  | You can view this app in your local web browser at
web_1  | http://localhost:4000/
web_1  | Configuration file: /home/winner/myapp/_config.yml
web_1  |        Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.
web_1  |             Source: /home/winner/myapp
web_1  |        Destination: /home/winner/myapp/_site
web_1  |  Incremental build: disabled. Enable with --incremental
web_1  |       Generating... 
web_1  |                     done in 0.555 seconds.
web_1  |  Auto-regeneration: enabled for '/home/winner/myapp'
web_1  |     Server address: http://0.0.0.0:4000
web_1  |   Server running... press ctrl-c to stop.

@armahillo
Copy link
Contributor

Ref my comments in #156 -- This is a Jekyll repo deploying to GH pages. The related issue uses boilerplate "avoid 'works on my machine' problems" language but that has not been an identified issue with this one repo that is maintained by a handful of people... and deployed to GH pages.

If you want to add value, work through existing issues.

@jhsu802701
Copy link
Author

armahillo: What's the development process for this app? What's the onboarding process? How do you make sure that the build doesn't break when you make changes? I assumed that everyone who contributes to this app runs the build on his/her local machine.

Having the Gemfile.lock in .gitignore presents a problem for those of us trying to run this app on our local machines today. I guarantee that if you tried to move this app to a different production environment WITHOUT importing the old Gemfile.lock, you'd encounter the very same problems I am.

Because there's no Gemfile.lock file in the source code, running "bundle install" in a new setup defaults to the very latest version of each gem required by the github-pages gem. So version 2.4.0 of zeitwork is selected. Unfortunately, it's not compatible with Ruby 2.4.2 (specified for this app).

The .ruby-version file was last changed in October of 2017. The zeitwerk gem (which has always required Ruby version 2.4.4 or later) was first created in January 2019. So I'm guessing that the Gemfile.lock file in the production environment has been left unchanged for 2 to 3 years. The only entry in the Gemfile is github-pages with no version number specified. If you compare the production environment's Gemfile.lock file to mine, you'll find that the former uses a much older version of github-pages and doesn't have zeitwerk at all.

If you have this app on your local machine, and it still works, then it's been there for 2 to 3 years. Again, if you compare your Gemfile.lock file to mine, you'll find that yours uses much older versions of gems and doesn't have zeitwerk at all.

If you want to deploy this app elsewhere or git clone this app today, you have just two options:

  1. Use the old Gemfile.lock file from that unchanged working setup of 2 to 3 years ago. It's not in the source code.
  2. Update the Ruby version like I did in this pull request. Of course, you could end up in a similar predicament later if the Gemfile.lock file isn't part of the source code.

@jhsu802701
Copy link
Author

I guarantee that if you tried to add continuous integration with Travis CI or something similar right now, it would fail with Ruby 2.4.2. You'd have to upgrade to at least Ruby 2.4.4 to get the build to pass..

@jhsu802701
Copy link
Author

I'll create a special branch (containing a Dockerfile and docker-compose.yml file) for my own personal use. I'll provide a pull request that upgrades the Ruby version and adds the Gemfile.lock file to the source code.

@jhsu802701 jhsu802701 closed this Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants