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

Add ability to change ports #11

Open
Shelob9 opened this issue May 12, 2018 · 7 comments
Open

Add ability to change ports #11

Shelob9 opened this issue May 12, 2018 · 7 comments

Comments

@Shelob9
Copy link

Shelob9 commented May 12, 2018

When running the docker watch, I am getting this error ERROR: for wordpress Cannot start service wordpress: driver failed programming external connectivity on endpoint blocks_wordpress_1 (92276f168396b71072f54fc7b359a72669273720199ba52e27ea71be1ac3cd1c): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)

That would indicate that port 80 is in use, which is common. It would be great to have an environment variable for port or to automatically find an open one.

@zackify
Copy link
Owner

zackify commented May 12, 2018

Thanks, for now you can add this file to your own project, and change the port / volume mounts. https://github.com/crossfield/gutenblock/blob/master/cli/watch/docker-compose.yml you can run docker-compose up

I need to add cli flags for all of these options. Hopefully in a week or so.

@Shelob9
Copy link
Author

Shelob9 commented May 13, 2018

Where was I supposed to put that? I put it in the root, but it didn't have any effect, I think.

I'm pretty sure this is completely my machine's fault though:

I confirm with lsof -i tcp:8080 that nothing else is running on that port, but then the same thing.

joshs-MacBook-Pro:blocks josh$ lsof -i tcp:8080
joshs-MacBook-Pro:blocks josh$ gutenblock watch docker
Using default configuration
ℹ 「hot」: webpack: Compiling...
ℹ 「hot」: WebSocket Server Listening at localhost:8081
ℹ 「serve」: Project is running at http://localhost:8080
ℹ 「serve」: Server URI copied to clipboard
blocks_db_1 is up-to-date
Starting blocks_wordpress_1 ... error

ERROR: for blocks_wordpress_1  Cannot start service wordpress: driver failed programming external connectivity on endpoint blocks_wordpress_1 (72b4e0d728c2ea1fedb8bd8b9fb2d7dfaa26c0c843faaf3f30527917ba479c85): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)

ERROR: for wordpress  Cannot start service wordpress: driver failed programming external connectivity on endpoint blocks_wordpress_1 (72b4e0d728c2ea1fedb8bd8b9fb2d7dfaa26c0c843faaf3f30527917ba479c85): Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error (Failure EADDRINUSE)
Encountered errors while bringing up the project.

@zackify
Copy link
Owner

zackify commented May 13, 2018

Sorry my bad... I suck at explaining

Put the docker compose inside your blocks folder

Run gutenblock watch and in another tab docker-compose up

@Shelob9
Copy link
Author

Shelob9 commented May 13, 2018

Thanks. That makes more sense.

@ericmulder
Copy link

I have the blocks plugin running inside my own docker wordpress image (on port 89), but the gutenblock watch command doesn't seem to find the correct port. Do I do something wrong?

@zackify
Copy link
Owner

zackify commented Feb 7, 2019

gutenblock watch will run your blocks on localhost:8080 by default. you need to make sure your plugin looks like this:

wp_enqueue_script(
		'crossfield_blocksjs',
		//IN PRODUCTION put plugins_url( '/build/main.js', dirname( __FILE__ ) )
		'http://localhost:8080/main.js', 
		array( 'wp-blocks', 'wp-i18n', 'wp-element' ) 
	);

Inside gutenberg you should see webpack in the chrome console showing its connected

@ericmulder
Copy link

Thanks for clarification, I misunderstood the setup. Linking to localhost:8080 works perfectly 👍

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

No branches or pull requests

3 participants