Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error attempting to mix deps.get #35

Open
nelsonic opened this issue Feb 28, 2018 · 9 comments
Open

Error attempting to mix deps.get #35

nelsonic opened this issue Feb 28, 2018 · 9 comments
Assignees
Milestone

Comments

@nelsonic
Copy link
Member

nelsonic commented Feb 28, 2018

I attempted to run mix deps.get on localhost and got the following error:

image

** (Mix.Config.LoadError) could not load config config/config.exs
    ** (KeyError) key "SECRET_KEY_BASE" not found in: %{"Apple_PubSub_Socket_Render" => "/private/tmp/com.apple.launchd.PMeC85gCK2/Render", 
"BINDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin", 
"COLORFGBG" => "15;0", "COLORTERM" => "truecolor", "EMU" => "beam", 
"HOME" => "/Users/Admin", "ITERM_PROFILE" => "Default", 
"ITERM_SESSION_ID" => "w0t2p0:0F4769CC-83F4-41C0-9F42-9B4F34149B95", 
"LANG" => "en_GB.UTF-8", "LOGNAME" => "Admin", "PATH" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin:/usr/local/Cellar/erlang/20.2.2/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "PROGNAME" => "erl", "PWD" => "/code/github-backup", 
"ROOTDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang", "SHELL" => "/bin/bash", "SHLVL" => "1", "SSH_AUTH_SOCK" => "/private/tmp/com.apple.launchd.46QiqVHC0d/Listeners", 
"TERM" => "xterm-256color", "TERM_PROGRAM" => "iTerm.app", "TERM_PROGRAM_VERSION" => "3.1.5", "TERM_SESSION_ID" => "w0t2p0:0F4769CC-83F4-41C0-9F42-9B4F34149B95", 
"TMPDIR" => "/var/folders/0m/hlrnvx6n5qv001qcm6x9ny440000gn/T/", "USER" => "Admin", "XPC_FLAGS" => "0x0", "XPC_SERVICE_NAME" => "0", "__CF_USER_TEXT_ENCODING" => "0x1F5:0x0:0x2"}
    (stdlib) :maps.get("SECRET_KEY_BASE", 
%{"Apple_PubSub_Socket_Render" => "/private/tmp/com.apple.launchd.PMeC85gCK2/Render", "BINDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin", 
"COLORFGBG" => "15;0", "COLORTERM" => "truecolor", "EMU" => "beam", "HOME" => "/Users/Admin", "ITERM_PROFILE" => "Default", 
"ITERM_SESSION_ID" => "w0t2p0:0F4769CC-83F4-41C0-9F42-9B4F34149B95", 
"LANG" => "en_GB.UTF-8", "LOGNAME" => "Admin", "PATH" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin:/usr/local/Cellar/erlang/20.2.2/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "PROGNAME" => "erl", "PWD" => "/code/github-backup", "ROOTDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang", "SHELL" => "/bin/bash", 
"SHLVL" => "1", "SSH_AUTH_SOCK" => "/private/tmp/com.apple.launchd.46QiqVHC0d/Listeners", "TERM" => "xterm-256color", "TERM_PROGRAM" => "iTerm.app", "TERM_PROGRAM_VERSION" => "3.1.5", "TERM_SESSION_ID" => "w0t2p0:0F4769CC-83F4-41C0-9F42-9B4F34149B95", 
"TMPDIR" => "/var/folders/0m/hlrnvx6n5qv001qcm6x9ny440000gn/T/", "USER" => "Admin", "XPC_FLAGS" => "0x0", "XPC_SERVICE_NAME" => "0", "__CF_USER_TEXT_ENCODING" => "0x1F5:0x0:0x2"})
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5
    (stdlib) erl_eval.erl:228: :erl_eval.expr/5
    (stdlib) erl_eval.erl:229: :erl_eval.expr/5
    (stdlib) erl_eval.erl:878: :erl_eval.expr_list/6
    (stdlib) erl_eval.erl:236: :erl_eval.expr/5

I'm re-reading the Docs (README) to see if I "missed a step" ...

@SimonLab
Copy link
Member

see: https://github.com/dwyl/github-backup#run-a-github-backup-server section,
To load the environment variables we need to run source .env before running mix deps.get to allow the application to compile

@nelsonic
Copy link
Member Author

@SimonLab yeah, that's what I thought ... thanks. 👍

@Cleop
Copy link
Member

Cleop commented Mar 2, 2018

@nelsonic - is there anything from this that you feel could be changed in the readme to make it better or can this issue now be closed?

@nelsonic
Copy link
Member Author

When attempting to run

mix phx.gen.secret

Got:

code/github-backup $ mix phx.gen.secret
** (Mix.Config.LoadError) could not load config config/config.exs
    ** (KeyError) key "SECRET_KEY_BASE" not found in: %{"APP_HOST" => "localhost", "Apple_PubSub_Socket_Render" => "/private/tmp/com.apple.launchd.BggU0HEYKV/Render", "BINDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin", "COLORFGBG" => "15;0", "COLORTERM" => "truecolor", "EMU" => "beam", "HOME" => "/Users/Admin", "ITERM_PROFILE" => "Default", "ITERM_SESSION_ID" => "w0t0p0:695008F9-F3DD-4D60-A3D4-9593BF5BEC00", "LANG" => "en_GB.UTF-8", "LOGNAME" => "Admin", "PATH" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang/erts-9.2/bin:/usr/local/Cellar/erlang/20.2.2/lib/erlang/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", "PROGNAME" => "erl", "PWD" => "/code/github-backup", "ROOTDIR" => "/usr/local/Cellar/erlang/20.2.2/lib/erlang", "SHELL" => "/bin/bash", "SHLVL" => "1", "SSH_AUTH_SOCK" => "/private/tmp/com.apple.launchd.lTUjUwjj5X/Listeners", "TERM" => "xterm-256color", "TERM_PROGRAM" => "iTerm.app", "TERM_PROGRAM_VERSION" => "3.1.5", "TERM_SESSION_ID" => "w0t0p0:695008F9-F3DD-4D60-A3D4-9593BF5BEC00", "TMPDIR" => "/var/folders/0m/hlrnvx6n5qv001qcm6x9ny440000gn/T/", "USER" => "Admin", "XPC_FLAGS" => "0x0", "XPC_SERVICE_NAME" => "0", "__CF_USER_TEXT_ENCODING" => "0x1F5:0x0:0x2"}

Ironically i'm getting a KeyError while trying to generate my key ... 🙄
In your terminal just paste the following:

export SECRET_KEY_BASE=WhgLiQCoxn4A/WNY/i5Ll5PxeQc0HOafjb+m1Xxk4ALsrX+cdEvmaTb987654321

obvs if you're running this in "production" you would use a "real" randomly generated key.

I ended up running the mix phx.gen.secret in a different project
because github-backup would not let me ... 🐔 v.s 🥚 ... 😕

@nelsonic
Copy link
Member Author

after setting up the app: https://github.com/apps/gitbu
exporting all the suggested environment variables,
I attempted to run the tests on localhost with mix test

but sadly the S3 test unhappy:
image

  1) test GET / (AppWeb.PageControllerTest)
     test/app_web/controllers/page_controller_test.exs:4
     ** (UndefinedFunctionError) function AppWeb.AWS.S3.get_files_bucket/0 is undefined or private

I have exported the AWS/S3 specific environment variables in my .env file:

export AWS_ACCESS_KEY_ID=AKIAI...
export AWS_SECRET_ACCESS_KEY=yKWnRy...
export S3_BUCKET_NAME=dwyl-github-backup

@SimonLab / @Cleop what else do I need to make this work...? 🤔

@nelsonic
Copy link
Member Author

I did a git clone of master into a separate directory
and using the environment variables defined previously, the tests pass on localhost:
image

So I think I'm just going to "replay" my "documentation" changes onto a fresh copy of master and re-open the PR. 👍

@nelsonic
Copy link
Member Author

code/github-backup $ git rebase master
First, rewinding head to replay your work on top of it...
Applying: #31 Broken code with notes in comments
Using index info to reconstruct a base tree...
M config/config.exs
M config/dev.exs
M config/prod.exs
M lib/app_web/controllers/event_controller.ex
M lib/app_web/router.ex
M mix.exs
M mix.lock
Falling back to patching base and 3-way merge...
Auto-merging mix.lock
CONFLICT (content): Merge conflict in mix.lock
Auto-merging mix.exs
CONFLICT (content): Merge conflict in mix.exs
Auto-merging lib/app_web/router.ex
CONFLICT (content): Merge conflict in lib/app_web/router.ex
Auto-merging lib/app_web/controllers/event_controller.ex
CONFLICT (content): Merge conflict in lib/app_web/controllers/event_controller.ex
Auto-merging lib/app_web/controllers/aws/s3.ex
CONFLICT (add/add): Merge conflict in lib/app_web/controllers/aws/s3.ex
Auto-merging config/prod.exs
CONFLICT (content): Merge conflict in config/prod.exs
Auto-merging config/dev.exs
CONFLICT (content): Merge conflict in config/dev.exs
Auto-merging config/config.exs
CONFLICT (content): Merge conflict in config/config.exs
error: Failed to merge in the changes.
Patch failed at 0001 #31 Broken code with notes in comments
The copy of the patch that failed is found in: .git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

fixed. ✅

@Cleop
Copy link
Member

Cleop commented Mar 26, 2018

@SimonLab - is this branch still needed? Haven't we completed this functionality elsewhere?

@nelsonic nelsonic changed the title Error attempting to mix deps.get on save-to-s3 branch Error attempting to mix deps.get Mar 26, 2018
@nelsonic
Copy link
Member Author

@Cleop I have updated the issue title and description to reflect the fact that these issues were present for me regardless of the branch.
Meanwhile I have resolved the issue(s) and prepared a PR: #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants