How to add ParseServer to GraphQL Mesh file - docker-compose

I am trying to connect via this documentation of GraphQL Mesh the ParseServer which is a docker container to Mesh via the .meshrc.yaml file. But I am not sure how to send the MASTER Key and Application ID in order to do the proper connection.
What I've tried already is:
schemaHeaders
operationHeaders
Neither of them worked. When I am running the graphql_mesh from my docker-compose I am getting the fallowing error:
Failed to generate the schema Error: Failed to fetch introspection from http://localhost:1337/graphql: Error: connect ECONNREFUSED 127.0.0.1:1337 2023-02-10T13:38:52.347296144Z at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
Below I my docker files and my .meshrc.yaml.
docker-compose.yml file:
version: '3.9'
services:
database:
image: mongo:6.0.4
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin
volumes:
- ${HOME}/_DOCKER_DATA_/database:/data/db
networks:
- my_network
server:
restart: always
image: parseplatform/parse-server:5.4.1
ports:
- 1337:1337
environment:
- PARSE_SERVER_APPLICATION_ID=COOK_APP
- PARSE_SERVER_APPLICATION_NAME=COOK_NAME
- PARSE_SERVER_MASTER_KEY=MASTER_KEY_1
- PARSE_SERVER_DATABASE_URI=mongodb://admin:admin#mongo/parse_server?authSource=admin
- PARSE_SERVER_URL=http://10.0.2.2:1337/parse
- PARSE_SERVER_MOUNT_GRAPHQL=true
links:
- database:mongo
volumes:
- ${HOME}/_DOCKER_DATA_/server:/data/server
networks:
- my_network
dashboard:
image: parseplatform/parse-dashboard:5.0.0
ports:
- "4040:4040"
depends_on:
- server
environment:
- PARSE_DASHBOARD_APP_ID=COOK_APP
- PARSE_DASHBOARD_MASTER_KEY=MASTER_KEY_1
- PARSE_DASHBOARD_USER_ID=admin
- PARSE_DASHBOARD_USER_PASSWORD=admin
- PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true
- PARSE_DASHBOARD_SERVER_URL=http://localhost:1337/parse
- PARSE_DASHBOARD_GRAPHQL_SERVER_URL=http://localhost:1337/graphql
volumes:
- ${HOME}/_DOCKER_DATA_/dashboard:/data/dashboard
networks:
- my_network
graphql_mesh:
build:
context: .
dockerfile: Dockerfile_graphql_mesh
volumes:
- ./work/.meshrc.yaml:/work/.meshrc.yaml
ports:
- "4000:4000"
stdin_open: true
tty: true
networks:
- my_network
networks:
my_network:
driver: bridge
The Dockerfile_graphql_mesh:
FROM node:19.6.0-alpine3.17
COPY work /work
WORKDIR /work
RUN yarn add #graphql-mesh/cli
RUN yarn add graphql
RUN yarn add #graphql-mesh/graphql
RUN yarn add #graphql-mesh/runtime
RUN yarn add #envelop/auth0
CMD yarn run mesh dev
.meshrc.yaml:
sources:
- name: ParseServer_3
handler:
graphql:
endpoint: http://localhost:1337/graphql
schemaHeaders:
X-Parse-Application-Id: 'COOK_APP'
X-Parse-Master-Key: 'MASTER_KEY_1'
serve:
playground: true
I am trying to get the propper conection and generation of schema.grapql via the GraphQL Mesh.

Related

Password auth failed for user "postgres"

I am trying to run my postgres server and nestjs project with docker script and it does fire up the server and database. While firing up it does run migrations too but when I open pgAdmin I see no database there and if i try to create new server i get fatal pasword incorrect error. Also my server crashes too with error saying Password authentication failed for user "postgres". It was running fine yesterday but today its not running at all. I tried pruning everything and made fresh build and then compose up but nothing. Here is docker script
version: "3.5"
services:
dev-api:
container_name: xxxxxxxx-api
build:
context: .
dockerfile: Dockerfile
depends_on:
- dev-db
environment:
DATABASE_URL: postgresql://postgres:postgres#dev-db:5432/xxxxxxx_api
APP_ENV: development
PORT: 3030
WAIT_HOSTS: dev-db:5432
ports:
- "3030:3030"
- "9229:9229"
volumes:
- .:/usr/api/
dev-db:
container_name: xxxxxxxx-postgres
image: postgres:13.5-alpine
restart: always
ports:
- "5432:5432"
volumes:
- ./pg-data:/var/lib/postgresql/data
- ./src/db/docker/init.sql:/docker-entrypoint-initdb.d/dbinit.sql
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=xxxxxxx_api
expose:
- "5432"
pgadmin:
container_name: xxxxxxx-pgadmin
image: dpage/pgadmin4:6.2
ports:
- 8080:80
volumes:
- pgadmin-data:/var/lib/pgadmin
environment:
- PGADMIN_DEFAULT_EMAIL=user#postgres.com
- PGADMIN_DEFAULT_PASSWORD=postgres
- PGADMIN_LISTEN_PORT=80
depends_on:
- dev-db
volumes:
pgadmin-data:

docker compose phpmyadmin php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

I am trying to set up a docker-pod with laravel, mariadb, nginx, redis and phpmyadmin. The laravel webspace works finde but if i switch to port 10081 like configured in the docker-compose.yml i am not able to login with the root account.
it sais " mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution"
i already tried to configure a "my-network" which links all of the container, but if i understand docker right there is already a "defaul" network which does this. It didnt change the error message anyway.
here is my full docker-compose file
version: "3.8"
services:
redis:
image: redis:6.0-alpine
expose:
- "6380"
db:
image: mariadb:10.4
ports:
- "3307:3306"
environment:
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: laravel
volumes:
- db-data:/var/lib/mysql
nginx:
image: nginx:1.19-alpine
build:
context: .
dockerfile: ./docker/nginx.Dockerfile
restart: always
depends_on:
- php
ports:
- "10080:80"
networks:
- default
environment:
VIRTUAL_HOST: cockpit.example.de
volumes:
- ./docker/nginx.conf:/etc/nginx/nginx.conf:ro
- ./public:/app/public:ro
php:
build:
target: dev
context: .
dockerfile: ./docker/php.Dockerfile
working_dir: /app
env_file: .env
restart: always
expose:
- "9000"
depends_on:
- composer
- redis
- db
volumes:
- ./:/app
- ./docker/www.conf:/usr/local/etc/php-fpm.d/www.conf:ro
links:
- db:mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
ports:
- 10081:80
restart: always
environment:
PMA_HOST : db
MYSQL_USERNAME: root
MYSQL_ROOT_PASSWORD: secret
depends_on:
- db
#user: "109:115"
links:
- db:mysql
node:
image: node:12-alpine
working_dir: /app
volumes:
- ./:/app
command: sh -c "npm install && npm run watch"
composer:
image: composer:1.10
working_dir: /app
#environment:
#SSH_AUTH_SOCK: /ssh-auth.sock
volumes:
- ./:/app
#- "$SSH_AUTH_SOCK:/ssh-auth.sock"
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro
command: composer install --ignore-platform-reqs --no-scripts
volumes:
db-data:
Make sure you have defined all attributes correctly for phpmyadmin container, in the current case there was the absence of -network definition
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
restart: always
ports:
# 8080 is the host port and 80 is the docker port
- 8080:80
environment:
- PMA_ARBITRARY:1
- PMA_HOST:mysql
- MYSQL_USERNAME:root
- MYSQL_ROOT_PASSWORD:secret
depends_on:
- mysql
networks:
# define your network where all containers are connected to each other
- laravel
volumes:
# define directory path where you shall store your persistent data and config
# files of phpmyadmin
- ./docker/phpmyadmin
Maybe your container cannot start because its volume contains incompatible data. It can happen if you downgrade the version of mysql or mariadb image.
You can resolve the problem if you remove the volume and import the database again. Maybe you have to create a backup first.

Docker connection refused between containers

I'm using Postgres, Redis and Node.js (adding dependencies with yarn), and trying to integrate it all with a docker-compose.yml file.
I have the following docker-compose.yml:
version: '3'
services:
postgres:
image: postgres:latest
restart: unless-stopped
environment:
- POSTGRES_DB=mybase
- POSTGRES_USER=myuser
- POSTGRES_PASSWORD=mypass
redis:
image: redis:latest
restart: unless-stopped
migrate:
build: .
entrypoint: node_modules/.bin/sequelize db:migrate --config src/config/database.js --migrations-path src/database/migrations/
volumes:
- ./:/app
- /app/node_modules
depends_on:
- postgres
wavetech-be:
build:
dockerfile: Dockerfile
context: .
restart: on-failure
volumes:
- /app/node_modules
- ./:/app
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- DB_HOST=postgres
- DB_USER=myuser
- DB_PASS=mypass
- DB_PORT=5432
- DB_NAME=mybase
depends_on:
- redis
- migrate
And the following Dockerfile:
FROM node:alpine
WORKDIR "/app"
COPY ./package.json ./
RUN apk add yarn
RUN yarn
COPY . .
CMD [ "yarn", "dev" ]
However, when I docker-compose up, I keep getting connection problems with both databases:
migrate_1 |
migrate_1 | ERROR: connect ECONNREFUSED 127.0.0.1:5432
migrate_1 |
...
wavetech-be_1 | (node:85) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
The answer has two parts:
First, as pointed out by #jonrsharpe, the description of the migrate service was lacking the environment variables. So, as it is with the volumes, each service needs its own environment variables configured.
migrate:
build: .
entrypoint: node_modules/.bin/sequelize db:migrate --config src/config/database.js --migrations-path src/database/migrations/
volumes:
- ./:/app
- /app/node_modules
environment:
- DB_HOST=postgres
- DB_USER=myuser
- DB_PASS=mypass
- DB_PORT=5432
- DB_NAME=mybase
- APP_PORT=3000
depends_on:
- postgres
Second, I am using Bull to manage my Redis server. I was importing a config and passing it directly to Redis, so:
import redisConfig from '../../config/redis';
...
init() {
this.queues = Object.values(jobs).map(job => ({
bull: new BullQueue(job.key, redisConfig),
name: job.key,
handle: job.handle,
}));
}
And it turns out that Bull was trying to just use the default Redis configuration. When I passed the environment variables directly into the Bull config, it worked properly:
init() {
this.queues = Object.values(jobs).map(job => ({
bull: new BullQueue(job.key, {
redis: {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
},
}),
name: job.key,
handle: job.handle,
}));
}

DB connection error Error: connect ECONNREFUSED 127.0.0.1:5432?

Running a docker container with postgres and npm produces this error, while running them separetly
(npm and docker) doesn't. What seems to be the error here?
My docker-compose.yml:
version: "3.5"
services:
db:
image: postgres:12.1
ports:
- 5432:5432
environment:
- FLYWAY_URL=jdbc:postgresql://db:5432/
- POSTGRES_USER=myuser
- POSTGRES_PASSWORD=mypass
- POSTGRES_DB=mydb
volumes:
- ./db/data:/var/lib/postgresql/data
migrate:
image: boxfuse/flyway
entrypoint: ["sh", "-c", "/flyway/wait-for.sh db:5432 -- flyway migrate"]
depends_on:
- db
volumes:
- ./common/migrations/:/flyway/sql:rw
- ./common/scripts/wait-for.sh:/flyway/wait-for.sh:rw
environment:
# - FLYWAY_LOCATIONS=classpath:/common/migrations/
- FLYWAY_PASSWORD=mypass
- FLYWAY_USER=myuser
- FLYWAY_URL=jdbc:postgresql://db:5432/mydb?user=myuser&password=mypass
- FLYWAY_CONNECT_RETRIES=30
networks:
default:
name: mydb-local
services:
example-service:
build: .
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
ports:
- 3000:3000
- 9229:9229
command: npm start
Thing I have checked:
postgresql.conf & pg_hba.conf accepts connections.
DB credentials are correct.
Db is running

Making migrations for hasura container and running console

I want to make a developer offline space to develop my database with hasura
I know the existence of the container with the tag cli-migrations, but the command:
hasura-cli console
doesn't work for accessing outside of the container.
My configuration for the docker-compose.yml is:
version: '3'
services:
hasura:
environment:
- HASURA_GRAPHQL_DATABASE_URL=postgres://[some pass]:[some user]#db:5432/[some db]
- HASURA_GRAPHQL_ENABLE_CONSOLE=false
image: hasura/graphql-engine:v1.0.0-rc.1.cli-migrations
container_name: hasura
volumes:
- ./hasura-migrations:/hasura-migrations
networks:
- hasura-db
ports:
- "8081:8080"
- "8082:8081"
restart: always
command: hasura-cli console --console-port 8081 --no-browser
db:
environment:
- POSTGRES_USER=[some user]
- POSTGRES_PASSWORD=[some pass]
- POSTGRES_DB=[some db]
image: postgres:11.4-alpine
container_name: db
restart: always
networks:
- hasura-db
networks:
hasura-db:
There is a Pull request in the hasura graphql project for this issue, but is not merged.
I'm looking for a workaround for this pull request now.
I found a workaround for this!
If I install hasura cli in my machine and use
hasura console --console-port 8080 --endpoint http://127.0.0.1:8081
I can connect to the hasura api and run a console locally.
this is my updated docker-compose.yml
version: '3'
services:
hasura:
environment:
- HASURA_GRAPHQL_DATABASE_URL=postgres://[some pass]:[some user]#db:5432/[some db]
- HASURA_GRAPHQL_ENABLE_CONSOLE=false
image: hasura/graphql-engine:v1.0.0-rc.1.cli-migrations
container_name: hasura
volumes:
- ./hasura-migrations:/hasura-migrations
networks:
- hasura-db
ports:
- "8081:8080"
restart: always
db:
environment:
- POSTGRES_USER=[some user]
- POSTGRES_PASSWORD=[some pass]
- POSTGRES_DB=[some db]
image: postgres:11.4-alpine
container_name: db
restart: always
networks:
- hasura-db
networks:
hasura-db: