1 | # Faas #
|
2 |
|
3 | Faas is a cloud service that provides a blind proxy and secure
|
4 | real-time pipeline to reach APIs running on sensitive systems behind a
|
5 | firewalled network or closed system without requiring any inbound
|
6 | ports or web servers to be exposed to the internet.
|
7 |
|
8 | This npm module provides the libraries needed to serve an API from a
|
9 | client system.
|
10 |
|
11 | ## Installation & Setup ##
|
12 |
|
13 | ### Quick-Start Demo: Node.js ###
|
14 |
|
15 | 1. In your project directory, install the faas library:
|
16 |
|
17 | npm install faas
|
18 |
|
19 | 2. Generate a simple demo startup script and API files:
|
20 |
|
21 | ./node_modules/faas/demos/node/generate.sh
|
22 |
|
23 | # OR `npm root`/faas/demos/node/generate.sh
|
24 |
|
25 | This creates the file `./faas_demo_start.sh` and the `faas_demo_apis` directory.
|
26 |
|
27 | 3. Start your API server:
|
28 |
|
29 | ./faas_demo_start.sh
|
30 |
|
31 | 4. Open a browser to [https://api.faas.io/demo](https://api.faas.io/demo)
|
32 | and watch your API server in action!
|
33 |
|
34 |
|
35 | ### Quick-Start Demo: Java ###
|
36 |
|
37 | 1. In your project directory, install the faas library:
|
38 |
|
39 | npm install faas
|
40 |
|
41 | 2. Generate a simple demo startup script and API files:
|
42 |
|
43 | ./node_modules/faas/demos/java/generate.sh
|
44 |
|
45 | # OR `npm root`/faas/demos/java/generate.sh
|
46 |
|
47 | This creates the file `./faas_demo_start.sh`, and the `faas_demo_apis` directory.
|
48 |
|
49 | 3. Start your API server:
|
50 |
|
51 | ./faas_demo_start.sh
|
52 |
|
53 | 4. Open a browser to [https://api.faas.io/demo](https://api.faas.io/demo)
|
54 | and watch your API server in action!
|
55 |
|
56 |
|
57 | ### Quick-Start Demo: Ruby ###
|
58 |
|
59 | 1. In your project directory, install the faas library:
|
60 |
|
61 | npm install faas
|
62 |
|
63 | 2. Generate a simple demo startup script and API files:
|
64 |
|
65 | ./node_modules/faas/demos/ruby/generate.sh
|
66 |
|
67 | # OR `npm root`/faas/demos/ruby/generate.sh
|
68 |
|
69 | This creates the file `./faas_demo_start.sh`, and the `faas_demo_apis` directory.
|
70 |
|
71 | 3. Start your API server:
|
72 |
|
73 | ./faas_demo_start.sh
|
74 |
|
75 | 4. Open a browser to [https://api.faas.io/demo](https://api.faas.io/demo)
|
76 | and watch your API server in action!
|
77 |
|
78 |
|
79 | ### Quick-Start Demo: HTTP Proxy ###
|
80 |
|
81 | 1. In your project directory, install the faas library:
|
82 |
|
83 | npm install faas
|
84 |
|
85 | 2. Generate a simple demo startup script and API files:
|
86 |
|
87 | ./node_modules/faas/demos/http-proxy/generate.sh
|
88 |
|
89 | # OR `npm root`/faas/demos/http-proxy/generate.sh
|
90 |
|
91 | This creates the file `./faas_demo_start.sh`, and the `./app.js` demo app.
|
92 |
|
93 | 3. Start your API server:
|
94 |
|
95 | ./faas_demo_start.sh
|
96 |
|
97 | 4. Open a browser to your demo url (https://faasdemo-XXXXXXXX.http-proxy.faas.io/) and watch your proxy in action!
|
98 |
|
99 | --------------------------------------------------------------------
|
100 |
|
101 | ## Intel Edison ##
|
102 |
|
103 | ### Edison Quick-Start & Demo ###
|
104 |
|
105 | 1. Configure your Edison to
|
106 | [connect to your WiFi network](http://www.intel.com/support/edison/sb/CS-035342.htm).
|
107 |
|
108 | 2. Install faas from a terminal on your Edison:
|
109 |
|
110 | npm install faas
|
111 |
|
112 | 3. Generate a simple demo startup script and API files:
|
113 |
|
114 | ./node_modules/faas/demos/edison/generate.sh
|
115 |
|
116 | # OR `npm root`/faas/demos/edison/generate.sh
|
117 |
|
118 | This creates the file `./faas_demo_start.sh` and the `faas_demo_apis` directory.
|
119 |
|
120 | 4. Start the API on your Edison by running:
|
121 |
|
122 | ./faas_demo_start.sh
|
123 |
|
124 | 5. Open a browser to [https://api.faas.io/demo](https://api.faas.io/demo)
|
125 | and enter your device key.
|
126 | You should now be able to turn the LED on your board on and off.
|
127 | That's it!
|
128 |
|
129 | Tip: The "DEVICE KEY" was printed to your screen when you
|
130 | started the command in Step 3. This is your Edison serial number,
|
131 | which can also be found on a physical label on your Edison, or
|
132 | in the file /factory/serial_number.
|
133 |
|
134 |
|
135 | ### Extra Credit: Start on boot and restart on error ###
|
136 |
|
137 | To enable your API to start whenever you boot your Edison
|
138 | (without needing to log in to it), you can run the following:
|
139 |
|
140 | ./node_modules/faas/demos/edison/install_service.sh
|
141 |
|
142 | This does a few things:
|
143 |
|
144 | 1. Copies the demo apis to `/home/root/faas_api`.
|
145 |
|
146 | 2. Installs faas there (`npm install faas`).
|
147 |
|
148 | 3. Creates a script to run your api at `/home/root/faas_api/run_faas_api.sh`.
|
149 |
|
150 | 4. Creates a systemd service file to point to your script at
|
151 | `/lib/systemd/system/faas.service`.
|
152 |
|
153 | 5. Enables this service to start automatically on boot via
|
154 | `systemctl enable faas`.
|
155 |
|
156 |
|
157 |
|
158 | ---
|
159 | For more info, go to [faas.io](http://www.faas.io)
|