aws-lambda-r icon indicating copy to clipboard operation
aws-lambda-r copied to clipboard

Running setup_user.sh PRJ_NAME: command not found

Open brorio opened this issue 6 years ago • 7 comments

Great project!

I am trying to configure the setup_user.sh script file by following the example file.

I added:

#!/bin/bash

# user settings and secrets
# customize and rename to `setup_user.sh`
# overwrites `secrets_default.sh`, `settings_default.sh`, `setup_auto.sh`
PRJ_NAME ="myproj"
PRJ_BRANCH="myproj"

Then I run scripts/01_main.sh

Got error:

\e[32mINFO :\e[39m Checking project directories \e[32mINFO :\e[39m Loading default settings and secrets /Users/macos/Documents/r-ec2/myproj/settings/setup_user.sh: line 6: PRJ_NAME: command not found \e[31mERROR:\e[39m PRJ_NAME is \e[95mMISSING\e[39m. Exiting.

Is there a simple way to configure the setup_user script?

brorio avatar Nov 02 '18 23:11 brorio

Got a bit further:

scripts/01_main.sh \e[32mINFO :\e[39m Checking project directories \e[32mINFO :\e[39m Loading default settings and secrets

------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean /Users/macos/Documents/r-ec2/ipromx/scripts/03_check_settings.sh: line 23: mapfile: command not found \e[31mERROR:\e[39m Not on branch \e[36m(master)\e[39m. Exiting.

Running: GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)

brorio avatar Nov 02 '18 23:11 brorio

GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)

mapfile: command not found

This is very strange, mapfile should be part of Bash 4.0+ ... I do not know why you are getting this particular error (it may depend on your configuration ?). I am not also sure why you are seeing the escape characters \e[32m - these should be colors in the terminal (when configured properly).

I would recommend to try this project first on a Linux machine (e.g. in EC2 or a local VM) to see how it works. Then identify any macos related issues.

Currently I cannot test the scripts on OSX; thus any insights / issues / solutions will be appreciated.

MikeBadescu avatar Nov 03 '18 00:11 MikeBadescu

Added: #!/usr/local/bin/bash at the top of all sh files to solve the mapfile error.

Now I am stuck again:

scripts/01_main.sh INFO : Checking project directories INFO : Loading default settings and secrets

------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean INFO : On branch (master) INFO : Branch (master) is clean. WARN : Not all commits on branch (master) pushed to remote or not tracking changes.

------------------------- AWS CREDENTIALS -------------------------- ERROR: Your AWS access key is: MISSING. Exiting.

Using AWS_PRFL="--profile myprofile" in settings_default.sh

But that does not seem to be enough.

Tried to add the keys to setup_user.sh

AWS_ACCESS_KEY_ID=XXXX.. AWS_SECRET_ACCESS_KEY=XXXXX...

No luck..

brorio avatar Nov 03 '18 00:11 brorio

Look in secrets_default.sh too. The keys to provide are IAM_ACCESS_KEY_ID and IAM_SECRET_ACCESS_KEY (to avoid the same name as the local AWS env variables). They are needed to perform AWS operations while on EC2.

MikeBadescu avatar Nov 03 '18 00:11 MikeBadescu

Thanks! Yes I am switching to Ubunu Linux now.

brorio avatar Nov 03 '18 01:11 brorio

I'm still seem to getting forward on OSX:

cripts/01_main.shINFO : Checking project directories INFO : Loading default settings and secrets

------------------------- GIT REPO $(FY $PRJ_NAME) ----------------- On branch master nothing to commit, working tree clean INFO : On branch (master) INFO : Branch (master) is clean. WARN : Not all commits on branch (master) pushed to remote or not tracking changes.

------------------------- AWS CREDENTIALS -------------------------- Your AWS access key is: ********NKNQ Your AWS secret access key is: ********J2vN AWS Account ID: ********1270 AWS Region: us-west-1

------------------------- EC2 INSTANCE ----------------------------- No Custom AMI present, using Default AMI: ami-4fffc834 Instance Type: t2.micro ERROR: Subnet ID: subnet-MISSING. Exiting.

brorio avatar Nov 03 '18 02:11 brorio

ERROR: Subnet ID: subnet-MISSING. Exiting.

You need to provide values otherwise the variables will default to a value of $MISSING.

Some familiarity with AWS is needed. The comments in the .sh files (in the settings/ directory) and the documentation in the doc/ folder help somehow. Finally, there is the "auto setup" created by following step 6 of the main README.

MikeBadescu avatar Nov 03 '18 14:11 MikeBadescu