Skip to content

removed: NFS setting #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,6 @@ to other developers. An example would be if you want to use a different PHP vers
#### Custom Services
→ see [📚 in-depth docs about custom service container](docs/services.md).

#### Using NFS Mount for Host Volume

On macOS or Windows, you may instruct ssdev to mount the host directory via NFS. In the past, this has worked
well for improving performance, but with the addition of new and faster file-sharing implementations,
this has become a legacy feature and has been disabled by default in version `1.3.0`.

If you want to re-enable it, simply add the `--use-nfs` flag or add the following to your config:
```json
{
"ssdev": {
"use-nfs": true
}
}
```


→ see [📚 Configuring NFS on macOS](docs/nfs/macos.md).


## ➕ More Infos
Check out the following for more informations:
Expand Down
10 changes: 5 additions & 5 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ require('yargs') // eslint-disable-line
description: 'Ports to publish from the database container',
default: ['3306:3306'],
})
.option('use-nfs', {
type: 'boolean',
description: 'flag to enable nfs mount on macOS or Windows systems',
default: false,
})
// .option('use-nfs', {
// type: 'boolean',
// description: 'flag to enable nfs mount on macOS or Windows systems',
// default: false,
// })
// Serve the devenv
.command(
'up',
Expand Down
13 changes: 8 additions & 5 deletions docker/getRootComposeFile/hostVolumes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ const os = require('os');
*/
function hostVolumes(args) { // eslint-disable-line no-unused-vars
const volumes = {
volumes: [{
type: 'volume',
source: 'host_data',
target: '/var/www/html',
}],
volumes: [
'${PWD}:/var/www/html', // eslint-disable-line no-template-curly-in-string
],
// volumes: [{
// type: 'volume',
// source: 'host_data',
// target: '/var/www/html',
// }],
};
if (os.platform() !== 'darwin' && os.platform() !== 'win32') {
volumes.volumes = [
Expand Down
6 changes: 1 addition & 5 deletions docker/getRootComposeFile/hostVolumes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ const args = {};
test('contains a default volumes definition', () => {
expect('volumes' in hostVolumes(args)).toBeTruthy();
const volumes = hostVolumes(args).volumes;
expect(volumes).toContainEqual({
type: 'volume',
source: 'host_data',
target: '/var/www/html',
});
expect(volumes).toContainEqual('${PWD}:/var/www/html');
});

test('contains pwd on linux', () => {
Expand Down
38 changes: 19 additions & 19 deletions docker/getRootComposeFile/volumeDefinition.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const os = require('os');
// const os = require('os');

/**
* getVolumeDefinition - returns the volume definition as needed in the
Expand All @@ -12,25 +12,25 @@ const os = require('os');
function getVolumeDefinition(args) { // eslint-disable-line no-unused-vars
const definition = {
db_data: null,
host_data: {
driver: 'local',
driver_opts: {
type: 'none',
o: 'bind',
device: '${PWD}', // eslint-disable-line no-template-curly-in-string
},
},
// host_data: {
// driver: 'local',
// driver_opts: {
// type: 'none',
// o: 'bind',
// device: '${PWD}', // eslint-disable-line no-template-curly-in-string
// },
// },
// };
// if (args['use-nfs'] && (os.platform() === 'darwin' || os.platform() === 'win32')) {
// definition.host_data = {
// driver: 'local',
// driver_opts: {
// type: 'nfs',
// o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
// device: ':${PWD}', // eslint-disable-line no-template-curly-in-string
// },
// };
};
if (args['use-nfs'] && (os.platform() === 'darwin' || os.platform() === 'win32')) {
definition.host_data = {
driver: 'local',
driver_opts: {
type: 'nfs',
o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
device: ':${PWD}', // eslint-disable-line no-template-curly-in-string
},
};
}
return { volumes: definition };
}

Expand Down
98 changes: 49 additions & 49 deletions docker/getRootComposeFile/volumeDefinition.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,58 @@ test('contains a default volumes definition', () => {
expect('db_data' in definition).toBeTruthy();
expect(definition.db_data).toBeNull();

expect('host_data' in definition).toBeTruthy();
// expect('host_data' in definition).toBeTruthy();
});

test('contains a default mount for all systems by default', () => {
os.platform.mockReturnValue('linux');
const linuxDefinition = volumeDefinition(args).volumes.host_data;
expect(linuxDefinition.driver).toBe('local');
expect(linuxDefinition.driver_opts).toEqual({
type: 'none',
o: 'bind',
device: '${PWD}',
});
// test('contains a default mount for all systems by default', () => {
// os.platform.mockReturnValue('linux');
// const linuxDefinition = volumeDefinition(args).volumes.host_data;
// expect(linuxDefinition.driver).toBe('local');
// expect(linuxDefinition.driver_opts).toEqual({
// type: 'none',
// o: 'bind',
// device: '${PWD}',
// });

os.platform.mockReturnValue('win32');
const winDefinition = volumeDefinition(args).volumes.host_data;
expect(winDefinition.driver).toBe('local');
expect(winDefinition.driver_opts).toEqual({
type: 'none',
o: 'bind',
device: '${PWD}',
});
// os.platform.mockReturnValue('win32');
// const winDefinition = volumeDefinition(args).volumes.host_data;
// expect(winDefinition.driver).toBe('local');
// expect(winDefinition.driver_opts).toEqual({
// type: 'none',
// o: 'bind',
// device: '${PWD}',
// });

os.platform.mockReturnValue('darwin');
const darwinDefinition = volumeDefinition(args).volumes.host_data;
expect(darwinDefinition.driver).toBe('local');
expect(darwinDefinition.driver_opts).toEqual({
type: 'none',
o: 'bind',
device: '${PWD}',
});
});
// os.platform.mockReturnValue('darwin');
// const darwinDefinition = volumeDefinition(args).volumes.host_data;
// expect(darwinDefinition.driver).toBe('local');
// expect(darwinDefinition.driver_opts).toEqual({
// type: 'none',
// o: 'bind',
// device: '${PWD}',
// });
// });

test('correctly handles nfs on windows or macOS', () => {
os.platform.mockReturnValue('win32');
var definition = volumeDefinition({
'use-nfs': true,
}).volumes.host_data;
expect(definition.driver).toBe('local');
expect(definition.driver_opts).toEqual({
type: 'nfs',
o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
device: ':${PWD}',
});
// test('correctly handles nfs on windows or macOS', () => {
// os.platform.mockReturnValue('win32');
// var definition = volumeDefinition({
// 'use-nfs': true,
// }).volumes.host_data;
// expect(definition.driver).toBe('local');
// expect(definition.driver_opts).toEqual({
// type: 'nfs',
// o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
// device: ':${PWD}',
// });

os.platform.mockReturnValue('darwin');
definition = volumeDefinition({
'use-nfs': true,
}).volumes.host_data;
expect(definition.driver).toBe('local');
expect(definition.driver_opts).toEqual({
type: 'nfs',
o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
device: ':${PWD}',
});
});
// os.platform.mockReturnValue('darwin');
// definition = volumeDefinition({
// 'use-nfs': true,
// }).volumes.host_data;
// expect(definition.driver).toBe('local');
// expect(definition.driver_opts).toEqual({
// type: 'nfs',
// o: 'addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3',
// device: ':${PWD}',
// });
// });
Loading