Closed mccannm1 closed 4 years ago
Closed in error, re-opened
To establish a connection to the database I needed to make these config changes on the database side https://stackoverflow.com/questions/38466190/cant-connect-to-postgresql-on-port-5432
Can someone have a look when they get an opportunity please?
install produces similar errors when setting up the database Setting up database... No JWT secret specified, this is required if you are using basic authentication. INCIDENT_DAILY_SUMMARY_ONCALL_SERVICE_ID has been deprecated. Please use INCIDENT_ONCALL_SERVICE_ID instead. No metric providers specified metrics will not be sent. ERROR:dispatch.common.utils.cli:Something went wrong with creating plugin rows, is the database setup correctly? : etc
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
Is the server running on host "server1.fyre.ibm.com" (
The database is up and running on 5433 see installation log
@mccannm1 is the database running on port 5433
and DATABASE_PORT=
in the .env
file set to 5433
? Are they still on the same server or separate? If you drop into the server, can you login into the database? Is the database schema up to date? Can run dispatch database upgrade
in the server and then start the server again to see if the error goes away? The other messages are warnings, not errors.
Note that 5433
is not the default postgres port (5432
)
Also note, that default there will not be any data in the database, if you'd like to use some example data you would have to restore the sample dataset. Located here: https://github.com/Netflix/dispatch/blob/develop/data/dispatch-sample-data.dump
Once downloaded into the root application directory you can restore this data by issuing:
mv dispatch-sample-data.dump dispatch-backup.dump
dispatch database restore
Hi @mvilanova I have the Postgres database installed on two servers server1 and server2. Dispatch is installed on server1. On server2 Postgres was using port 5432. As I couldn't see data coming across in the UI I installed Postgres on server1... It seemed I had to use port 5433 on this occasion... I modified the postgresql.conf , changed the port to 5432 (to keep things consistent) and restarted the postgres service... however when I started dispatch .. docker-compose up -d it threw an error saying port 5432 was in use... docker(proxy) as I recall had already been using port 5432...
Anyway.. I have it installed on server2 as well (and populated)... using port 5432.... I dont mind which database. I presume it is ok to use a DB on another server? This is server2 below
root@antic1:~# sudo -u postgres -i psql psql (12.3 (Ubuntu 12.3-1.pgdg20.04+1)) Type "help" for help.
postgres=# \c dispatch_db You are now connected to database "dispatch_db" as user "postgres". dispatch_db=# dispatch_db=# SELECT ID,NAME,DESCRIPTION FROM INCIDENT_PRIORITY; id | name | description ----+--------+--------------------------------------------------------------------------------------------- 1 | High | Incidents of this priority need to be remediated immediately 2 | Medium | Incidents of this type are important but not high. 3 | Low | Incidents of this priority are important but can be addressed during normal business hours. (3 rows)
dispatch_db=#
PostgreSQL 12.3 (Ubuntu 12.3-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0, 64-bit (1 row)
dispatch_db=#
dispatch_db=# \dn List of schemas Name | Owner --------+---------- public | postgres (1 row)
Where is the dispatch command run from? have I something missing from the install? Thanks
I imported the data using the dump file...like so sudo -u postgres -i psql -h 127.0.0.1 -U postgres -p 5432 dispatch_db < /root/dispatch-sample-data.dump This is on server2 , the .dump file from the repository Does this not mean the database has data within it? or have I misunderstood?
COMPOSE_PROJECT_NAME=dispatch DISPATCH_HELP_EMAIL=help@example.com DISPATCH_HELP_SLACK_CHANNEL=#general DISPATCH_UI_URL=https://example.com DISPATCH_AUTHENTICATION_PROVIDER_SLUG=dispatch-auth-provider-basic SECRET_KEY="_keyhere"
Database NOTE: Ensure that DATABASE_CREDENTIALS match the values passed to POSTGRES_USER and POSTGRES_PASSWORD
DATABASE_CREDENTIALS=postgres:_postgres_passwordhere DATABASE_HOSTNAME=antic1.fyre.ibm.com DATABASE_NAME=dispatch_db DATABASE_PORT=5432
Used by postgres docker POSTGRES_DB=dispatch_db POSTGRES_PASSWORD=_postgres_passwordhere POSTGRES_USER=postgres
I can talk to the DB on server2 from server1 (running query)
java -cp ./postgresql-42.2.14.jre7.jar:. Testantic //antic1.fyre.ibm.com:5432/dispatch_db postgres postgres_password Loaded the JDBC driver Created a JDBC connection to the data source Created JDBC Statement object Created JDBC ResultSet object ID: 1 NAME: High DESCRIPTION: Incidents of this priority need to be remediated immediately ID: 2 NAME: Medium DESCRIPTION: Incidents of this type are important but not high. ID: 3 NAME: Low DESCRIPTION: Incidents of this priority are important but can be addressed during normal business hours. Fetched all rows from JDBC ResultSet Closed JDBC ResultSet Closed JDBC Statement Transaction committed Disconnected from data source JDBC Exit from class Testantic - no errors
sorry for poor formatting in previous posts:
dispatch database upgrade dispatch: command not found
dispatch/dispatch-docker# docker-compose run dispatch server config ERROR: No such service: dispatch
dispatch/dispatch-docker# docker-compose run dispatch database upgrade ERROR: No such service: dispatch
Looks like you're missing the service name after run (see https://docs.docker.com/compose/reference/run/). The command should be docker-compose run web dispatch database upgrade
, for example.
HI @mvilanova @kevgliss I have run the commands using docker compose you had both suggested...but commands such as dispatch, and bash are not recognised.. Please see attachment... docker_compose_run_failures.txt Thanks /Martin
When using the docker compose, do not include dispatch
.
e.g.
docker-compose run web server config
HI @kevgliss Thanks , got that command working above as well as.... docker-compose run web database upgrade Please see the attachment docker-compose_run_web_database_restore.txt
I executed docker-compose run web database restore as you instructed earlier
mv dispatch-sample-data.dump dispatch-backup.dump dispatch database restore
=> it says it is looking for the file dispatch-backup.dump: No such file or directory
is it looking for it ion the DB server (antic1) in this case? if so which location?
If you're attempting to use docker to do the restore you have to make the file available to the container. It looks like you would want:
Hi @kevgliss Thanks So the .dump has to be copied to the containers file system. dispatch_postgres_1 is the container as I understand it. Where will it look for the .dump file ( the container ).....I copied to /root.... but it doesn't find it.....
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1eecf6352b4d dispatch-local-web "dispatch database..." 11 minutes ago Up 6 seconds 8000/tcp dispatch_web_run_1 1d40f1ebbaca dispatch-local-scheduler "dispatch schedule..." 3 hours ago Up 3 hours 8000/tcp dispatch_scheduler_1 4b8642c40fd8 dispatch-local-web "dispatch server s..." 3 hours ago Up 3 hours 0.0.0.0:8000->8000/tcp dispatch_web_1 ecf04a6f5a35 postgres:9.6 "docker-entrypoint..." 3 hours ago Up 3 hours 0.0.0.0:5432->5432/tcp dispatch_postgres_1 root@pluck1:/dispatch/dispatch-docker# root@pluck1:/dispatch/dispatch-docker# root@pluck1:/dispatch/dispatch-docker# docker exec dispatch_postgres_1 ls bin boot dev docker-entrypoint-initdb.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var /dispatch/dispatch-docker# docker cp dispatch-backup.dump dispatch_postgres_1:/root root@pluck1:
/dispatch/dispatch-docker# docker exec dispatch_postgres_1 ls /root/ dispatch-backup.dump root@pluck1:/dispatch/dispatch-docker#
/dispatch/dispatch-docker# docker-compose run web database restore Starting dispatch_postgres_1 ... done No JWT secret specified, this is required if you are using basic authentication. INCIDENT_DAILY_SUMMARY_ONCALL_SERVICE_ID has been deprecated. Please use INCIDENT_ONCALL_SERVICE_ID instead. No metric providers specified metrics will not be sent. : sh.ErrorReturnCode_1:
RAN: /usr/bin/psql -h antic1.fyre.ibm.com -p 5432 -U postgres -d dispatch_db -f dispatch-backup.dump
STDOUT:
STDERR: dispatch-backup.dump: No such file or directory
Thanks
The file will need to be copied to: /usr/src/dispatch/
docker cp dispatch-backup.dump dispatch_postgres_1:/usr/src/dispatch
From installation folder: /root/dispatch/dispatch-docker ran docker-compose run web database restore
See the same output I saw from previous post, No such file or directory Continuing to investigate the problem
dispatch I see is a file in this case? now containing the content of the .dump file is this correct?
dispatch/dispatch-docker# docker exec dispatch_postgres_1 ls -l /usr/src total 136 -rwxr-xr-x 1 root root 135423 Jul 16 16:45 dispatch /dispatch/dispatch-docker#
Sorry, I haven't done this within a container before. I think it would be easiest to copy your file to /
like you did initially and then directly specify it with the --dump-file
arg.
Like so:
docker-compose run web database restore --dump-file /dispatch-backup.dump
HI @kevgliss I see same result... Can you inform what log files I can look for on the file system which may provide more information as to what is causing the error?
Is it possibly a licensing isssue?
In my installation folder (or project folder) I see these files..
dispatch-backup.dump
docker-compose.yml
install.sh
Makefile
README.md
requirements.txt
requirements.txt.example
Any files missing? Should there also be an app.py in there? The requirements.txt file has no entries (just single comment)
plugins here
Thanks /Martin
The issue is we're copying the file to a container that we aren't using. Each time we run the restore command we create a new container that then exits, and since we don't mount a consistent volume to the webserver we get a new filesystem each time. If you simply want to restore the sample data, run this from the host itself skipping the containers entirely:
/usr/bin/psql -h localhost -p 5432 -U dispatch -d dispatch -f dispatch-backup.dump
The above assumes that you are running the postgres database with docker-compose, if you're running the database somewhere else adjust accordingly.
Not experience myself with docker and docker-compose. Perhaps this doesn't help. I had a look at some tutorials on docker and docker-compose. I am a little stumped on the last comment..
You mention I was copying a file to a container that isn't being used. The docker ps output however shows three containers: dispatch_scheduler_1, dispatch_web_1 & dispatch_postgres_1 that are up and running..based on images dispatch_postgres_1, dispatch-local-web & postgres:9.6 respectively.
How is it not been used? dispatch_postgres_1
If a new container is being created with the restore command that exists how come it cannot be seen in that printout with an Exited status?
Anyway ..I don't necessarily need to use the containers...I start and stop docker-dispatch this way. docker-compose up -d , docker-compose down
I have the database running on another host which has the data populated being pointed to in the .env file....
DATABASE_CREDENTIALS=postgres: DATABASE_HOSTNAME=antic1.fyre.ibm.com DATABASE_NAME=dispatch_db DATABASE_PORT=5432
Used by postgres docker
POSTGRES_DB=dispatch_db POSTGRES_PASSWORD=All4p1e1 POSTGRES_USER=postgres
What is the difference between the two sections above? is the latter section used by the postgres container? and should I comment that out now...
Just trying to get the application to pick up the sample data what ever way... Why is it not seeing it? Note I ran this command already on the other DB machine:
sudo -u postgres -i psql -h 127.0.0.1 -U postgres -p 5432 dispatch_db < /root/dispatch-sample-data.dump
How does the application read the database? from the defined DB properties in .env ?
@mccannm1 correct, from the env vars in .env
and the defaults in the config.py module.
@mvilanova After install of docker, docker-compose and the installation of dispatch itself (using install.sh)
Can you tell me why dispatch as a command is not recognised?
e.g. dispatch database init, dispatch database upgrade etc
seem to have a problem figuring how to get the data to the UI.. Will data restore do the trick? I have dispatch installed on one server and postgres installed on the other (dispatch)
@mvilanova After install of docker, docker-compose and the installation of dispatch itself (using install.sh)
Can you tell me why dispatch as a command is not recognised?
e.g. dispatch database init, dispatch database upgrade etc
seem to have a problem figuring how to get the data to the UI.. Will data restore do the trick? I have dispatch installed on one server and postgres installed on the other (dispatch)
Trying docker-compose build...
@mccannm1 I installed Dispatch using the ./install.sh
bash script and ran into some issues restoring from the dispatch-backup.dump
file and getting the database into a healthy state. I'll update the dump file and get back to you with a step by step process soon. Stay tuned
Thank you @mvilanova
Ok, sorry for the delay. It took way longer than I expected.
I've updated the sample data (https://github.com/Netflix/dispatch/pull/518) and bumped the Postgres version on the Dispatch docker side from 9.6 to latest (https://github.com/Netflix/dispatch-docker/pull/65) to make sure the dumps we create are compatible with the postgres version.
Here are the steps to get Dispatch up and running with some sample data:
master
with develop
in the docker-compose.yml file. You want to take advantage of the bug fixes and improvements in develop. They will make it to master
when we cut a new release probably next week.install.sh
.Incident configuration
section of the .env
file and add the following ones. We will update the example once we cut a new release.
docker-compose run web database drop
to drop the databasedocker cp dispatch-sample-data.dump <WEB_CONTAINER_ID>:/dispatch-sample-data.dump
to copy the sample data dump to the web container. You can get the container id by running docker container list
.docker exec -it dispatch_web_1 bash
to open a Bash shell on the web container.dispatch database restore --dump-file dispatch-sample-data.dump
to restore the database using the sample data dump.Let me know if you run into any issues.
Hi @mvilanova I ran the commands according to your instructions...and they seemed to have worked: but I do not see data in the UI Please see the attachments I had added..
I have included the docker-compose.yml and .env Thank you /Martin
In the docker-compose.yml file please note I updated the volume to the data location .... this is where the data is stored on the database server (antic) I specified.....however this didn't to make any difference.. to the UI data being populated.. dispatch-postgres:/var/lib/postgresql/12/main"
is the data visible to the application through a direct connection (port 5432) to a server with Postgres that has been manually installed, and .dump file imported to that database? OR through the web container..... dispatch_web_1
is the data visible to the application through a direct connection (port 5432) to a server with Postgres that has been manually installed, and .dump file imported to that database? OR through the web container..... dispatch_web_1
I'm not quite sure what you mean here... it looks like you aren't using the included version of postgres at all:
e.g. you have DATABASE_HOSTNAME=antic1.fyre.ibm.com
in you .env
so you could theortically disable all the postgres parts of the docker-compose.yml like this:
version: "3.4"
x-restart-policy: &restart_policy
restart: unless-stopped
services:
web:
<<: *restart_policy
build:
# Pro-tip: point this to a relative directory containing the Dispatch
# project root to pick up changes from your dev environment
# (e.g., ../dispatch-root)
context: https://github.com/Netflix/dispatch.git#develop:.
image: dispatch-local-web
env_file:
- .env
command: ["server", "start", "dispatch.main:app", "--host=0.0.0.0"]
ports:
- "8000:8000"
scheduler:
<<: *restart_policy
build:
# Pro-tip: point this to a relative directory containing the Dispatch
# project root to pick up changes from your dev environment
# (e.g., ../dispatch-root)
context: https://github.com/Netflix/dispatch.git#develop:.
args:
DISPATCH_LIGHT_BUILD: "1"
image: dispatch-local-scheduler
env_file:
- .env
environment:
- STATIC_DIR=
command: ["scheduler", "start"]
As I mentioned earlier in the thread I would just us the native psql tools for your particular setup:
/usr/bin/psql -h antic1.fyre.ibm.com -p 5432 -U dispatch -d dispatch -f dispatch-backup.dump
After which I would use psql (or some other application) to double check that data exists in your database:
/usr/bin/psql -h antic1.fyre.ibm.com -p 5432 -U dispatch -d dispatch
postgres=# \dt
HI @kevgliss I disabled Postgres in the YAML file.. when I start with .... docker-compose up -d ...
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c348dc4d3b9c dispatch-local-scheduler "dispatch schedule..." About a minute ago Up About a minute 8000/tcp dispatch_scheduler_1 f9128e515980 dispatch-local-web "dispatch server s..." About a minute ago Up About a minute 0.0.0.0:8000->8000/tcp dispatch_web_1 root@pluck1:~/dispatch/dispatch-docker#
From here would I run that /usr/bin/psql ... from the pluck1 server I suspect? where the dispatch is installed (not on antic1 where I have the DB installed)
On antic1:
root@antic1:~# sudo -u postgres psql could not change directory to "/root": Permission denied psql (12.3 (Ubuntu 12.3-1.pgdg20.04+1)) Type "help" for help.
postgres=# \c dispatch You are now connected to database "dispatch" as user "postgres". dispatch=# \dt
List of relations
Schema | Name | Type | Owner --------+--------------------------------------------+-------+---------- public | alembic_version | table | dispatch public | assoc_incident_tags | table | dispatch public | assoc_incident_terms | table | dispatch public | assoc_individual_contact_incident_priority | table | dispatch public | assoc_individual_contact_incident_type | table | dispatch public | assoc_individual_contact_terms | table | dispatch public | conference | table | dispatch public | conversation | table | dispatch public | definition | table | dispatch public | definition_teams | table | dispatch public | definition_terms | table | dispatch public | dispatch_user | table | dispatch public | document | table | dispatch public | document_incident | table | dispatch public | document_incident_priority | table | dispatch public | document_incident_type | table | dispatch public | document_terms | table | dispatch public | event | table | dispatch public | group | table | dispatch public | incident | table | dispatch public | incident_priority | table | dispatch public | incident_type | table | dispatch public | individual_contact | table | dispatch public | participant | table | dispatch public | participant_role | table | dispatch public | plugin | table | dispatch public | policy | table | dispatch public | recommendation | table | dispatch public | recommendation_accuracy | table | dispatch |
---|
Do those tables have any items?
I executed the plsql as shown
On antic1 some of the tables have rows...
on antic1 before I populated the database like this: root@antic1# sudo -u postgres -i psql -h 127.0.0.1 -U postgres -p 5432 dispatch < /root/dispatch-sample-data.dump
The dump file was taken from the repository...
This file shows the output data (all select statements for all 54 tables...
There is some data.... I presume the .dump file contains sample data to populate the various views/ dashboards in the User Interface?
the dispatch_data.txt
looks reasonable, what application error are you getting?
I am seeing that error in the UI when I access the dispatch server URL... Is there logging information elsewhere I can look for ? that may be more useful for you
@kevgliss @mvilanova I managed to get a dispatch database upgrade to execute as shown here dispatch_database_upgrade_success.txt
But again I cannot see the data being populated in the UI, same error "Something has gone very wrong....etc" Is there a fault in the repository? Are you experiencing any similar issues in deploying?
Hi @kevgliss @mvilanova Can you provide some guidance on what may be the issue as to why I cannot see data in the UI and see the error above? How to proceed? I understand you may be working on a new release? I have the docker-compose.yml set to develop to avail of the latest releases and fixes and I have updated the repository and run the install.sh again from scratch...but no luck..Please advise Thanks
@mccannm1
We think at this point we've exhausted our resources in helping troubleshooting your specific issues. Generally, our stance is to help folks as much as possible and answer specific questions or issues. But I think this has become largely a troubleshooting exercise for your deployment setup, which we can't and don't intend to provide support for. If during your investigation, you find specific bugs or issues we're more than happy to help triage those.
cc @mvilanova
Describe the bug This similar to issue: https://github.com/Netflix/dispatch/issues/416
Problem: I start the dispatch server: docker-compose up -d When I hit the URL http://server1.fyre.ibm.com:8000/dashboard I do see the page rendering but the views/dashboards are not getting populated and a message appears saying "Something has gone very wrong please retry or inform your admin you are receiving this error""
To Reproduce Steps to reproduce the behavior:
What I have done (below)
Hello Kevin I have been requested to investigate the possibility of using Netflix Dispatch as a new Incident Management solution in my organization. I have TWO Fyre Virtual machines server1, server2. The former is where the dispatch server is being installed and the second hosts the Postgres database that Dispatch relies on. I presume it is ok to have the server and DB on two separate machines? Both servers have Ubuntu OS. I have performed the following actions:
On server1, installed Docker (17.05.0) and Docker Compose (1.19.) cloned the git repository and ran the install.sh. (no configuration changes made until later) the install.sh produced the errors in attachment "Install_Dispatch.out", .. (this would be expected) Setting up database... No JWT secret specified, this is required if you are using basic authentication. NCIDENT_DAILY_SUMMARY_ONCALL_SERVICE_ID has been deprecated. Please use INCIDENT_ONCALL_SERVICE_ID instead. No metric providers specified metrics will not be sent. ERROR:dispatch.common.utils.cli:Something went wrong with creating plugin rows, is the database setup correctly? : :
On server2, installed PostgreSQL 12.3 created a new role called 'dispatch' :
su - postgres createuser --interactive --pwprompt Enter name of role to add: dispatch Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y
postgres=# \du List of roles Role name | Attributes | Member of -----------+------------------------------------------------------------+----------- dispatch | Superuser, Create role, Create DB | {} postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
and then imported the sample .dump file from the Git repository to populate the database 'dispatch_db'
drop database dispatch_db create database dispatch_db
sudo -u postgres -i psql -h 127.0.0.1 -U postgres -p 5432 dispatch_db < /root/dispatch-sample-data.dump This was successful. and postgres is listening on 5432
Finally I made some configuration changes on server1
I tried running the ./install.sh again.... but I still get the same error in the UI... the views are not getting populated.
I investigated further and used a small java application on server1 to connect to 'dispatch_db' and run a query on the database. e.g SELECT ID,NAME,DESCRIPTION FROM INCIDENT_PRIORITY
java -cp ./postgresql-42.2.14.jre7.jar:. Testserver1 //server2.fyre.ibm.com:5432/dispatch_db postgres
This worked and output the query data , but ONLY after making these necessary changes on the Postgres side:
Insert line host dispatch_db all/24 md5
in pg_hba.conf . This is to allow connections from clients
then restart postgres service
so at this point it is possible to connect and retrieve the data from Postgres to remote computers
However I still cannot see the data coming across in the UI..
QUESTIONS:
As far as I can see the database is ok.. Is there some other change I need to make to get the data across to the dispatch machine?
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.