Skip to content

Instantly share code, notes, and snippets.

@Bill
Last active July 8, 2022 07:10
Show Gist options
  • Save Bill/fc94b3814bef00ebf44d to your computer and use it in GitHub Desktop.
Save Bill/fc94b3814bef00ebf44d to your computer and use it in GitHub Desktop.
Run a local Hypothes.is annotation server (and the services it needs) via docker-compose
# This docker-compose.yml will run the Hypothes.is annotation server.
# (adapted from instructions here https://h.readthedocs.org/en/latest/INSTALL.html)
#
# Place this file in the working directory (clone of https://github.com/hypothesis/h)
# run with docker-compose up -d
#
# Now browse to Hypothes.is at http://192.168.59.103:8000/ and create an account
# You'll see the invitation email in Mailcatcher at http://192.168.59.103:1080/
# Click that invitation link and log in on your local Hypothes.is
# And you are ready to annotate!
hh:
image: hypothesis/h
environment:
DATABASE_URL: postgresql://postgres:foo@postgres/postgres
MAIL_PORT_25_TCP_ADDR: 192.168.59.103
MAIL_PORT_25_TCP_PORT: 25
MODEL_CREATE_ALL: true
ports:
- "8000:8000"
links:
- postgres
- elasticsearch
- nsqd
- redis
- mail
elasticsearch:
image: nickstenning/elasticsearch-icu
nsqd:
image: nsqio/nsq
ports:
- "4150"
- "4151"
command: /nsqd
redis:
image: redis
postgres:
image: postgres
environment:
POSTGRES_PASSWORD: foo
mail:
image: schickling/mailcatcher
ports:
- "1080:1080"
- "25:1025"
@fishfree
Copy link

fishfree commented Jun 2, 2021

@kemifl, I notice that the EXPOSE port of hypothesis/hypothesis is 5000, so change ports: - "8000:8000" to ports: - "8000:5000"

But now, Nginx 502 bad gateway returned.

@lukaszgiez
Copy link

Hi Bill,
thank you for the yml file. Iam trying to use h for annotating documentation in our internal project so I am running a local h server and client, and I have run into these issues:

  1. sign up via mailer doesn't work: on the h sign up screen I get the nginx 504 Gateway Time-out error. I log into the mailcatcher and no mails are present there.
    I can effectively create users only via terminal tox command. This works but is far from ideal.
  2. saving annotations doesn't work smoothly: the spinner spins and I get the Saving annotation error, but weirdly, the annotations do get saved on the server (on signing in to a user, we can see the annotations, and after a while they do stick in the client too!).

Now, I am rather new to docker and setting up a project like that so I have a lot to catch up on.
I enclose my docker-compose.yml with my local ip and ID replaced with myIP and myID:

version: '3'
services:
  postgres:
    image: postgres:11.5-alpine
    ports:
      - '127.0.0.1:5432:5432'
    healthcheck:
        test: ["CMD", "pg_isready", "-U", "postgres"]
        interval: 1s
  elasticsearch:
    image: hypothesis/elasticsearch:latest
    ports:
      - '127.0.0.1:9200:9200'
    environment:
      - discovery.type=single-node
  rabbit:
    image: rabbitmq:3.6-management-alpine
    ports:
      - '127.0.0.1:5672:5672'
      - '127.0.0.1:15672:15672'
  mail:
    image: schickling/mailcatcher
    ports:
      - "1080:1080"
      - "25:1025"
  hypothesis:
    image: hypothesis/hypothesis
    ports:
    - '5000:5000'
    environment:
    - APP_URL=http://localhost:5000
    - AUTHORITY=localhost
    - BROKER_URL=amqp://guest:guest@rabbitmq:5672
    - DATABASE_URL=postgresql://postgres@postgres/postgres
    - ELASTICSEARCH_URL=http://elasticsearch:9200
    - SECRET_KEY=notasecret
    - CLIENT_URL=http://myIP:3001/hypothesis
    - CLIENT_OAUTH_ID=myId
    - MODEL_CREATE_ALL=true
    - MAIL_PORT_25_TCP_ADDR=myIP
    - MAIL_PORT_25_TCP_PORT=25

Is there sth amiss/undefined in the yml file?
I am also totally new to databases and am not sure if postgres environment is correctly configured above.
Nothing is obvious to me, so even if it's simple to you, it may be where I am totally ignorant.
I hope you can assist!
lukasz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment