toptal/haste-server

Unable to use Postgres Database as storage in Docker

woongzeyi opened this issue · 4 comments

Situation

I followed the instruction to create a haste server Docker image and failed to deployed it alongside with a Postgres database, both connected to a Docker network.
I received an exception and a complete log from the program.

Steps to reproduce

  1. Install Docker in an Ubuntu OS version 20.04.2 LTS system
  2. Create a Docker network. docker network create haste-network
  3. Git clone this repo into a temporary folder, cd into where the Dockerfile is located and run docker build --tag haste-server . to build into an image. Now you get a haste-server Docker image.
  4. Pull Postgres image from docker with docker pull postgres. Deploy it with the following command:
docker run --name haste-database -e POSTGRES_PASSWORD=hastenetwork -d --network haste-network postgres
  1. Bash into Postgres database.
docker run -it --rm --network haste-network postgres psql -h haste-database -U postgres
  1. Create table in database.
create table entries (id serial primary key, key varchar(255) not null, value text not null, expiration int, unique(key));
  1. Exit from bash and deploy haste-server with command:
docker run --name haste --network haste-network -d -p 7778:7777 --env STORAGE_TYPE=postgres --env STORAGE_HOST=172.18.0.2 --env STORAGE_PORT=5432 --env STORAGE_DB=postgres --env STORAGE_PASSWORD=hastenetwork --env STORAGE_USERNAME=postgres haste-server
  1. Run docker logs haste and now you'll see the exception being popped out.

Hey there,
Neither your exception nor your logs are available to be viewed. In this context I'd suggest combining them into one Gist and linking that way.

Please provide logs and an exception that you are encountering

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.