Skip to content

Commit b57c125

Browse files
author
Janaka-Steph
committed
Deploy on OpenFaaS
1 parent 8e01d9f commit b57c125

14 files changed

+161
-202
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.DS_Store
3+
.idea/
4+
template

.gitignore

Lines changed: 2 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,13 @@
11
build
2+
dist
23
node_modules
34
public
45

5-
### Node template
6-
# Logs
76
logs
87
*.log
98
npm-debug.log*
109
yarn-debug.log*
1110
yarn-error.log*
1211

13-
# Runtime data
14-
pids
15-
*.pid
16-
*.seed
17-
*.pid.lock
18-
19-
# Directory for instrumented libs generated by jscoverage/JSCover
20-
lib-cov
21-
22-
# Coverage directory used by tools like istanbul
23-
coverage
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
41-
code/node_modules/
42-
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
46-
47-
# Optional npm cache directory
48-
.npm
49-
50-
# Optional eslint cache
51-
.eslintcache
52-
53-
# Optional REPL history
54-
.node_repl_history
55-
56-
# Output of 'npm pack'
57-
*.tgz
58-
59-
# Yarn Integrity file
60-
.yarn-integrity
61-
62-
# dotenv environment variables file
6312
.env
64-
65-
# parcel-bundler cache (https://parceljs.org/)
66-
.cache
67-
68-
# next.js build output
69-
.next
70-
71-
# nuxt.js build output
72-
.nuxt
73-
74-
# vuepress build output
75-
.vuepress/dist
76-
77-
# Serverless directories
78-
.serverless
79-
80-
81-
### macOS template
82-
# General
83-
.DS_Store
84-
.AppleDouble
85-
.LSOverride
86-
87-
# Icon must end with two \r
88-
Icon
89-
90-
# Thumbnails
91-
._*
92-
93-
# Files that might appear in the root of a volume
94-
.DocumentRevisions-V100
95-
.fseventsd
96-
.Spotlight-V100
97-
.TemporaryItems
98-
.Trashes
99-
.VolumeIcon.icns
100-
.com.apple.timemachine.donotpresent
101-
102-
# Directories potentially created on remote AFP share
103-
.AppleDB
104-
.AppleDesktop
105-
Network Trash Folder
106-
Temporary Items
107-
.apdisk
108-
109-
110-
### Linux template
111-
*~
112-
113-
# temporary files which can be created if a process still has a handle open of a deleted file
114-
.fuse_hidden*
115-
116-
# KDE directory preferences
117-
.directory
118-
119-
# Linux trash folder which might appear on any partition or disk
120-
.Trash-*
121-
122-
# .nfs files are created when an open file is removed but is still being accessed
123-
.nfs*
124-
125-
126-
### Windows template
127-
# Windows thumbnail cache files
128-
Thumbs.db
129-
ehthumbs.db
130-
ehthumbs_vista.db
131-
132-
# Dump file
133-
*.stackdump
134-
135-
# Folder config file
136-
[Dd]esktop.ini
137-
138-
# Recycle Bin used on file shares
139-
$RECYCLE.BIN/
140-
141-
# Windows Installer files
142-
*.cab
143-
*.msi
144-
*.msix
145-
*.msm
146-
*.msp
147-
148-
# Windows shortcuts
149-
*.lnk
150-
151-
152-
### JetBrains template
153-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
154-
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
155-
156-
# User-specific stuff
157-
.idea/**/workspace.xml
158-
.idea/**/tasks.xml
159-
.idea/**/usage.statistics.xml
160-
.idea/**/dictionaries
161-
.idea/**/shelf
162-
163-
# Sensitive or high-churn files
164-
.idea/**/dataSources/
165-
.idea/**/dataSources.ids
166-
.idea/**/dataSources.local.xml
167-
.idea/**/sqlDataSources.xml
168-
.idea/**/dynamic.xml
169-
.idea/**/uiDesigner.xml
170-
.idea/**/dbnavigator.xml
171-
172-
# Gradle
173-
.idea/**/gradle.xml
174-
.idea/**/libraries
175-
176-
# Gradle and Maven with auto-import
177-
# When using Gradle or Maven with auto-import, you should exclude module files,
178-
# since they will be recreated, and may cause churn. Uncomment if using
179-
# auto-import.
180-
# .idea/modules.xml
181-
# .idea/*.iml
182-
# .idea/modules
183-
184-
# CMake
185-
cmake-build-*/
186-
187-
# Mongo Explorer plugin
188-
.idea/**/mongoSettings.xml
189-
190-
# File-based project format
191-
*.iws
192-
193-
# IntelliJ
194-
out/
195-
196-
# mpeltonen/sbt-idea plugin
197-
.idea_modules/
198-
199-
# JIRA plugin
200-
atlassian-ide-plugin.xml
201-
202-
# Cursive Clojure plugin
203-
.idea/replstate.xml
204-
205-
# Crashlytics plugin (for Android Studio and IntelliJ)
206-
com_crashlytics_export_strings.xml
207-
crashlytics.properties
208-
crashlytics-build.properties
209-
fabric.properties
210-
211-
# Editor-based Rest Client
212-
.idea/httpRequests
13+
.DS_Store

Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM openfaas/of-watchdog:0.7.7 AS watchdog
2+
FROM alpine:3.10 AS runtime
3+
4+
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
5+
RUN chmod +x /usr/bin/fwatchdog
6+
7+
# Add non root user
8+
RUN addgroup -S app && adduser app -S -G app
9+
RUN chown app /home/app
10+
11+
WORKDIR /home/app/
12+
13+
USER app
14+
15+
# Don't forget to build locally first
16+
COPY ./dist /home/app/dist
17+
18+
ENV mode="static"
19+
ENV static_path="/home/app/dist"
20+
21+
ENV exec_timeout="10s"
22+
ENV write_timeout="11s"
23+
ENV read_timeout="11s"
24+
25+
HEALTHCHECK --interval=5s CMD [ -e /tmp/.lock ] || exit 1
26+
27+
CMD ["fwatchdog"]

README.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ Antora then copies the remaining UI assets to the site output.
2929

3030
- The Documentation Components stored in versioned branches (v4, v5, ...).
3131

32+
33+
== Hosted on OpenFaaS
34+
35+
Build the website locally, then
36+
37+
faas up
38+
39+

antora-playbook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ asciidoc:
2424
# handlebar replace helper will replace '{page-origin-branch}'
2525
codebaseurl: 'https://github.com/bitcoin-studio/Bitcoin-Programming-with-BitcoinJS/blob/{page-origin-branch}/code/'
2626
runtime:
27-
fetch: true
27+
fetch: true
28+
output:
29+
dir: ./dist

ingress/cert-manager.local

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDBDCCAeygAwIBAgIRAO7LzaSRTW5jUFm0FN0CFNMwDQYJKoZIhvcNAQELBQAw
3+
FzEVMBMGA1UEChMMY2VydC1tYW5hZ2VyMB4XDTIwMDUwODE4NDkxNloXDTIwMDgw
4+
NjE4NDkxNlowFzEVMBMGA1UEChMMY2VydC1tYW5hZ2VyMIIBIjANBgkqhkiG9w0B
5+
AQEFAAOCAQ8AMIIBCgKCAQEA5DfRz7/gjSqLIJWfPGH8lITOwyhZvYeaxYUmhn20
6+
AJlVTTi8jQFUdY+DJvh0v7cIKaIRjVwlTsqa/vkYGIaYMZTn3uQ/1DFw0c8Ed3fg
7+
ow5caKc3EMTcodQYUNt++7fZNWVl2OMANOMIhZO4A1BZfLpVreplk2ACv11EXuer
8+
7RtUrEFaino/aMh5VFLU0bNqvlUabH5NID60yBuQqtAUCslauG4fqXRxs29WMsO6
9+
mc57k2g0nNICm21x/sRYNpdGoT8DJ9jJTp7w0IR9NHiFMZZXSUfvbt2WeebYiLQ4
10+
AztO3AaPH5dJqXIloNVxrJF4THMJPB5ldm0T4yuc/JNkDQIDAQABo0swSTAOBgNV
11+
HQ8BAf8EBAMCBaAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDAYDVR0TAQH/BAIwADAU
12+
BgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZIhvcNAQELBQADggEBACuHAKznogst
13+
McsFdWrACfJSTLVEjUCWa/h6j9K0KZlUXo8CuWb1sTWYvAdfiuTJGm4dds9DvuDP
14+
/vghwDe0zQ2R/Hy4dheSTat+jSMc2CbIXhDP5JboZ9MzgieSIbjmMo0BdhvYbPgn
15+
HR6iF+E0tsRKnBCPER8fLiDp/bVE52hgBdIVzAvl7PNLPrIEH7N5l/CB/TjPrQym
16+
p5YNCaxkEmdkjH8LeUyc8QaWtGabrHF3uxTiwPl806jEuO8x7dNo01toTCSI/Yom
17+
hITB7jRAW8/SLL23C4uHHH67AIx3GfE4r6BAkw2PnsPHNlI2OWMScdWLVtB98Pig
18+
J2dzn3DTl9o=
19+
-----END CERTIFICATE-----

ingress/fn-ingress-le-prod.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: openfaas.com/v1alpha2
2+
kind: FunctionIngress
3+
metadata:
4+
name: bitcoinjs-guide
5+
namespace: openfaas
6+
spec:
7+
domain: "bitcoinjs-guide.rogue-paprika.top"
8+
function: "bitcoinjs-guide"
9+
ingressType: "nginx"
10+
path: "v5/(.*)"
11+
tls:
12+
enabled: true
13+
issuerRef:
14+
name: "letsencrypt-prod"
15+
kind: "Issuer"

ingress/fn-ingress-le-staging.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: openfaas.com/v1alpha2
2+
kind: FunctionIngress
3+
metadata:
4+
name: bitcoinjs-guide
5+
namespace: openfaas
6+
spec:
7+
domain: "bitcoinjs-guide.rogue-paprika.top"
8+
function: "bitcoinjs-guide"
9+
ingressType: "nginx"
10+
tls:
11+
enabled: true
12+
issuerRef:
13+
name: "letsencrypt-staging"
14+
kind: "Issuer"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: openfaas.com/v1alpha2
2+
kind: FunctionIngress
3+
metadata:
4+
name: bitcoinjs-guide
5+
namespace: openfaas
6+
spec:
7+
domain: "localhost"
8+
function: "bitcoinjs-guide"
9+
ingressType: "nginx"
10+
tls:
11+
enabled: true
12+
issuerRef:
13+
name: "selfsigned-issuer"
14+
kind: "Issuer"

ingress/issuer-le-prod.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: cert-manager.io/v1alpha2
2+
kind: Issuer
3+
metadata:
4+
name: letsencrypt-prod
5+
namespace: openfaas
6+
spec:
7+
acme:
8+
server: https://acme-v02.api.letsencrypt.org/directory
9+
10+
privateKeySecretRef:
11+
name: letsencrypt-prod
12+
solvers:
13+
- selector: {}
14+
http01:
15+
ingress:
16+
class: nginx

0 commit comments

Comments
 (0)