phundament / app

Dockerized Yii2 web application base
http://phundament.com
Other
310 stars 129 forks source link

Creating create a new folder in web/assets in AppAssets.php #159

Closed eduardo-g-silva closed 9 years ago

eduardo-g-silva commented 9 years ago

I am trying to move my local app to production and having some problems with: touch(\Yii::getAlias($this->sourcePath), max($mtimes));

I see that is the same as: http://www.yiiframework.com/wiki/789/forcecopy-per-asset-bundle/ But I cant make it work as I get: touch(): Utime failed: Operation not permitted

I give ownership and max permissions to all folders but no luck.

If I comment the line the rest of the application work fine but of course is not picking up the changes in my compiled .css file of /assets/css

What i am doing wrong?

schmunk42 commented 9 years ago

You SHOULD NOT use that in production - it degrades performance and is only for development. Make sure you have set YII_ENV=prod.

As a workaround: Simply clear your assets on your production server in case you have problems.

But I'd advice you to use the asset bundling system of Yii 2 to get the best results. See also https://github.com/phundament/app/blob/master/docs/43-asset-compression.md - but WIP and docker recommended.

eduardo-g-silva commented 9 years ago

Thanks a lot Tobias it makes sense now I will have a look to the differences in the config with prod and dev and the assets compression.

schmunk42 commented 9 years ago

You can also take a look at https://github.com/phundament/playground/releases/tag/0.0.2 - which is a demo application with asset compression enabled, but as said Docker required (and strongly recommended ;))

eduardo-g-silva commented 9 years ago

Tobias sorry for boder you I will deninetly go the docker way but I need 64bits in my dev server or setup vagrant but I need to move to prod this app and I am doing something wrong.

When I change to prod I am missing the css and js in the main.php i see: 'bundles' => YII_ENV_PROD ? require(DIR . '/assets-prod.php') : null,

Then if if i run the assets.sh creates the folders and files in the web but I cant find the way to create the required css an js files like: /assets-prod/css/all-bb8b94f9263491f08c5897853be9d15b.css

If i manually minify and copy the app.css and botstrap.css with the name that was created it work but i worry the file name will change.

How can I generate these files?

schmunk42 commented 9 years ago

Here's a link to an auto-generated version so you can get an idea of the structure, but it may be hard to manually create it.

Also read about the process of asset compression in Yii 2.0.

I've just recommended docker, because in the phundament/app:development docker image has all required packages pre-installed.

eduardo-g-silva commented 9 years ago

thanks again i manage to do it comparing the dev and prod html. tha vendors are fine the one that I was missing were bootstrap, yii and my app i minify and put them all together and it is working fine and give me some time to learn and install docker

eduardo-g-silva commented 9 years ago

Hi tobias I was playing with docker is new to me and i can see that has lot of potential. we are only 2 main developer so we normally fine with our box, vagrant and git to work but i like the idea to share environments with other people.

I first tried with boot2docker but I fill more confortable with vagrant and docker when I test creating the containers it is fine but i have some issues with the playground

I am folowing http://phundament.com/docs/51-vagrant-docker.md

vagrant up db Works fine onle a red on db: stdin: is not a tty (but i get that always in vagrant)

After the playground folder is mount I got:

db: Processing triggers for libc-bin (2.19-0ubuntu6) ...

==> db: Syncing folders to the host VM... db: Mounting shared folders... db: /var/lib/docker/docker_1426070117_68 => C:/open-ecommerce/00_sites/playground A Docker command executed by Vagrant didn't complete successfully! The command run along with the output from the command is shown below.

Command: "docker" "ps" "-a" "-q" "--no-trunc"

Stderr: time="2015-03-11T10:35:09Z" level="fatal" msg="Get http:///var/run/docker.sock/v1.17/containers/json?all=1: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TL S-enabled daemon without TLS?"

is like i need sudo to run the ps...

Not sure where you run the docker ps i can find it in the Vagrantfile or in the other files inside the build folder.

you get whats happend?

Konrad90 commented 9 years ago

The method in 51-vagrant-docker.md doesn't work on windows anymore.

You can try using my Ubuntu Dockerhost Vagrantfile https://github.com/Konrad90/ubuntu-dockerhost-vagrantfile