这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@michaelshobbs
Copy link
Member

closes #1123 #1474

example output with no $DOKKU_ROOT/VHOST and an IP in $DOKKU_ROOT/HOSTNAME (also can be accomplished by setting NO_VHOST=1)
note: we always use the contents of $DOKKU_ROOT/HOSTNAME for urls output in the aforementioned cases

$ git push dokku@dokku.me:node-js-app master
Pseudo-terminal will not be allocated because stdin is not a terminal.
Counting objects: 454, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (365/365), done.
Writing objects: 100% (454/454), 218.70 KiB | 0 bytes/s, done.
Total 454 (delta 79), reused 391 (delta 51)
-----> Cleaning up...
-----> Building node-js-app from herokuish...
-----> Fetching custom buildpack
-----> Node.js app detected
...
-----> All checks successful!
=====> node-js-app container output:
       Node app is running at localhost:5000
=====> end node-js-app container output
-----> Running post-deploy
=====> unsupported vhost config found. disabling vhost support
-----> Setting config vars
       NO_VHOST: 1
-----> no nginx port set. setting to random open high port
-----> Setting config vars
       DOKKU_NGINX_PORT: 22578
-----> Creating http nginx.conf
-----> Running nginx-pre-reload
       Reloading nginx
=====> Application deployed:
       http://10.0.0.2:32824 (container)
       http://10.0.0.2:22578 (nginx)

To dokku@dokku.me:node-js-app
 * [new branch]      master -> master

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be a bit more professional here ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bahahahaha!

EDIT: You do read my code!!!!! ;P

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't just click merge as soon as I see a green button :P

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lies!!!!!

@michaelshobbs michaelshobbs changed the title [WIP] initial pass at nginx proxy without VHOST nginx proxy without VHOST Sep 18, 2015
@michaelshobbs
Copy link
Member Author

I'm not particularly happy with how this ended up. Any feedback on the nginx_build_config function would be welcomed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add port as an option to nginx:enable so that users can modify the port to their preferred value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh? 🤷

just set the config var...?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me :)

This reduces deploy output by moving `config:get` calls out of the main loop. Since the values are the same for each iteration, it does not make sense to re-retrieve them each time.
Because of how plugin commands are implemented, their output can be incredibly verbose. Rather than executing even the `set -eo pipefail` parts of a plugin, we immediately check if the command is implemented by a plugin. If it is not, then we continue on as normal.

One side-effect of this change is that plugin commands need to be duplicated again:

- once in the command array
- once for the actual body of the command
- once in the help output

This is also quite hackish, and probably not the best way to decrease trace output. Note that we drop approximately 2k lines worth of logs with this change.
@michaelshobbs
Copy link
Member Author

I'm working on some more refactoring

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was impossible to support transitions from NO_VHOST=1 to nothing and maintain a single function that told the truth about an app's vhost state. so we catch NO_VHOST in unset and set it to 0

@michaelshobbs
Copy link
Member Author

I think this is a step in the right direction. Could definitely use some more time to breakdown nginx_build_config but let's not hold up 0.4.0 for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your if statement is missing the brackets to evaluate this and you have a continue in an if statement?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it twerks:

$ get_open_port() {
>   while true; do
>     local port=$(shuf -i 80-81 -n 1)
>     if ! nc -z 0.0.0.0 $port; then
>       echo "open port: $port"
>       return 0
>     else
>       echo "failed port: $port"
>       continue
>     fi
>   done
> }
$ get_open_port
failed port: 80
failed port: 80
open port: 81

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ dpkg -S /usr/bin/shuf
coreutils: /usr/bin/shuf

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just showing what provides shuf

@josegonzalez
Copy link
Member

yey passes

josegonzalez added a commit that referenced this pull request Sep 19, 2015
@josegonzalez josegonzalez merged commit 5bb62c0 into master Sep 19, 2015
@josegonzalez josegonzalez deleted the 1123_mh-nginx-novhost branch September 19, 2015 21:54
@josegonzalez josegonzalez changed the title nginx proxy without VHOST Support static nginx port when deploying without an application VHOST Sep 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Container IP always change when deploying an app on no-domain server

4 participants