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

Nginx alt #125

Merged
merged 8 commits into from May 25, 2015

Conversation

Projects
None yet
2 participants
@joshuacox
Contributor

joshuacox commented Apr 3, 2015

I was using the /etc/nginx/templates folder too much with custom config files. As there are other autogenerated files in there I do not want to back that folder up directly. Instead I've been keeping everything specific to containers in /exports. With this branch you can specify the location for an alternate nginx template for a base container with name basecontainername who has a template.ctmpl in /exports/basecontianername/ like so:

octo config:set basecontainername@/NGINX_ALT '/exports/basecontainername/template.ctmpl'
@joshuacox

This comment has been minimized.

Show comment
Hide comment
@joshuacox

joshuacox May 23, 2015

Contributor

Any coments here? @darron or anyone else, I'm open to suggestions. I think it's warranted for the enterprise situation, I need single sign on for a few of my services and that requires altering the nginx configs at the proxy to connect with my FreeIPA setup. I'm fairly certain there are other scenarios where this would be useful

Contributor

joshuacox commented May 23, 2015

Any coments here? @darron or anyone else, I'm open to suggestions. I think it's warranted for the enterprise situation, I need single sign on for a few of my services and that requires altering the nginx configs at the proxy to connect with my FreeIPA setup. I'm fairly certain there are other scenarios where this would be useful

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron May 23, 2015

Member

Sorry - I had forgotten about this - will take a look this weekend.

Member

darron commented May 23, 2015

Sorry - I had forgotten about this - will take a look this weekend.

@joshuacox

This comment has been minimized.

Show comment
Hide comment
@joshuacox

joshuacox May 24, 2015

Contributor

I figured it fell through the cracks. I'd love feedback as I'm thinking all about my own needs, any ideas on making it more useful or going about it another way are welcome.

Contributor

joshuacox commented May 24, 2015

I figured it fell through the cracks. I'd love feedback as I'm thinking all about my own needs, any ideas on making it more useful or going about it another way are welcome.

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron May 24, 2015

Member

How about something like this:

octohost/bin/octo

Lines 567 to 581 in 09879d0

# If there isn't a template already, copy the template and set the name.
NGINX_TEMPLATE="/etc/nginx/templates/$BASE.ctmpl"
NGINX_TEMPLATE_ALT=$(/usr/bin/octo config:get $BASE/NGINX_ALT)
NGINX_TEMPLATE_SSL=$(/usr/bin/octo config:get $BASE/SSL_FORCED)
if [ ! -f $NGINX_TEMPLATE ]; then
if [ ! -z "$NGINX_TEMPLATE_ALT" ]; then
sudo cp $NGINX_TEMPLATE_ALT $NGINX_TEMPLATE
elif [ ! -z "$NGINX_TEMPLATE_SSL" ]; then
sudo cp /etc/octohost/templates/nginx-ssl.ctmpl $NGINX_TEMPLATE
else
sudo cp /etc/octohost/templates/nginx.ctmpl $NGINX_TEMPLATE
fi
sudo sed -i "s/REPLACEME/$BASE/" $NGINX_TEMPLATE
fi

It's quite a bit cleaner - and I'd like to move all templates out of the nginx folder as well - seems cleaner.

If it's good - I'll adjust the cookbooks to match.

Member

darron commented May 24, 2015

How about something like this:

octohost/bin/octo

Lines 567 to 581 in 09879d0

# If there isn't a template already, copy the template and set the name.
NGINX_TEMPLATE="/etc/nginx/templates/$BASE.ctmpl"
NGINX_TEMPLATE_ALT=$(/usr/bin/octo config:get $BASE/NGINX_ALT)
NGINX_TEMPLATE_SSL=$(/usr/bin/octo config:get $BASE/SSL_FORCED)
if [ ! -f $NGINX_TEMPLATE ]; then
if [ ! -z "$NGINX_TEMPLATE_ALT" ]; then
sudo cp $NGINX_TEMPLATE_ALT $NGINX_TEMPLATE
elif [ ! -z "$NGINX_TEMPLATE_SSL" ]; then
sudo cp /etc/octohost/templates/nginx-ssl.ctmpl $NGINX_TEMPLATE
else
sudo cp /etc/octohost/templates/nginx.ctmpl $NGINX_TEMPLATE
fi
sudo sed -i "s/REPLACEME/$BASE/" $NGINX_TEMPLATE
fi

It's quite a bit cleaner - and I'd like to move all templates out of the nginx folder as well - seems cleaner.

If it's good - I'll adjust the cookbooks to match.

@joshuacox

This comment has been minimized.

Show comment
Hide comment
@joshuacox

joshuacox May 24, 2015

Contributor

that looks appropriate to me, I'll test it as soon as I get home this evening.

Contributor

joshuacox commented May 24, 2015

that looks appropriate to me, I'll test it as soon as I get home this evening.

@joshuacox

This comment has been minimized.

Show comment
Hide comment
@joshuacox

joshuacox May 25, 2015

Contributor

verified working on my dev octohost. All my custom templates were recognized, with no other alterations on my end other than downloading the above octo bin you supplied. I say merge it, and let's rebuild and test from there

Contributor

joshuacox commented May 25, 2015

verified working on my dev octohost. All my custom templates were recognized, with no other alterations on my end other than downloading the above octo bin you supplied. I say merge it, and let's rebuild and test from there

@darron darron merged commit fff3c59 into octohost:master May 25, 2015

@darron

This comment has been minimized.

Show comment
Hide comment
@darron

darron May 25, 2015

Member

That should do it now - I've updated the cookbooks and changed the last bit of it in the octo bin.

Member

darron commented May 25, 2015

That should do it now - I've updated the cookbooks and changed the last bit of it in the octo bin.

@joshuacox

This comment has been minimized.

Show comment
Hide comment
@joshuacox

joshuacox May 25, 2015

Contributor

looks good to me I'll rebuild tomorrow. Cheers! thanks for implementing! This completes some major functionality!

Contributor

joshuacox commented May 25, 2015

looks good to me I'll rebuild tomorrow. Cheers! thanks for implementing! This completes some major functionality!

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