-
Notifications
You must be signed in to change notification settings - Fork 489
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
Use within Docker containers #58
Comments
So far the only way of getting the develop server to work is to override
|
Would it help if you could set a custom URL for the GraphQL server in |
Yes, I think that would do it. I'm also seeing connection problems to the server on port 9000 but it hasn't seemed to cause problems so far, I'm not sure what that does? |
Port |
I think the port is fine but like the graphql server I probably need to be able to specify a host the browser understands |
Oh just a note, in the docs it says you can specify a host in the config but this didn't work for me. The only way a new host got picked up was to specify it with the -h switch on the commandline. |
Any luck implementing this? |
I have gridsome develop running inside a docker container. I used the HOSTHANE environment variable set by docker so the container can reference itself, and added it to module.exports = {
// Internal hostname provided by docker
host: process.env.HOSTNAME,
port: 8080,
}; This logs will show something like:
Of course you can ignore the url because that's just from the container's perspective. If you've exposed the port you should have access to both endpoints through localhost (or however else you have it configured). Note that you do need to restart the container for any changes to this file to be reflected. |
@carmanchris31 my problem may be slightly complicated by docker running on a different machine. When I add the docker HOSTNAME environment variable to
If I specify the IP for Any thoughts? |
I'm using LXD containers, I added to module.exports = {
host: '0.0.0.0'
port: 8080,
}; and according to this comment on issue #134:
It works for me. |
Closing, due to findings by @menteora above. Please reopen if there are more questions/issues. |
The default host will be |
@hjvedvik cool, FYI Forestry is using the official NodeJS Docker image ( |
@tanc Using the latest version of gridsome this seems to work out of the box now. |
This is the Docker configuration that I am using to integrate Gridsome if this can be of any help. RequirementsDockerfile$ touch Dockerfile
Docker Compose$ touch docker-compose.yaml version: "3"
services:
npm:
container_name: npm
build: .
user: user
entrypoint: npm
working_dir: /home/user/app
volumes:
- .:/home/user/app
website:
container_name: website
build: .
user: user
command: npm run develop
working_dir: /home/user/app
ports:
- 8080:8080
volumes:
- .:/home/user/app Commands
Example$ docker-compose run --rm npm install
$ docker-compose up --detach website
$ chromium localhost:8080
$ docker-compose down I think that this would be awesome to have these files and the documentation in one of (or all) starters. This could help be productive with Docker in no time without having to think about all the dependencies for pngquant and stuff! |
I'm experimenting with running Gridsome within a set of docker containers. The first issue is the localhost is the default host which stops the browser from connecting with the server within the containers. This is resolvable by specifying 0.0.0.0 as the host using
gridsome develop -h 0.0.0.0
The next problem is the served application can't connect with the GraphQL server, the browser throws the following:
If I specify an actual hostname (which resolves to the IP of the docker container) then I get errors running the server with
gridsome develop -h gridsome.lndo.site
:Any ideas how to proceed?
The text was updated successfully, but these errors were encountered: