Skip to content
This repository has been archived by the owner on Feb 14, 2018. It is now read-only.

Fixes #45 : Vagrant Broken Build and Tests #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ npm-debug.log
*.lua.swp
lib/
nginx-jwt.tar.gz

# Intellij
.idea/
*.iml
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ Besides being able to install Docker and run Docker directly in the host OS, the
sudo ./build run
```

#### Ubuntu on MacOS (via Vagrant)
#### Vagrant

If your host OS is Mac OS but you'd like to test that the build scripts run on Ubuntu, you can use the provided Vagrant scripts to spin up an Ubuntu VM that has all the necessary tools installed.
If you'd like to test that the build scripts run on Ubuntu VM, you can use the provided Vagrant scripts to spin up an Ubuntu VM that has all the necessary tools installed.

First, if you haven't already, install **Vagrant** either by [installing the package](http://www.vagrantup.com/downloads.html) or using [Homebrew](http://sourabhbajaj.com/mac-setup/Vagrant/README.html).

Expand All @@ -229,7 +229,12 @@ And then SSH into it:
vagrant ssh
```

Once in, you'll need to use git to clone this repo and `cd` into the project:
If you're VM provider (ie Virtualbox) has guest additions installed, it will automatically mount the working directory to /vagrant.

Due to issues with security around synced folders and symlinks, most providers will explicitly prevent this so npm install will fail on tests. To get around this
if this folder was already mounted there should be a copy in ~/nginx-jwt already copied.

Otherwise you'll need to use git to clone this repo and `cd` into the project:

```bash
git clone THIS_REPO_URL
Expand Down
2 changes: 1 addition & 1 deletion hosts/proxy/base64-secret/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM proxy-base-image
FROM auth0/proxy-base-image

# secret is base-64 encoded and URL-safe
ENV JWT_SECRET="VGhpcyBzZWNyZXQgaXMgc3RvcmVkIGJhc2UtNjQgZW5jb2RlZCBvbiB0aGUgcHJveHkgaG9zdA"
Expand Down
2 changes: 1 addition & 1 deletion hosts/proxy/config-claim_specs-not-table/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM proxy-base-image
FROM auth0/proxy-base-image

ENV JWT_SECRET="JWTs are the best!"

Expand Down
2 changes: 1 addition & 1 deletion hosts/proxy/config-unsupported-claim-spec-type/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM proxy-base-image
FROM auth0/proxy-base-image

ENV JWT_SECRET="JWTs are the best!"

Expand Down
2 changes: 1 addition & 1 deletion hosts/proxy/default/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM proxy-base-image
FROM auth0/proxy-base-image

ENV JWT_SECRET="JWTs are the best!"

Expand Down
2 changes: 1 addition & 1 deletion nginx-jwt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function M.auth(claim_specs)
-- make sure claim spec is a supported type
-- TODO: test
if spec_action == nil then
ngx.log(ngx.STDERR, "Configuration error: claim_specs arg claim '" .. claim .. "' must be a string or a table")
ngx.log(ngx.STDERR, "Configuration error: claim_specs arg claim '" .. claim .. "' must be a string or a function")
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end

Expand Down
10 changes: 9 additions & 1 deletion provision-vagrant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
apt-get install --yes nodejs

# Install Docker
curl -sSL https://get.docker.com/ubuntu | sh
curl -sSL https://get.docker.com/ | sh

usermod -aG docker vagrant

# Vim settings:
echo 'syntax on' > /home/vagrant/.vimrc

touch /etc/vagrant-provisioned

# If your VM provider auto-mounted the current directory under /vagrant, simply copy a copy to prevent npm symlink issues
if [ -e "/vagrant/build" ];
then
cp -R /vagrant nginx-jwt
fi
3 changes: 2 additions & 1 deletion scripts/build_proxy_base_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ image_exists=$(docker images | grep "proxy-base-image\s*$dockerfile_sha1") || tr

if [ -z "$image_exists" ]; then
echo -e "${blue}Building image${no_color}"
docker build -t="proxy-base-image:$dockerfile_sha1" --force-rm $proxy_base_dir
docker build -t="auth0/proxy-base-image:$dockerfile_sha1" --force-rm $proxy_base_dir
docker tag "auth0/proxy-base-image:$dockerfile_sha1" "auth0/proxy-base-image:latest"
else
echo -e "${blue}Base image already exists${no_color}"
fi
2 changes: 1 addition & 1 deletion test/test_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ describe('proxy', function () {
if (err) { done(err); }

expect(stderr).to.have.string(
"Configuration error: claim_specs arg claim 'aud' must be a string or a table");
"Configuration error: claim_specs arg claim 'aud' must be a string or a function");

done();
});
Expand Down