gutenblock
gutenblock copied to clipboard
Add ability to change ports
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.
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.
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.
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
Thanks. That makes more sense.
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?
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
Thanks for clarification, I misunderstood the setup. Linking to localhost:8080 works perfectly 👍