KellyAH / friend-reminder-app

rails app thats reminds you to hang out with friends
0 stars 0 forks source link

feature: Create local dev setup script #3

Closed KellyAH closed 4 years ago

KellyAH commented 4 years ago

Problem

Neer couldn't get the dev enviroment app running in a docker container. Because her local and my local repo files were different and the dockerfile did not account for that. See https://github.com/KellyAH/friend-reminder-app/pull/1 for more info.

Fix

I did as Julian F. recommended and created a bash script that runs through all the setup steps.

Warning

The bind mount seems to be bi-directional so, some files will be auto copied to your local repo.

Such as these: files populated from the docker container

It seems to be mainly tmp files and the database which was created in the container when migration scripts are run and the server is started.

These files are ignored by git so they shouldn't be junking up the detected git changes.

If you prefer to now have this happen, please leave a comment so I can investigate how to avoid this.

Tests

Tested on my local by repeatedly deleting my local repo, pulling a fresh clone of it, and ran the script several times in a row:

You can test it by doing this:

  1. Go into the repo directory: cd [repo_name]
  2. run dev setup script: sh script/setup_dev_env.sh
  3. Once it's done, go to http://localhost:3000/friends and see the web page load.
  4. Edit the <h1>My Friends</h1> in app/views/friends/index.html.erb
  5. Refresh the webpage
  6. You should see your local changes reflected in the webpage
karolina-benitez commented 4 years ago

LGTM! I was able to make changes to the code & have it reflect in localhost

nirmalathapa commented 4 years ago

I ran the script and this is the error I received:
rails aborted! Errno::ENOENT: No such file or directory - bs_fetch:atomic_write_cache_file:chmod /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/compile_cache/iseq.rb:37:in fetch' /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/compile_cache/iseq.rb:37:inload_iseq' /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require' /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:inblock in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' /usr/local/bundle/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:inrequire_with_bootsnap_lfi'

KellyAH commented 4 years ago

It worked fine on Karolina's mac but not on Neer's when running the script. Yet on Neer's machine we were able to successfully spin up the image with an open shell session and run the same commands in the script that create the DB and start the server.

Something about the script and maybe Docker and Neer's mac? is preventing the script from working and throwing the error she posted.

Todo Kelly