Skip to content

Commit 85e01b9

Browse files
authored
Merge branch 'master' into consuming-apis-python
2 parents db09b75 + 113fe97 commit 85e01b9

39 files changed

+2477
-4
lines changed

flask-connexion-rest-part-2/version_1/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
app = connex_app.app
1313

1414
# Build the Sqlite ULR for SqlAlchemy
15-
sqlite_url = "sqlite:////" + os.path.join(basedir, "people.db")
15+
sqlite_url = "sqlite:///" + os.path.join(basedir, "people.db")
1616

1717
# Configure the SqlAlchemy part of the app instance
1818
app.config["SQLALCHEMY_ECHO"] = True

python-bindings/overview_article/cmult.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
float cmult(int int_param, float float_param) {
66
float return_value = int_param * float_param;
7-
printf(" In cmult : int: %d float %.1f returning %.1f\n", int_param,
7+
printf(" In cmult : int %d float %.1f returning %.1f\n", int_param,
88
float_param, return_value);
99
return return_value;
1010
}

python-bindings/overview_article/cppmult.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
float cppmult(int int_param, float float_param) {
77
float return_value = int_param * float_param;
88
std::cout << std::setprecision(1) << std::fixed
9-
<< " In cppmul: int: " << int_param
9+
<< " In cppmul: int " << int_param
1010
<< " float " << float_param
1111
<< " returning " << return_value
1212
<< std::endl;

python-menus-toolbars/sample-app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def copyContent(self):
199199

200200
def pasteContent(self):
201201
# Logic for pasting content goes here...
202-
self.centralWidget.setText("<b>Edit > Pate</b> clicked")
202+
self.centralWidget.setText("<b>Edit > Paste</b> clicked")
203203

204204
def cutContent(self):
205205
# Logic for cutting content goes here...
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Running the Example
2+
3+
1. Install Docker if you haven't already.
4+
2. Run `./build_and_run.sh`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
./gen_certs.sh
4+
5+
DOCKER_BUILDKIT=1 docker build . -f marketplace/Dockerfile -t marketplace --secret id=ca.key,src=ca.key
6+
DOCKER_BUILDKIT=1 docker build . -f recommendations/Dockerfile -t recommendations --secret id=ca.key,src=ca.key
7+
8+
docker-compose up
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.8"
2+
services:
3+
4+
marketplace:
5+
environment:
6+
RECOMMENDATIONS_HOST: recommendations
7+
# DOCKER_BUILDKIT=1 docker build . -f marketplace/Dockerfile \
8+
# -t marketplace --secret id=ca.key,src=ca.key
9+
image: marketplace
10+
networks:
11+
- microservices
12+
ports:
13+
- 5000:5000
14+
15+
recommendations:
16+
# DOCKER_BUILDKIT=1 docker build . -f recommendations/Dockerfile \
17+
# -t recommendations --secret id=ca.key,src=ca.key
18+
image: recommendations
19+
networks:
20+
- microservices
21+
22+
networks:
23+
microservices:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Generate CA key and self-signed cert
4+
openssl req -x509 -nodes -newkey rsa:4096 -keyout ca.key -out ca.pem -subj /O=me
5+
6+
# Generate a private key and certificate signing request for the client and server
7+
openssl req -nodes -newkey rsa:4096 -keyout client.key -out client.csr -subj /CN=marketplace
8+
openssl req -nodes -newkey rsa:4096 -keyout server.key -out server.csr -subj /CN=recommendations
9+
10+
# Sign the client and server certs with the CA cert
11+
openssl x509 -req -in client.csr -CA ca.pem -CAkey ca.key -set_serial 1 -out client.pem
12+
openssl x509 -req -in server.csr -CA ca.pem -CAkey ca.key -set_serial 1 -out server.pem
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
docker-compose up -d
6+
trap "docker-compose down" EXIT
7+
8+
sleep 5 # Give the services time to warm up
9+
docker-compose exec marketplace pytest
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: marketplace
6+
labels:
7+
app: marketplace
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: marketplace
13+
template:
14+
metadata:
15+
labels:
16+
app: marketplace
17+
spec:
18+
containers:
19+
- name: marketplace
20+
image: hidan/python-microservices-article-marketplace:0.1
21+
env:
22+
- name: RECOMMENDATIONS_HOST
23+
value: recommendations
24+
---
25+
apiVersion: apps/v1
26+
kind: Deployment
27+
metadata:
28+
name: recommendations
29+
labels:
30+
app: recommendations
31+
spec:
32+
replicas: 1
33+
selector:
34+
matchLabels:
35+
app: recommendations
36+
template:
37+
metadata:
38+
labels:
39+
app: recommendations
40+
spec:
41+
containers:
42+
- name: recommendations
43+
image: hidan/python-microservices-article-recommendations:0.1
44+
---
45+
apiVersion: v1
46+
kind: Service
47+
metadata:
48+
name: recommendations
49+
spec:
50+
selector:
51+
app: recommendations
52+
ports:
53+
- protocol: TCP
54+
port: 50051
55+
targetPort: 50051
56+
---
57+
apiVersion: v1
58+
kind: Service
59+
metadata:
60+
name: marketplace
61+
spec:
62+
type: LoadBalancer
63+
selector:
64+
app: marketplace
65+
ports:
66+
- protocol: TCP
67+
port: 5000
68+
targetPort: 5000

0 commit comments

Comments
 (0)