-
Notifications
You must be signed in to change notification settings - Fork 563
FEATURE ADDED - Integrated Docker development environment, works cross platform (including Windows!) #1818
base: master
Are you sure you want to change the base?
Conversation
@@ -13,6 +13,7 @@ vendor/bundle | |||
!/log/.keep | |||
/tmp | |||
/coverage | |||
yarn-error.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file came up in testing, and I realized it should be .gitignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments for clarity.
@@ -0,0 +1,45 @@ | |||
FROM ruby:2.4.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the docker file to build the docker image that will do the development. It starts with the base ruby image for the ruby version currently used in the project, but for easy forward compatibility it installs rbenv as well.
@@ -0,0 +1,2 @@ | |||
rails: ./bin/rails server -p 5000 -b 0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had to make a special procfile to get the binding right on rails. If there's a way to parse environment variables internally in the procfile we could do that here.
context: . | ||
dockerfile: Dockerfile-sc | ||
volumes: | ||
- .:/usr/src/app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.bundle and vendor are copied into the docker image, then not mounted back onto the host box. That way dependencies we shouldn't be editing don't clutter up the filesystem.
- /usr/src/app/vendor | ||
ports: | ||
- "5000:5000" | ||
entrypoint: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the dev environment simply opens a shell. Users attach to it and run script/setup and script/server etc just as they would for a native installation.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
@@ -111,11 +111,33 @@ GitHub Classroom is a [Ruby on Rails](http://rubyonrails.org/) application. | |||
|
|||
New to Ruby? No worries! You can follow these instructions to install a local server. | |||
|
|||
#### macOS | |||
#### Cross-platform option - Self-contained Docker Development Environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move the Docker setup instructions to their own file? The readme is getting a bit long with these additions.
# | ||
# bindadress bindport connectaddress connectport | ||
localhost 2345 postgresql 5432 | ||
localhost 9337 elasticsearch 9300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually aren't using elasticsearch anymore so this can be removed 🎉
environment: | ||
- SELFCONTAINED=true | ||
|
||
elasticsearch: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More elasticsearch config that can be removed 🎉 🎉
ENV PATH "$PATH:/root/.rbenv/bin" | ||
ENV PATH "$PATH:/root/.rbenv/shims" | ||
|
||
#not sure what this bug is, should probably try taking it out later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bug may be because we are using an older version of Ruby, and the container for that version is based on debian jessie which is no longer supported. Maybe this should be using a newer version (possibly alpine) instead.
#not sure what this bug is, should probably try taking it out later | ||
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list | ||
|
||
#install rbenv (though is this really necessary? Will try both ways.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image might be more efficient if we use the default Ruby that comes with the container rather than installing a different version. We're also hoping to upgrade to Ruby 2.6.3 in the nearish future which should make this process simpler.
As a note we've updated Ruby to 2.6.4. It might make things easier (more modern distros available) |
I won't be able to play with this for a while, unfortunately, as the school
year has started and my time spent USING github classroom has increased
while my time spent THINKING about it has shrunk. I still want to use this
environment to develop some more classroom features, but it might be next
summer before I can find the time again.
…On Mon, Sep 16, 2019 at 8:20 PM Jeff Rafter ***@***.***> wrote:
As a note we've updated Ruby to 2.6.4. It might make things easier (more
modern distros available)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1818>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALWSINRVIQWYG2OQ6UJUNJLQKAIEZANCNFSM4HKQD7BQ>
.
|
As a windows user, Ruby work is hard for me, so I decided to expand the already-existing docker component of this project into an optional self-contained dev environment that allows me to do everything, including the ruby and rails work itself, in docker. It was a bigger project than I expected, but it now works very smoothly on my Windows machine, and could provide a nice entryway to developing on this for both Windows users and users who simply don't want to deal with a native ruby install.
I will leave comments explaining the elements briefly.