Generate build and run modified version of hypothesis in a production environment

Showing 1-3 of 3 messages
Generate build and run modified version of hypothesis in a production environment fico89 7/27/16 12:16 AM

Hi,

Do you have any instructions or recommendations to generate the build version of hypothesis after have done some modifications so we don't have to use the development environment to serve final users?
How do you deploy the back end in a production like environment?

Thanks in advance for your help.

Re: [h-dev] Generate build and run modified version of hypothesis in a production environment Nick Stenning 8/1/16 3:37 AM

Hi Federico,

We deploy h in production as a Docker container, which is built from the source code. You can see the process by which the container image is build in our Jenkinsfile, but the gist of it is just run something like:

make docker DOCKER_TAG=whatever_you_want

That will build the source code into an image called hypothesis/hypothesis:whatever_you_want. You can then either tag this image into a different repository (docker tag hypothesis/hypothesis:whatever_you_want fico89/hypothesis:latest, perhaps?), or you can docker save the image and then docker load it on another server.

We push the built image to the Docker Hub and deploy by docker pulling that image.

If you do this, you'll need to ensure you have appropriate config set in the environment for the docker container you run. At a bare minimum, I think you'll need something like this -- say in a file called hypothesis_env:

BROKER_URL=amqp://user:pass@rabbitmqhost:5672//
CLIENT_ID=<something unique>
CLIENT_SECRET=<unique secret value>
DATABASE_URL=postgres://user:pass@postgreshost:5432/h
ELASTICSEARCH_HOST=http://eshost:9200
REDIS_HOST=redishost
SECRET_KEY=<unique secret value>

The CLIENT_ID can by anything, but a UUID generated by uuidgen should be good. For the secrets (which should be different from one another) I'd suggest something like the output of python -c 'import base64; import os; print(base64.urlsafe_b64encode(os.urandom(48)))'.

Of course, you'll also need to set the values of BROKER_URL, DATABASE_URL, ELASTICSEARCH_HOST and REDIS_HOST appropriately once you know where those services run.

Once that's done, you can run Hypothesis using something like:

docker run -d -p 5000:5000 --env-file hypothesis_env

Sorry this is still so ad-hoc. We're investing time in improving the state of things for people who want to run their own services, but in the meantime running h in production is going to remain officially unsupported, for reasons which I assume are clear from the above :)

-N

--
Nick Stenning
Developer, Hypothesis

--
You received this message because you are subscribed to the Google Groups "dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@list.hypothes.is.
To post to this group, send email to d...@list.hypothes.is.
To view this discussion on the web visit https://groups.google.com/a/list.hypothes.is/d/msgid/dev/CAL8PYp%3DGB4WJ3tfRQTqYMa36%2BjdXAT%2BUftXpQqr%2B3yJVUf1h-g%40mail.gmail.com.

Re: [h-dev] Generate build and run modified version of hypothesis in a production environment fico89 8/1/16 1:55 PM
Thanks! :)
--

FEDERICO LÓPEZ GÓMEZ
Ingeniero de Sistemas
Universidad del Valle