Skip to content

Commit a6212cc

Browse files
author
Andrew Chen
committed
update docker-compose and root readme
1 parent f77e156 commit a6212cc

File tree

9 files changed

+75
-37
lines changed

9 files changed

+75
-37
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ Here you'll find full example integration apps using our [**client libraries**][
1111
- [Java][java-example]
1212

1313
If [docker][] is available to you, you can quickly spin up an example using: `% make QUICKSTART=go up`.
14-
Be sure to have `PLAID_CLIENT_ID`, `PLAID_SECRET`, and `PLAID_PUBLIC_KEY` defined in your environment or
14+
Be sure to have `PLAID_CLIENT_ID` and `PLAID_SECRET` defined in your environment or
1515
replace the respective `${VARIABLES}` in the `x-environment` section in
1616
[`docker-compose.yml`](/docker-compose.yml) directly.
17-
To further adjust quickstart to your use-case define `PLAID_PRODUCTS`, `PLAID_COUNTRY_CODES`,
18-
`PLAID_OAUTH_REDIRECT_URI`, `PLAID_OAUTH_NONCE` in your environment or set the respective
19-
`${VARIABLES}` in in the `x-environment` section in [`docker-compose.yml`](/docker-compose.yml) directly.
17+
18+
To further adjust the quickstart to your use-case, you can define `PLAID_PRODUCTS`, `PLAID_COUNTRY_CODES`,
19+
`PLAID_REDIRECT_URI` in your environment or set the respective `${VARIABLES}` in in the `x-environment`
20+
section in [`docker-compose.yml`](/docker-compose.yml) directly.
2021

2122
To see the log output of the quickstart run: `% make QUICKSTART=go logs` (when done, quit using `CTRL-C`).
2223

docker-compose.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,42 @@ version: "3.4"
22
x-environment: &QUICKSTART_ENVIRONMENT
33
PLAID_CLIENT_ID: ${PLAID_CLIENT_ID}
44
PLAID_SECRET: ${PLAID_SECRET}
5-
PLAID_PUBLIC_KEY: ${PLAID_PUBLIC_KEY}
65
PLAID_PRODUCTS: transactions
76
PLAID_COUNTRY_CODES: US,CA
8-
PLAID_OAUTH_REDIRECT_URI:
9-
PLAID_OAUTH_NONCE:
7+
PLAID_REDIRECT_URI:
108
services:
119
go:
1210
build:
13-
context: ./go
11+
context: .
12+
dockerfile: ./go/Dockerfile
1413
ports: ["8000:8000"]
1514
environment:
1615
<< : *QUICKSTART_ENVIRONMENT
1716
java:
18-
build: ./java
19-
ports: ["8080:8080"]
17+
build:
18+
context: .
19+
dockerfile: ./java/Dockerfile
20+
ports: ["8000:8000"]
2021
environment:
2122
<< : *QUICKSTART_ENVIRONMENT
2223
node:
23-
build: ./node
24+
build:
25+
context: .
26+
dockerfile: ./node/Dockerfile
2427
ports: ["8000:8000"]
2528
environment:
2629
<< : *QUICKSTART_ENVIRONMENT
2730
python:
28-
build: ./python
29-
ports: ["5000:5000"]
31+
build:
32+
context: .
33+
dockerfile: ./python/Dockerfile
34+
ports: ["8000:8000"]
3035
environment:
3136
<< : *QUICKSTART_ENVIRONMENT
3237
ruby:
33-
build: ./ruby
34-
ports: ["4567:4567"]
38+
build:
39+
context: .
40+
dockerfile: ./ruby/Dockerfile
41+
ports: ["8000:8000"]
3542
environment:
3643
<< : *QUICKSTART_ENVIRONMENT

go/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ FROM golang:1.12 AS build
22

33
WORKDIR /opt/src
44
COPY . .
5+
WORKDIR /opt/src/go
6+
57
RUN go get -d -v ./...
68
RUN go build -o quickstart
79

810
FROM gcr.io/distroless/base-debian10
911
#FROM gcr.io/distroless/base-debian10:debug
10-
COPY --from=build /opt/src/quickstart /
11-
COPY static/ /static
12-
COPY templates/ /templates
12+
COPY --from=build /opt/src/go/quickstart /
13+
# COPY static/ /static
14+
COPY html/ /html
1315

1416
EXPOSE 8000
1517
ENTRYPOINT ["/quickstart"]

java/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM maven:openjdk
22

33
WORKDIR /opt/app
44
COPY . .
5+
WORKDIR /opt/app/java
6+
57
RUN mvn clean package
68

79
EXPOSE 8000

node/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM node:alpine
22

33
WORKDIR /opt/app
44
COPY --chown=node:node . .
5+
WORKDIR /opt/app/node
6+
57
RUN npm install
68

79
EXPOSE 8000

node/index.js

+32-13
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,22 @@ app.post('/api/info', function(request, response, next) {
7878
// Create a link token with configs which we can then use to initialize Plaid Link client-side.
7979
// See https://plaid.com/docs/#create-link-token
8080
app.post('/api/create_link_token', function(request, response, next) {
81-
client.createLinkToken(
82-
{
83-
'user': {
84-
// This should correspond to a unique id for the current user.
85-
'client_user_id': 'user-id',
86-
},
87-
'client_name': "Plaid Quickstart",
88-
'products': PLAID_PRODUCTS,
89-
'country_codes': PLAID_COUNTRY_CODES,
90-
'language': "en",
91-
'redirect_uri': PLAID_REDIRECT_URI,
92-
}
93-
, function(error, createTokenResponse) {
81+
const configs = {
82+
'user': {
83+
// This should correspond to a unique id for the current user.
84+
'client_user_id': 'user-id',
85+
},
86+
'client_name': "Plaid Quickstart",
87+
'products': PLAID_PRODUCTS,
88+
'country_codes': PLAID_COUNTRY_CODES,
89+
'language': "en",
90+
}
91+
92+
if (PLAID_REDIRECT_URI !== '') {
93+
configs.redirect_uri = PLAID_REDIRECT_URI;
94+
}
95+
96+
client.createLinkToken(configs, function(error, createTokenResponse) {
9497
if (error != null) {
9598
prettyPrintResponse(error);
9699
return response.json({
@@ -127,6 +130,22 @@ app.post('/api/create_link_token_for_payment', function(request, response, next)
127130
prettyPrintResponse(createPaymentResponse)
128131
var paymentId = createPaymentResponse.payment_id
129132
PAYMENT_ID = paymentId;
133+
const configs = {
134+
'user': {
135+
// This should correspond to a unique id for the current user.
136+
'client_user_id': 'user-id',
137+
},
138+
'client_name': "Plaid Quickstart",
139+
'products': PLAID_PRODUCTS,
140+
'country_codes': PLAID_COUNTRY_CODES,
141+
'language': "en",
142+
'payment_initiation': {
143+
'payment_id': paymentId
144+
}
145+
};
146+
if (PLAID_REDIRECT_URI !== '') {
147+
configs.redirect_uri = PLAID_REDIRECT_URI;
148+
}
130149
client.createLinkToken(
131150
{
132151
'user': {

python/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ FROM python:alpine
22

33
WORKDIR /opt/app
44
COPY . .
5+
WORKDIR /opt/app/python
6+
57
RUN pip3 install -r requirements.txt
68

7-
ENV FLASK_APP=/opt/src/server.py
8-
EXPOSE 5000
9+
ENV FLASK_APP=/opt/app/python/server.py
10+
EXPOSE 8000
911
ENTRYPOINT ["python"]
10-
CMD ["-m", "flask", "run", "--host=0.0.0.0"]
12+
CMD ["-m", "flask", "run", "--host=0.0.0.0", "--port=8000"]

python/server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131

3232
# Parameters used for the OAuth redirect Link flow.
3333
#
34-
# Set PLAID_REDIRECT_URI to 'http://localhost:5000/oauth-response.html'
34+
# Set PLAID_REDIRECT_URI to 'http://localhost:8000/oauth-response.html'
3535
# The OAuth redirect flow requires an endpoint on the developer's website
3636
# that the bank website should redirect to. You will need to configure
3737
# this redirect URI for your client ID through the Plaid developer dashboard
3838
# at https://dashboard.plaid.com/team/api.
39-
PLAID_REDIRECT_URI = os.getenv('PLAID_REDIRECT_URI', '')
39+
PLAID_REDIRECT_URI = os.getenv('PLAID_REDIRECT_URI')
4040

4141
client = plaid.Client(client_id=PLAID_CLIENT_ID,
4242
secret=PLAID_SECRET,

ruby/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ FROM ruby:alpine
22

33
WORKDIR /opt/app
44
COPY . .
5+
WORKDIR /opt/app/ruby
6+
7+
RUN bundle update --bundler
58
RUN bundle install
69

7-
EXPOSE 4567
10+
EXPOSE 8000
811
ENTRYPOINT ["ruby"]
912
CMD ["app.rb", "-o", "0.0.0.0"]

0 commit comments

Comments
 (0)