Skip to content

Commit

Permalink
adapt port (#16)
Browse files Browse the repository at this point in the history
* adapt port

* change redis port

Co-authored-by: Philipp Wundrack <[email protected]>
  • Loading branch information
salmma and PhilWun authored Jun 16, 2021
1 parent 1b3402b commit 4ae0fa1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ RUN apt-get install -y gcc python3-dev
RUN pip install -r requirements.txt
COPY . /app

EXPOSE 5000/tcp
EXPOSE 5013/tcp

ENV FLASK_APP=qiskit-service.py
ENV FLASK_ENV=development
ENV FLASK_DEBUG=0
RUN echo "python -m flask db upgrade" > /app/startup.sh
RUN echo "gunicorn qiskit-service:app -b 0.0.0.0:5000 -w 4 --timeout 500 --log-level info" >> /app/startup.sh
RUN echo "gunicorn qiskit-service:app -b 0.0.0.0:5013 -w 4 --timeout 500 --log-level info" >> /app/startup.sh
CMD [ "sh", "/app/startup.sh" ]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docker-compose pull
docker-compose up
```

Now the qiskit-service is available on http://localhost:5000/.
Now the qiskit-service is available on http://localhost:5013/.

## Transpilation Request
Send implementation, input, QPU information, and your IBM Quantum Experience token to the API to get depth and width of the transpiled circuit and the transpiled OpenQASM circuit itself.
Expand Down
2 changes: 1 addition & 1 deletion app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@

from app import routes, result_model, errors

app.redis = Redis.from_url(app.config['REDIS_URL'])
app.redis = Redis.from_url(app.config['REDIS_URL'], port=5040)
app.execute_queue = rq.Queue('qiskit-service_execute', connection=app.redis, default_timeout=3600)
app.logger.setLevel(logging.INFO)
2 changes: 1 addition & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ class Config(object):
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///' + os.path.join(basedir, 'app.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False

REDIS_URL = os.environ.get('REDIS_URL') or 'redis://'
REDIS_URL = os.environ.get('REDIS_URL') or 'redis://localhost:5040'
15 changes: 8 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ volumes:
services:
redis:
image: redis:latest
command: --port 5040
ports:
- "6379:6379"
- "5040:5040"
networks:
- default
qiskit-service:
image: planqk/qiskit-service:latest
command: sh /app/startup.sh
ports:
- "5000:5000"
- "5013:5013"
environment:
- REDIS_URL=redis://redis
- REDIS_URL=redis://redis:5040
- DATABASE_URL=sqlite:////data/app.db
volumes:
- exec_data:/data
Expand All @@ -25,24 +26,24 @@ services:

rq-worker:
image: planqk/qiskit-service:latest
command: rq worker --url redis://redis qiskit-service_execute
command: rq worker --url redis://redis:5040 qiskit-service_execute
environment:
- REDIS_URL=redis://redis
- REDIS_URL=redis://redis:5040
- DATABASE_URL=sqlite:////data/app.db
volumes:
- exec_data:/data
depends_on:
- redis
deploy:
replicas: 4
replicas: 2


rq-dashboard:
image: eoranged/rq-dashboard
ports:
- "9181:9181"
environment:
- RQ_DASHBOARD_REDIS_URL=redis://redis:6379
- RQ_DASHBOARD_REDIS_URL=redis://redis:5040

networks:
default:
Expand Down
1 change: 1 addition & 0 deletions docs/dev/run-as-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ docker build -t planqk/qiskit-service:latest .
docker-compose up
```
## Local Setup
At _Run > Edit Configurations..._ set `Environment variables: FLASK_RUN_PORT=5013`.

### Python Packages
Install packages as listed in [requirements.txt](https://github.com/PlanQK/qiskit-service/blob/master/requirements.txt).
Expand Down

0 comments on commit 4ae0fa1

Please sign in to comment.