-
Notifications
You must be signed in to change notification settings - Fork 591
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
docker-compose mounted host paths cause problems with lib/modules #1479
Labels
Comments
Hmm, there is in fact a feature to copy rather than symlink, and it kicks
in on Windows:
```
self.linkAssetFolder = function(from, to) {
if (!fs.existsSync(to)) {
return;
}
if (process.platform.match(/^win/)) {
self.linkAssetFolderOnWindows(from, to);
} else {
self.linkAssetFolderOnUnix(from, to);
}
};
```
On Windows it actually performs a copy operation.
…On Mon, Jul 9, 2018 at 8:01 PM, Zenobius Jiricek ***@***.***> wrote:
Looking at how this whole thing would work in local dev, ran into public
file problems. I assume it's to do with symlinks.
docker-compose.yml
version: "3.0"
services:
app:
build: .
volumes:
- ./:/app
- /app/data
- /app/node_modules
- /app/public/uploads
environment:
MONGO_HOST: db
MONGO_PORT: 27017
MONGO_DB: app
ports:
- 3000:3000
links:
- db
restart: on-failure
db:
image: mongo
healthcheck:
test: echo 'db.stats().ok' | mongo localhost:27017/app --quiet
interval: 5s
timeout: 2s
retries: 3
Dockerfile
FROM node:6-alpine
# Create app directory
RUN mkdir -p /app
WORKDIR /app
# Bundle app source
COPY . /app
RUN npm install
# Mount persistent storage
VOLUME /app/data
VOLUME /app/public/uploads
EXPOSE 3000
CMD [ "npm", "start" ]
app.js
var path = require('path');
var apos = require('apostrophe')({
shortName: '2nd-try',
// See lib/modules for basic project-level configuration of our modules
// responsible for serving static assets, managing page templates and
// configuring user accounts.
modules: {
// Apostrophe module configuration
// Note: most configuration occurs in the respective
// modules' directories. See lib/apostrophe-assets/index.js for an example.
// However any modules that are not present by default in Apostrophe must at
// least have a minimal configuration here: `moduleName: {}`
// If a template is not found somewhere else, serve it from the top-level
// `views/` folder of the project
'apostrophe-db': {
uri: `mongodb://${process.env.MONGO_HOST||'localhost'}:${process.env.MONGO_PORT||27017}/${process.env.MONGO_DB||'db'}`
},
'apostrophe-templates': { viewsFolderFallback: path.join(__dirname, 'views') }
}
});
package.json
{
"name": "2nd-try",
"version": "2.0.0",
"description": "Minimal Apostrophe Boilerplate",
"main": "app.js",
"scripts": {
"start": "node app.js",
"docker:up": "docker-compose up",
"docker:exec": "docker-compose exec app npm run start",
"docker:run": "docker-compose run --rm app",
"docker:build": "docker-compose build app"
},
"repository": {
"type": "git",
"url": ""
},
"author": "P'unk Avenue",
"license": "MIT",
"dependencies": {
"apostrophe": "^2.47.0"
},
"nodemonConfig": {
"verbose": true,
"ignore": [
"locales/*.json",
"public/modules/**/*.less",
"public/modules/**/*.js",
"public/uploads",
"public/apos-minified/*.js",
"public/css/master-*.less",
"data"
],
"ext": "json, js, html, less"
}
}
My workstation:
[image: applicationframehost_2018-07-10_09-14-28]
<https://user-images.githubusercontent.com/61225/42481467-b05caf90-8421-11e8-8415-acd062e14584.png>
$ docker -v
Docker version 18.03.1-ce, build 9ee9f40
$ docker-compose -v
docker-compose version 1.21.1, build 7641a569
Its worth noting that the compose file mounts are designed to re-layer the
/app/node_modules back on top of the host mounted app root. The
/app/node_modules comes from the initial layer created by npm run
docker:build.
When I try to run all this with the app mounted from the host, I get these
errors:
...
app_1 | LESS File error : '../modules/my-apostrophe-assets/css/site.less' wasn't found. Tried - /app/public/modules/my-apostrophe-assets/css/site.less,../modules/my-apostrophe-assets/css/site.less
app_1 | LESS File : /app/public/css/master-anon-cjjexc6eh00000gnyrvnqo30s.less 11:0
...
The browser network tab logs show a lot of 404.
Then, when I stop the stack, change the volumes directive in the
docker-compose.yml, it all works fine:
volumes:
- ./data:/app/data
- ./lib:/app/lib
- ./locales:/app/locales
- ./scripts:/app/scripts
- ./views:/app/views
So I guess the question here is:
1. is it important for the /app/public directory to be in my git repo?
seems not
2. what are the directories I need to be mounting into the container
during local dev? is the above enough (data, lib, locales, scripts, views) ?
3. is there a config value that changes the behaviour of /app/public
to copy instead of symlink so that files created there make sense on
windows host mounted volumes?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1479>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAB9fTgjwVZzy0qObYEuEj-xCLEMf4c-ks5uE-7CgaJpZM4VIj92>
.
--
*THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
P'UNK AVENUE | (215) 755-1330 | punkave.com
|
Are you using Docker for dev purposes or production?
…On Tue, Jul 10, 2018 at 8:26 AM, Tom Boutell ***@***.***> wrote:
Hmm, there is in fact a feature to copy rather than symlink, and it kicks
in on Windows:
```
self.linkAssetFolder = function(from, to) {
if (!fs.existsSync(to)) {
return;
}
if (process.platform.match(/^win/)) {
self.linkAssetFolderOnWindows(from, to);
} else {
self.linkAssetFolderOnUnix(from, to);
}
};
```
On Windows it actually performs a copy operation.
On Mon, Jul 9, 2018 at 8:01 PM, Zenobius Jiricek ***@***.***
> wrote:
> Looking at how this whole thing would work in local dev, ran into public
> file problems. I assume it's to do with symlinks.
>
> docker-compose.yml
>
> version: "3.0"
>
> services:
> app:
> build: .
> volumes:
> - ./:/app
> - /app/data
> - /app/node_modules
> - /app/public/uploads
> environment:
> MONGO_HOST: db
> MONGO_PORT: 27017
> MONGO_DB: app
> ports:
> - 3000:3000
> links:
> - db
> restart: on-failure
>
> db:
> image: mongo
> healthcheck:
> test: echo 'db.stats().ok' | mongo localhost:27017/app --quiet
> interval: 5s
> timeout: 2s
> retries: 3
>
> Dockerfile
>
> FROM node:6-alpine
>
> # Create app directory
> RUN mkdir -p /app
> WORKDIR /app
>
> # Bundle app source
> COPY . /app
> RUN npm install
>
> # Mount persistent storage
> VOLUME /app/data
> VOLUME /app/public/uploads
>
> EXPOSE 3000
> CMD [ "npm", "start" ]
>
> app.js
>
> var path = require('path');
>
> var apos = require('apostrophe')({
> shortName: '2nd-try',
>
> // See lib/modules for basic project-level configuration of our modules
> // responsible for serving static assets, managing page templates and
> // configuring user accounts.
>
> modules: {
>
> // Apostrophe module configuration
>
> // Note: most configuration occurs in the respective
> // modules' directories. See lib/apostrophe-assets/index.js for an example.
>
> // However any modules that are not present by default in Apostrophe must at
> // least have a minimal configuration here: `moduleName: {}`
>
> // If a template is not found somewhere else, serve it from the top-level
> // `views/` folder of the project
> 'apostrophe-db': {
> uri: `mongodb://${process.env.MONGO_HOST||'localhost'}:${process.env.MONGO_PORT||27017}/${process.env.MONGO_DB||'db'}`
> },
>
> 'apostrophe-templates': { viewsFolderFallback: path.join(__dirname, 'views') }
>
> }
> });
>
> package.json
>
> {
> "name": "2nd-try",
> "version": "2.0.0",
> "description": "Minimal Apostrophe Boilerplate",
> "main": "app.js",
> "scripts": {
> "start": "node app.js",
> "docker:up": "docker-compose up",
> "docker:exec": "docker-compose exec app npm run start",
> "docker:run": "docker-compose run --rm app",
> "docker:build": "docker-compose build app"
> },
> "repository": {
> "type": "git",
> "url": ""
> },
> "author": "P'unk Avenue",
> "license": "MIT",
> "dependencies": {
> "apostrophe": "^2.47.0"
> },
> "nodemonConfig": {
> "verbose": true,
> "ignore": [
> "locales/*.json",
> "public/modules/**/*.less",
> "public/modules/**/*.js",
> "public/uploads",
> "public/apos-minified/*.js",
> "public/css/master-*.less",
> "data"
> ],
> "ext": "json, js, html, less"
> }
> }
>
>
> My workstation:
>
> [image: applicationframehost_2018-07-10_09-14-28]
> <https://user-images.githubusercontent.com/61225/42481467-b05caf90-8421-11e8-8415-acd062e14584.png>
>
> $ docker -v
> Docker version 18.03.1-ce, build 9ee9f40
> $ docker-compose -v
> docker-compose version 1.21.1, build 7641a569
>
> Its worth noting that the compose file mounts are designed to re-layer
> the /app/node_modules back on top of the host mounted app root. The
> /app/node_modules comes from the initial layer created by npm run
> docker:build.
>
> When I try to run all this with the app mounted from the host, I get
> these errors:
>
> ...
> app_1 | LESS File error : '../modules/my-apostrophe-assets/css/site.less' wasn't found. Tried - /app/public/modules/my-apostrophe-assets/css/site.less,../modules/my-apostrophe-assets/css/site.less
> app_1 | LESS File : /app/public/css/master-anon-cjjexc6eh00000gnyrvnqo30s.less 11:0
> ...
>
> The browser network tab logs show a lot of 404.
>
> Then, when I stop the stack, change the volumes directive in the
> docker-compose.yml, it all works fine:
>
> volumes:
> - ./data:/app/data
> - ./lib:/app/lib
> - ./locales:/app/locales
> - ./scripts:/app/scripts
> - ./views:/app/views
>
> So I guess the question here is:
>
> 1. is it important for the /app/public directory to be in my git
> repo? seems not
> 2. what are the directories I need to be mounting into the container
> during local dev? is the above enough (data, lib, locales, scripts, views) ?
> 3. is there a config value that changes the behaviour of /app/public
> to copy instead of symlink so that files created there make sense on
> windows host mounted volumes?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#1479>, or mute the
> thread
> <https://github.com/notifications/unsubscribe-auth/AAB9fTgjwVZzy0qObYEuEj-xCLEMf4c-ks5uE-7CgaJpZM4VIj92>
> .
>
--
*THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
P'UNK AVENUE | (215) 755-1330 | punkave.com
--
*THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
P'UNK AVENUE | (215) 755-1330 | punkave.com
|
Both. In dev i use docker-compose and since the underlying host is Windows
the filesystem doesn't support symlinks as they are created in Linux, I
need a config option to use copy in stead of symlink.
…On Tue, Jul 10, 2018, 9:56 PM Tom Boutell ***@***.***> wrote:
Are you using Docker for dev purposes or production?
On Tue, Jul 10, 2018 at 8:26 AM, Tom Boutell ***@***.***> wrote:
> Hmm, there is in fact a feature to copy rather than symlink, and it kicks
> in on Windows:
>
> ```
> self.linkAssetFolder = function(from, to) {
> if (!fs.existsSync(to)) {
> return;
> }
> if (process.platform.match(/^win/)) {
> self.linkAssetFolderOnWindows(from, to);
> } else {
> self.linkAssetFolderOnUnix(from, to);
> }
> };
>
> ```
>
> On Windows it actually performs a copy operation.
>
>
> On Mon, Jul 9, 2018 at 8:01 PM, Zenobius Jiricek <
***@***.***
> > wrote:
>
>> Looking at how this whole thing would work in local dev, ran into public
>> file problems. I assume it's to do with symlinks.
>>
>> docker-compose.yml
>>
>> version: "3.0"
>>
>> services:
>> app:
>> build: .
>> volumes:
>> - ./:/app
>> - /app/data
>> - /app/node_modules
>> - /app/public/uploads
>> environment:
>> MONGO_HOST: db
>> MONGO_PORT: 27017
>> MONGO_DB: app
>> ports:
>> - 3000:3000
>> links:
>> - db
>> restart: on-failure
>>
>> db:
>> image: mongo
>> healthcheck:
>> test: echo 'db.stats().ok' | mongo localhost:27017/app --quiet
>> interval: 5s
>> timeout: 2s
>> retries: 3
>>
>> Dockerfile
>>
>> FROM node:6-alpine
>>
>> # Create app directory
>> RUN mkdir -p /app
>> WORKDIR /app
>>
>> # Bundle app source
>> COPY . /app
>> RUN npm install
>>
>> # Mount persistent storage
>> VOLUME /app/data
>> VOLUME /app/public/uploads
>>
>> EXPOSE 3000
>> CMD [ "npm", "start" ]
>>
>> app.js
>>
>> var path = require('path');
>>
>> var apos = require('apostrophe')({
>> shortName: '2nd-try',
>>
>> // See lib/modules for basic project-level configuration of our modules
>> // responsible for serving static assets, managing page templates and
>> // configuring user accounts.
>>
>> modules: {
>>
>> // Apostrophe module configuration
>>
>> // Note: most configuration occurs in the respective
>> // modules' directories. See lib/apostrophe-assets/index.js for an
example.
>>
>> // However any modules that are not present by default in Apostrophe
must at
>> // least have a minimal configuration here: `moduleName: {}`
>>
>> // If a template is not found somewhere else, serve it from the
top-level
>> // `views/` folder of the project
>> 'apostrophe-db': {
>> uri:
`mongodb://${process.env.MONGO_HOST||'localhost'}:${process.env.MONGO_PORT||27017}/${process.env.MONGO_DB||'db'}`
>> },
>>
>> 'apostrophe-templates': { viewsFolderFallback: path.join(__dirname,
'views') }
>>
>> }
>> });
>>
>> package.json
>>
>> {
>> "name": "2nd-try",
>> "version": "2.0.0",
>> "description": "Minimal Apostrophe Boilerplate",
>> "main": "app.js",
>> "scripts": {
>> "start": "node app.js",
>> "docker:up": "docker-compose up",
>> "docker:exec": "docker-compose exec app npm run start",
>> "docker:run": "docker-compose run --rm app",
>> "docker:build": "docker-compose build app"
>> },
>> "repository": {
>> "type": "git",
>> "url": ""
>> },
>> "author": "P'unk Avenue",
>> "license": "MIT",
>> "dependencies": {
>> "apostrophe": "^2.47.0"
>> },
>> "nodemonConfig": {
>> "verbose": true,
>> "ignore": [
>> "locales/*.json",
>> "public/modules/**/*.less",
>> "public/modules/**/*.js",
>> "public/uploads",
>> "public/apos-minified/*.js",
>> "public/css/master-*.less",
>> "data"
>> ],
>> "ext": "json, js, html, less"
>> }
>> }
>>
>>
>> My workstation:
>>
>> [image: applicationframehost_2018-07-10_09-14-28]
>> <
https://user-images.githubusercontent.com/61225/42481467-b05caf90-8421-11e8-8415-acd062e14584.png
>
>>
>> $ docker -v
>> Docker version 18.03.1-ce, build 9ee9f40
>> $ docker-compose -v
>> docker-compose version 1.21.1, build 7641a569
>>
>> Its worth noting that the compose file mounts are designed to re-layer
>> the /app/node_modules back on top of the host mounted app root. The
>> /app/node_modules comes from the initial layer created by npm run
>> docker:build.
>>
>> When I try to run all this with the app mounted from the host, I get
>> these errors:
>>
>> ...
>> app_1 | LESS File error :
'../modules/my-apostrophe-assets/css/site.less' wasn't found. Tried -
/app/public/modules/my-apostrophe-assets/css/site.less,../modules/my-apostrophe-assets/css/site.less
>> app_1 | LESS File :
/app/public/css/master-anon-cjjexc6eh00000gnyrvnqo30s.less 11:0
>> ...
>>
>> The browser network tab logs show a lot of 404.
>>
>> Then, when I stop the stack, change the volumes directive in the
>> docker-compose.yml, it all works fine:
>>
>> volumes:
>> - ./data:/app/data
>> - ./lib:/app/lib
>> - ./locales:/app/locales
>> - ./scripts:/app/scripts
>> - ./views:/app/views
>>
>> So I guess the question here is:
>>
>> 1. is it important for the /app/public directory to be in my git
>> repo? seems not
>> 2. what are the directories I need to be mounting into the container
>> during local dev? is the above enough (data, lib, locales, scripts,
views) ?
>> 3. is there a config value that changes the behaviour of /app/public
>> to copy instead of symlink so that files created there make sense on
>> windows host mounted volumes?
>>
>> —
>> You are receiving this because you are subscribed to this thread.
>> Reply to this email directly, view it on GitHub
>> <#1479>, or mute the
>> thread
>> <
https://github.com/notifications/unsubscribe-auth/AAB9fTgjwVZzy0qObYEuEj-xCLEMf4c-ks5uE-7CgaJpZM4VIj92
>
>> .
>>
>
>
>
> --
>
>
> *THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
> P'UNK AVENUE | (215) 755-1330 | punkave.com
>
--
*THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
P'UNK AVENUE | (215) 755-1330 | punkave.com
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1479 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADvKWPtQpBil5VfFlEJ1lafqLnmy2Oeks5uFJ18gaJpZM4VIj92>
.
|
Additionally in dev it's not feasible to be rebuilding the entire docker images
every single time I make a change
…On Wed, Jul 11, 2018, 12:13 PM airtonix ***@***.***> wrote:
Both. In dev i use docker-compose and since the underlying host is Windows
the filesystem doesn't support symlinks as they are created in Linux, I
need a config option to use copy in stead of symlink.
On Tue, Jul 10, 2018, 9:56 PM Tom Boutell ***@***.***>
wrote:
> Are you using Docker for dev purposes or production?
>
> On Tue, Jul 10, 2018 at 8:26 AM, Tom Boutell ***@***.***> wrote:
>
> > Hmm, there is in fact a feature to copy rather than symlink, and it
> kicks
> > in on Windows:
> >
> > ```
> > self.linkAssetFolder = function(from, to) {
> > if (!fs.existsSync(to)) {
> > return;
> > }
> > if (process.platform.match(/^win/)) {
> > self.linkAssetFolderOnWindows(from, to);
> > } else {
> > self.linkAssetFolderOnUnix(from, to);
> > }
> > };
> >
> > ```
> >
> > On Windows it actually performs a copy operation.
> >
> >
> > On Mon, Jul 9, 2018 at 8:01 PM, Zenobius Jiricek <
> ***@***.***
> > > wrote:
> >
> >> Looking at how this whole thing would work in local dev, ran into
> public
> >> file problems. I assume it's to do with symlinks.
> >>
> >> docker-compose.yml
> >>
> >> version: "3.0"
> >>
> >> services:
> >> app:
> >> build: .
> >> volumes:
> >> - ./:/app
> >> - /app/data
> >> - /app/node_modules
> >> - /app/public/uploads
> >> environment:
> >> MONGO_HOST: db
> >> MONGO_PORT: 27017
> >> MONGO_DB: app
> >> ports:
> >> - 3000:3000
> >> links:
> >> - db
> >> restart: on-failure
> >>
> >> db:
> >> image: mongo
> >> healthcheck:
> >> test: echo 'db.stats().ok' | mongo localhost:27017/app --quiet
> >> interval: 5s
> >> timeout: 2s
> >> retries: 3
> >>
> >> Dockerfile
> >>
> >> FROM node:6-alpine
> >>
> >> # Create app directory
> >> RUN mkdir -p /app
> >> WORKDIR /app
> >>
> >> # Bundle app source
> >> COPY . /app
> >> RUN npm install
> >>
> >> # Mount persistent storage
> >> VOLUME /app/data
> >> VOLUME /app/public/uploads
> >>
> >> EXPOSE 3000
> >> CMD [ "npm", "start" ]
> >>
> >> app.js
> >>
> >> var path = require('path');
> >>
> >> var apos = require('apostrophe')({
> >> shortName: '2nd-try',
> >>
> >> // See lib/modules for basic project-level configuration of our modules
> >> // responsible for serving static assets, managing page templates and
> >> // configuring user accounts.
> >>
> >> modules: {
> >>
> >> // Apostrophe module configuration
> >>
> >> // Note: most configuration occurs in the respective
> >> // modules' directories. See lib/apostrophe-assets/index.js for an
> example.
> >>
> >> // However any modules that are not present by default in Apostrophe
> must at
> >> // least have a minimal configuration here: `moduleName: {}`
> >>
> >> // If a template is not found somewhere else, serve it from the
> top-level
> >> // `views/` folder of the project
> >> 'apostrophe-db': {
> >> uri:
> `mongodb://${process.env.MONGO_HOST||'localhost'}:${process.env.MONGO_PORT||27017}/${process.env.MONGO_DB||'db'}`
> >> },
> >>
> >> 'apostrophe-templates': { viewsFolderFallback: path.join(__dirname,
> 'views') }
> >>
> >> }
> >> });
> >>
> >> package.json
> >>
> >> {
> >> "name": "2nd-try",
> >> "version": "2.0.0",
> >> "description": "Minimal Apostrophe Boilerplate",
> >> "main": "app.js",
> >> "scripts": {
> >> "start": "node app.js",
> >> "docker:up": "docker-compose up",
> >> "docker:exec": "docker-compose exec app npm run start",
> >> "docker:run": "docker-compose run --rm app",
> >> "docker:build": "docker-compose build app"
> >> },
> >> "repository": {
> >> "type": "git",
> >> "url": ""
> >> },
> >> "author": "P'unk Avenue",
> >> "license": "MIT",
> >> "dependencies": {
> >> "apostrophe": "^2.47.0"
> >> },
> >> "nodemonConfig": {
> >> "verbose": true,
> >> "ignore": [
> >> "locales/*.json",
> >> "public/modules/**/*.less",
> >> "public/modules/**/*.js",
> >> "public/uploads",
> >> "public/apos-minified/*.js",
> >> "public/css/master-*.less",
> >> "data"
> >> ],
> >> "ext": "json, js, html, less"
> >> }
> >> }
> >>
> >>
> >> My workstation:
> >>
> >> [image: applicationframehost_2018-07-10_09-14-28]
> >> <
> https://user-images.githubusercontent.com/61225/42481467-b05caf90-8421-11e8-8415-acd062e14584.png
> >
> >>
> >> $ docker -v
> >> Docker version 18.03.1-ce, build 9ee9f40
> >> $ docker-compose -v
> >> docker-compose version 1.21.1, build 7641a569
> >>
> >> Its worth noting that the compose file mounts are designed to re-layer
> >> the /app/node_modules back on top of the host mounted app root. The
> >> /app/node_modules comes from the initial layer created by npm run
> >> docker:build.
> >>
> >> When I try to run all this with the app mounted from the host, I get
> >> these errors:
> >>
> >> ...
> >> app_1 | LESS File error :
> '../modules/my-apostrophe-assets/css/site.less' wasn't found. Tried -
> /app/public/modules/my-apostrophe-assets/css/site.less,../modules/my-apostrophe-assets/css/site.less
> >> app_1 | LESS File :
> /app/public/css/master-anon-cjjexc6eh00000gnyrvnqo30s.less 11:0
> >> ...
> >>
> >> The browser network tab logs show a lot of 404.
> >>
> >> Then, when I stop the stack, change the volumes directive in the
> >> docker-compose.yml, it all works fine:
> >>
> >> volumes:
> >> - ./data:/app/data
> >> - ./lib:/app/lib
> >> - ./locales:/app/locales
> >> - ./scripts:/app/scripts
> >> - ./views:/app/views
> >>
> >> So I guess the question here is:
> >>
> >> 1. is it important for the /app/public directory to be in my git
> >> repo? seems not
> >> 2. what are the directories I need to be mounting into the container
> >> during local dev? is the above enough (data, lib, locales, scripts,
> views) ?
> >> 3. is there a config value that changes the behaviour of /app/public
> >> to copy instead of symlink so that files created there make sense on
> >> windows host mounted volumes?
> >>
> >> —
> >> You are receiving this because you are subscribed to this thread.
> >> Reply to this email directly, view it on GitHub
> >> <#1479>, or mute the
> >> thread
> >> <
> https://github.com/notifications/unsubscribe-auth/AAB9fTgjwVZzy0qObYEuEj-xCLEMf4c-ks5uE-7CgaJpZM4VIj92
> >
> >> .
> >>
> >
> >
> >
> > --
> >
> >
> > *THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
> > P'UNK AVENUE | (215) 755-1330 | punkave.com
> >
>
>
>
> --
>
>
> *THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
> P'UNK AVENUE | (215) 755-1330 | punkave.com
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1479 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AADvKWPtQpBil5VfFlEJ1lafqLnmy2Oeks5uFJ18gaJpZM4VIj92>
> .
>
|
If Apostrophe makes a good-faith effort to detect Windows and instead sees
Linux because it's a Linux container, it's reasonable for Apostrophe to try
to make symbolic links. So this is not a bug. But, we'd take a PR to make
it a configuration option.
On Tue, Jul 10, 2018 at 10:44 PM, Zenobius Jiricek <[email protected]
… wrote:
Additionally in dev it's not feasible to be rebuilding the entire instead
every single time I make a change
On Wed, Jul 11, 2018, 12:13 PM airtonix ***@***.***> wrote:
> Both. In dev i use docker-compose and since the underlying host is
Windows
> the filesystem doesn't support symlinks as they are created in Linux, I
> need a config option to use copy in stead of symlink.
>
> On Tue, Jul 10, 2018, 9:56 PM Tom Boutell ***@***.***>
> wrote:
>
>> Are you using Docker for dev purposes or production?
>>
>> On Tue, Jul 10, 2018 at 8:26 AM, Tom Boutell ***@***.***> wrote:
>>
>> > Hmm, there is in fact a feature to copy rather than symlink, and it
>> kicks
>> > in on Windows:
>> >
>> > ```
>> > self.linkAssetFolder = function(from, to) {
>> > if (!fs.existsSync(to)) {
>> > return;
>> > }
>> > if (process.platform.match(/^win/)) {
>> > self.linkAssetFolderOnWindows(from, to);
>> > } else {
>> > self.linkAssetFolderOnUnix(from, to);
>> > }
>> > };
>> >
>> > ```
>> >
>> > On Windows it actually performs a copy operation.
>> >
>> >
>> > On Mon, Jul 9, 2018 at 8:01 PM, Zenobius Jiricek <
>> ***@***.***
>> > > wrote:
>> >
>> >> Looking at how this whole thing would work in local dev, ran into
>> public
>> >> file problems. I assume it's to do with symlinks.
>> >>
>> >> docker-compose.yml
>> >>
>> >> version: "3.0"
>> >>
>> >> services:
>> >> app:
>> >> build: .
>> >> volumes:
>> >> - ./:/app
>> >> - /app/data
>> >> - /app/node_modules
>> >> - /app/public/uploads
>> >> environment:
>> >> MONGO_HOST: db
>> >> MONGO_PORT: 27017
>> >> MONGO_DB: app
>> >> ports:
>> >> - 3000:3000
>> >> links:
>> >> - db
>> >> restart: on-failure
>> >>
>> >> db:
>> >> image: mongo
>> >> healthcheck:
>> >> test: echo 'db.stats().ok' | mongo localhost:27017/app --quiet
>> >> interval: 5s
>> >> timeout: 2s
>> >> retries: 3
>> >>
>> >> Dockerfile
>> >>
>> >> FROM node:6-alpine
>> >>
>> >> # Create app directory
>> >> RUN mkdir -p /app
>> >> WORKDIR /app
>> >>
>> >> # Bundle app source
>> >> COPY . /app
>> >> RUN npm install
>> >>
>> >> # Mount persistent storage
>> >> VOLUME /app/data
>> >> VOLUME /app/public/uploads
>> >>
>> >> EXPOSE 3000
>> >> CMD [ "npm", "start" ]
>> >>
>> >> app.js
>> >>
>> >> var path = require('path');
>> >>
>> >> var apos = require('apostrophe')({
>> >> shortName: '2nd-try',
>> >>
>> >> // See lib/modules for basic project-level configuration of our
modules
>> >> // responsible for serving static assets, managing page templates and
>> >> // configuring user accounts.
>> >>
>> >> modules: {
>> >>
>> >> // Apostrophe module configuration
>> >>
>> >> // Note: most configuration occurs in the respective
>> >> // modules' directories. See lib/apostrophe-assets/index.js for an
>> example.
>> >>
>> >> // However any modules that are not present by default in Apostrophe
>> must at
>> >> // least have a minimal configuration here: `moduleName: {}`
>> >>
>> >> // If a template is not found somewhere else, serve it from the
>> top-level
>> >> // `views/` folder of the project
>> >> 'apostrophe-db': {
>> >> uri:
>> `mongodb://${process.env.MONGO_HOST||'localhost'}:${
process.env.MONGO_PORT||27017}/${process.env.MONGO_DB||'db'}`
>> >> },
>> >>
>> >> 'apostrophe-templates': { viewsFolderFallback: path.join(__dirname,
>> 'views') }
>> >>
>> >> }
>> >> });
>> >>
>> >> package.json
>> >>
>> >> {
>> >> "name": "2nd-try",
>> >> "version": "2.0.0",
>> >> "description": "Minimal Apostrophe Boilerplate",
>> >> "main": "app.js",
>> >> "scripts": {
>> >> "start": "node app.js",
>> >> "docker:up": "docker-compose up",
>> >> "docker:exec": "docker-compose exec app npm run start",
>> >> "docker:run": "docker-compose run --rm app",
>> >> "docker:build": "docker-compose build app"
>> >> },
>> >> "repository": {
>> >> "type": "git",
>> >> "url": ""
>> >> },
>> >> "author": "P'unk Avenue",
>> >> "license": "MIT",
>> >> "dependencies": {
>> >> "apostrophe": "^2.47.0"
>> >> },
>> >> "nodemonConfig": {
>> >> "verbose": true,
>> >> "ignore": [
>> >> "locales/*.json",
>> >> "public/modules/**/*.less",
>> >> "public/modules/**/*.js",
>> >> "public/uploads",
>> >> "public/apos-minified/*.js",
>> >> "public/css/master-*.less",
>> >> "data"
>> >> ],
>> >> "ext": "json, js, html, less"
>> >> }
>> >> }
>> >>
>> >>
>> >> My workstation:
>> >>
>> >> [image: applicationframehost_2018-07-10_09-14-28]
>> >> <
>> https://user-images.githubusercontent.com/61225/
42481467-b05caf90-8421-11e8-8415-acd062e14584.png
>> >
>> >>
>> >> $ docker -v
>> >> Docker version 18.03.1-ce, build 9ee9f40
>> >> $ docker-compose -v
>> >> docker-compose version 1.21.1, build 7641a569
>> >>
>> >> Its worth noting that the compose file mounts are designed to
re-layer
>> >> the /app/node_modules back on top of the host mounted app root. The
>> >> /app/node_modules comes from the initial layer created by npm run
>> >> docker:build.
>> >>
>> >> When I try to run all this with the app mounted from the host, I get
>> >> these errors:
>> >>
>> >> ...
>> >> app_1 | LESS File error :
>> '../modules/my-apostrophe-assets/css/site.less' wasn't found. Tried -
>> /app/public/modules/my-apostrophe-assets/css/site.
less,../modules/my-apostrophe-assets/css/site.less
>> >> app_1 | LESS File :
>> /app/public/css/master-anon-cjjexc6eh00000gnyrvnqo30s.less 11:0
>> >> ...
>> >>
>> >> The browser network tab logs show a lot of 404.
>> >>
>> >> Then, when I stop the stack, change the volumes directive in the
>> >> docker-compose.yml, it all works fine:
>> >>
>> >> volumes:
>> >> - ./data:/app/data
>> >> - ./lib:/app/lib
>> >> - ./locales:/app/locales
>> >> - ./scripts:/app/scripts
>> >> - ./views:/app/views
>> >>
>> >> So I guess the question here is:
>> >>
>> >> 1. is it important for the /app/public directory to be in my git
>> >> repo? seems not
>> >> 2. what are the directories I need to be mounting into the container
>> >> during local dev? is the above enough (data, lib, locales, scripts,
>> views) ?
>> >> 3. is there a config value that changes the behaviour of /app/public
>> >> to copy instead of symlink so that files created there make sense on
>> >> windows host mounted volumes?
>> >>
>> >> —
>> >> You are receiving this because you are subscribed to this thread.
>> >> Reply to this email directly, view it on GitHub
>> >> <#1479>, or mute
the
>> >> thread
>> >> <
>> https://github.com/notifications/unsubscribe-
auth/AAB9fTgjwVZzy0qObYEuEj-xCLEMf4c-ks5uE-7CgaJpZM4VIj92
>> >
>> >> .
>> >>
>> >
>> >
>> >
>> > --
>> >
>> >
>> > *THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
>> > P'UNK AVENUE | (215) 755-1330 | punkave.com
>> >
>>
>>
>>
>> --
>>
>>
>> *THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
>> P'UNK AVENUE | (215) 755-1330 | punkave.com
>>
>> —
>> You are receiving this because you authored the thread.
>> Reply to this email directly, view it on GitHub
>> <#1479 (comment)-
403803727>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/
AADvKWPtQpBil5VfFlEJ1lafqLnmy2Oeks5uFJ18gaJpZM4VIj92>
>> .
>>
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1479 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAB9fXIVB9nNbfjsDlRwygV6UEcFcUxQks5uFWaSgaJpZM4VIj92>
.
--
*THOMAS BOUTELL, CHIEF SOFTWARE ARCHITECT*
P'UNK AVENUE | (215) 755-1330 | punkave.com
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This was referenced Sep 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looking at how this whole thing would work in local dev, ran into public file problems. I assume it's to do with symlinks.
docker-compose.yml
Dockerfile
app.js
package.json
My workstation:
Its worth noting that the compose file mounts are designed to re-layer the
/app/node_modules
back on top of the host mounted app root. The/app/node_modules
comes from the initial layer created bynpm run docker:build
.When I try to run all this with the app mounted from the host, I get these errors:
The browser network tab logs show a lot of 404.
Then, when I stop the stack, change the volumes directive in the
docker-compose.yml
, it all works fine:So I guess the question here is:
/app/public
directory to be in my git repo? seems not/app/public
to copy instead of symlink so that files created there make sense on windows host mounted volumes?The text was updated successfully, but these errors were encountered: