mozilla-services / syncserver

Run-Your-Own Firefox Sync Server
Mozilla Public License 2.0
1.87k stars 145 forks source link

Add support for deploying via dockerflow pipeline. #90

Closed rfk closed 7 years ago

rfk commented 7 years ago

WIP for now...

vladikoff commented 7 years ago

cc @jbuck

vladikoff commented 7 years ago

@rfk could you please push to this PR again to trigger Circle CI. I don't have access

rfk commented 7 years ago

pushed

rfk commented 7 years ago

@vladikoff also I added you as a collaborator on this repo

vladikoff commented 7 years ago

@rfk

Collecting nose==0.9.18.1 (from -r dev-requirements.txt (line 2))
  Could not find a version that satisfies the requirement nose==0.9.18.1 (from -r dev-requirements.txt (line 2)) (from versions: 1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.6, 1.3.7)
  No distributions matching the version for nose==0.9.18.1 (from -r dev-requirements.txt (line 2))
make: *** [local/bin/flake8] Error 1

:(

rfk commented 7 years ago

Whoops; should be fixed in the latest push...

vladikoff commented 7 years ago

@rfk I was trying to run this with @jrgm and we are having issues.

@jrgm had luck getting it running by adding COPY ./syncserver.ini /app/syncserver.ini, but it is not clear if we need that or not.

jrgm commented 7 years ago

@jrgm had luck getting it running by adding COPY ./syncserver.ini /app/syncserver.ini, but it is not clear if we need that or not.

Yeah, that's not needed. I should be able to do SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db instead. Or SYNCSERVER_SQLURI=pymysql://root:...... for mysql.

rfk commented 7 years ago

had luck getting it running by adding COPY ./syncserver.ini /app/syncserver.ini, but it is not clear if we need that or not.

I would like for this not to be needed, relying instead on env vars.

jrgm commented 7 years ago

I also had to expose the port with -p 5000:5000, but in ansible docker_container, or in the dockerflow, something similar.

rfk commented 7 years ago

I've pushed some docs in the README on how to run the server from within the docker container; I'm yet to get the port exposed properly so I haven't been able to fully test them though.

jbuck commented 7 years ago

Creds have been added to the circle ci build job, so this should deploy to docker hub once it's merged to master

vladikoff commented 7 years ago

I started up the server with:

➜  syncserver git:(dockerflow) docker run --rm -p 5000:5000 -e SYNCSERVER_PUBLIC_URL=http://localhost:5000 -e SYNCSERVER_SECRET=5up3rS3kr1t -e SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db -e SYNCSERVER_BATCH_UPLOAD_ENABLED=true syncserver:latest /usr/local/bin/gunicorn --bind localhost:5000 syncserver.wsgi_app
[2017-05-11 18:00:32 +0000] [7] [INFO] Starting gunicorn 19.6.0
[2017-05-11 18:00:32 +0000] [7] [INFO] Listening at: http://127.0.0.1:5000 (7)
[2017-05-11 18:00:32 +0000] [7] [INFO] Using worker: sync
[2017-05-11 18:00:32 +0000] [11] [INFO] Booting worker with pid: 11
/usr/local/lib/python2.7/site-packages/tokenserver/verifiers.py:50: FutureWarning: The BrowserID certificate format has not been finalized and may change in backwards-incompatible ways.  If you find that the latest version of this module cannot verify a valid BrowserID assertion, please contact the author.
  super(LocalVerifier, self).__init__(**kwargs)

However, for http://127.0.0.1:5000/ and http://localhost:5000/ I'm getting

This page isn’t working

localhost didn’t send any data.
ERR_EMPTY_RESPONSE

Same for http://localhost:5000/token/1.0/sync/1.5

rfk commented 7 years ago

@vladikoff @jrgm this appears to be working now \o/

Here's what I did:

  1. Spun up an EC2 instance rather than trying to make it work via docker-for-windows
  2. In one terminal, build and run via docker: a. docker build -t syncserver:latest . b. docker run --rm --network host -p 5000:5000 -e SYNCSERVER_PUBLIC_URL=http://localhost:5000 -e SYNCSERVER_SECRET=xyz123 -e SYNCSERVER_SQLURI=sqlite:////tmp/syncserver.db -e SYNCSERVER_BATCH_UPLOAD_ENABLED=true syncserver:latest /usr/local/bin/gunicorn --bind localhost:5000 syncserver.wsgi_app
  3. In another terminal window, run the testsuite against the docker image a. make build b. ./local/bin/python -m syncstorage.tests.functional.test_storage --use-token-server http://localhost:5000/token/1.0/sync/1.5

What are next steps for trying this out in fxa-dev?

vladikoff commented 7 years ago

I tried rebuilding this locally and it's not working for me. However I'm gonna merge this so we can check if the circle ci build will boot up on my machine