Skip to content

Commit 4a42fd3

Browse files
committed
updated readme
1 parent ac84989 commit 4a42fd3

File tree

3 files changed

+76
-4
lines changed

3 files changed

+76
-4
lines changed

assets/swagger.png

77.4 KB
Loading

certs/generate-certs.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
set -e
44

5-
source ../colors.sh
5+
GREEN='\033[0;32m'
6+
ENDC='\033[0m'
67

78
DOMAIN=$1
89
CERTBOT=$(which certbot)

readme.md

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
An entire setup to run your quantum circuits in a separated machine.
88

9-
# Why?
9+
## Why?
1010

1111
The main reason for this project was a problem I had during my first scientific research.
1212

@@ -33,7 +33,7 @@ I'm not saying that using these cloud providers are bad, but there's always some
3333

3434
Also, for experiments aiming to test hardware and quantum algorithms in real scenarios, submitting to a real hardware is always the best idea.
3535

36-
# QServer is for who?
36+
## QServer is for who?
3737

3838
Saying the reasons I've built qserver, here's a list of who can be beneficiated by using this:
3939

@@ -43,7 +43,7 @@ Saying the reasons I've built qserver, here's a list of who can be beneficiated
4343
- Quantum computing enthusiasts
4444

4545

46-
# How does it work?
46+
## How does it work?
4747

4848
This project is developed as multiple services orchestrated via docker compose.
4949

@@ -89,3 +89,74 @@ Doing that, the data is saved on a Postgres DB.
8989
You can see the Structure below:
9090

9191
![database diagram](./assets/database.jpg)
92+
93+
## How to use?
94+
95+
To run all that, you must install docker along with docker compose. Then get the compose file you want:
96+
97+
```bash
98+
wget https://raw.githubusercontent.com/Dpbm/qserver/refs/heads/main/compose.yml
99+
100+
# or
101+
102+
wget https://raw.githubusercontent.com/Dpbm/qserver/refs/heads/main/ghcr-prod-compose.yml
103+
```
104+
105+
Then, you must set some env variables to configure the services access:
106+
107+
```bash
108+
export DB_USERNAME="your user for db"
109+
export DB_PASSWORD="you db user password"
110+
export DB_ROOT_USER="root username"
111+
export DB_ROOT_PASSWORD="root db user password"
112+
export RABBITMQ_USER="rabbitmq username"
113+
export RABBITMQ_PASSWORD="rabbitmq password"
114+
```
115+
116+
Also, if you want to add https, you need to setup the `DOMAIN` variable:
117+
118+
```bash
119+
export DOMAIN="your domain"
120+
```
121+
122+
It's not mandatory, but we recommend you doing that. In case you're going to setup HTTPS, there's a script to setup your certs using `certbot`. Doing that is, sometimes, very trick, so I'm letting here the setup I did in my environment, but remember to check [let's encrypt documentation](https://letsencrypt.org/docs/) and [certbot's](https://certbot.eff.org/) as well.
123+
124+
In my case, I bought a real domain that can be reach outside on the internet and them used certbot to generate the certificates.
125+
126+
```bash
127+
# install certbot (check: https://certbot.eff.org/instructions?ws=nginx&os=pip)
128+
sudo apt update && sudo apt install python3 python3-venv libaugeas0
129+
sudo pip install certbot
130+
131+
# get and run the script
132+
cd /tmp
133+
wget https://raw.githubusercontent.com/Dpbm/qserver/refs/heads/main/certs/generate-certs.sh
134+
chmod +x ./generate-certs.sh && ./generate-certs.sh your-domain
135+
```
136+
137+
Doing that, certbot will request you to add some information and then adding a acme challenge via DNS. Check your provider's documentation to see how to add that.
138+
By the end of this process, certbot will generate the `.pem` files and will store that at `/etc/letsencrypt/archive/{your-domain}/`. This location is going to be mounted inside docker when running, so you don't need to do anything else.
139+
140+
Once we are running on a local network, it's not possible to access the domain right away. So to run:
141+
142+
```bash
143+
sudo echo "172.18.0.30 your-domain" | sudo tee -a /etc/hosts
144+
```
145+
146+
It's not required for cloud providers, by for local running it's a good option.
147+
148+
If you have this server running in the same network, but on a different machine, make the mapping using the other computer's IP.
149+
150+
Setting this up, we can run the docker compose file as:
151+
152+
```bash
153+
# for dockerhub images
154+
docker compose up -d
155+
156+
# for ghcr images
157+
docker compose -f ./ghcr-prod-compose.yml up -d
158+
```
159+
160+
After some minutes, the server is ready to be used. You can check its API endpoints at: `http://your-domain:8080/swagger/index.html`, `https://your-domain/swagger/index.html` or even `http://172.18.0.30:8080/swagger/index.html` (remember this IP may change depending on where you're running it).
161+
162+
![swagger](./assets/swagger.png)

0 commit comments

Comments
 (0)