Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d923b3

Browse files
mariashdavewalter
andcommitted
Add SMB volume service to using volume services guide
[#160595591](https://www.pivotaltracker.com/story/show/160595591) Co-authored-by: Dave Walter <[email protected]>
1 parent c0f662b commit 4d923b3

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

services/_using-vol-services.html.md.erb

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<li><a href="#nfs-sample">Deploy and Bind Sample App</a></li>
1111
<li><a href="#nfs-additional">Additional Information</a></li>
1212
</ul>
13+
<li><a href="#smb">SMB Volume Service</a></li>
14+
<ul>
15+
<li><a href="#create-smb">Create an SMB Volume Service</a></li>
16+
<li><a href="#smb-sample">Deploy and Bind Sample App</a></li>
17+
</ul>
1318
</ul>
1419
</div>
1520
</div>
@@ -248,3 +253,77 @@ As of `nfs-volume-release` v1.3.1, you can specify bind parameters in advance, w
248253
#### File Locking with `flock()` and `lockf()`/`fcntl()`
249254

250255
Apps that use file locking through unix system calls such as `flock()` and `fcntl()` or script commands such as `flock` may use the `nfs` service. The `nfs-legacy` service uses a fuse mounting process that does not enforce locks across Diego cells.
256+
257+
## <a id='smb'></a> SMB Volume Service
258+
259+
This section describes how to use the SMB volume service.
260+
261+
### <a id='create-smb'></a> Create an SMB Volume Service
262+
263+
Cloud Foundry offers one SMB volume service:
264+
265+
* `smb`: This volume service provides support for existing SMB shares.
266+
267+
The service offers a single plan called `Existing`.
268+
269+
To create an SMB volume service, follow the procedure below.
270+
271+
#### Create with `smb` Service
272+
273+
You can create an SMB volume service using the `Existing` plan of the `smb` service. Run the following command:
274+
275+
```
276+
$ cf create-service smb Existing SERVICE-INSTANCE-NAME -c '{"share":"//SERVER/SHARE"}'
277+
```
278+
279+
Where:
280+
281+
* `SERVICE-INSTANCE-NAME` is a name you provide for this SMB volume service instance.
282+
* `//SERVER/SHARE` is the SMB address of your server and share.
283+
284+
You can run the `cf services` command to confirm that your newly-created SMB volume service displays in the output.
285+
286+
### <a id='smb-sample'></a> Deploy and Bind a Sample App
287+
288+
This section describes how to deploy a sample app and bind it to the SMB volume service.
289+
290+
1. Clone the github repo and push the `pora` test app:
291+
1. `cd ~/workspace`
292+
1. `git clone https://github.com/cloudfoundry/persi-acceptance-tests.git`
293+
1. `cd ~/workspace/persi-acceptance-tests/assets/pora`
294+
1. `cf push pora --no-start`
295+
296+
1. To bind the service to your app, run the following command:
297+
298+
```
299+
$ cf bind-service pora SERVICE-INSTANCE-NAME -c '{"username":"USERNAME","password":"PASSWORD"}'
300+
```
301+
Where:
302+
* `SERVICE-INSTANCE-NAME`: The name of the volume service instance you created previously.
303+
* `USERNAME` and `PASSWORD`: The username and password to use when mounting the share to the app. This allows you to interact with your SMB server as a specific user while allowing Cloud Foundry to run your application as an arbitrary user.
304+
* **Optional parameters**:
305+
* `mount`: Use this option to specify the path at which volumes mount to the app container. The default is an arbitrarily-named folder in `/var/vcap/data`. You may need to modify this value if your app has specific requirements. For example:
306+
307+
```
308+
cf bind-service pora myVolume -c '{"username":"some-user","password":"some-password","mount":"/var/path"}'
309+
```
310+
* `readonly`: When you issue the `cf bind-service` command, Volume Services mounts a read-write file system by default. You can specify a read-only mount by adding `"readonly":true` to the bind configuration JSON string.
311+
* `domain`: In case if your user is in windows domain you can specify `domain` parameter.
312+
313+
1. Start the app:
314+
315+
```
316+
$ cf start pora
317+
```
318+
319+
1. Use the following `curl` command to confirm the app is running. The command returns an instance index for your app.
320+
321+
```
322+
$ curl http://pora.YOUR-CF-DOMAIN.com
323+
```
324+
325+
1. Use the following `curl` command to confirm the app can access the shared volume. The command writes a file to the share and then reads it back out again.
326+
327+
```
328+
$ curl http://pora.YOUR-CF-DOMAIN.com/write
329+
```

0 commit comments

Comments
 (0)