jueves 26 de mayo de 2011

Tutorial : Running a symfony project under Dotcloud



Dotcloud is under beta now, you can ask for one.

The main issue I got while try to run a symfony project was to change the root directory. Googling fot symfony and dotcloud didnt answers this...so I create this post.

Lets create a new project

dotcloud create your_symfony_project_name

Lets create the www and db
dotcloud deploy --type python your_symfony_project_name.www
dotcloud deploy --type python your_symfony_project_name.db

Now optionally, import the database. In this case I was using mysql
otcloud run your_symfony_project_name.db "cat > data.sql" < your_local_dump_file.sql
Before push your code to www, lets add nginx configuration for Symfony. create nginx.conf at web directory of your project with this:
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
  expires 7d;
  break;
}

location / {
  try_files $uri $uri/ /index.php;
}

#Remove this at production!!
location ^~ /frontend_dev.php/ {
  try_files $uri /frontend_dev.php;
}
Next step upload the symfony proyect PHP files.
dotcloud push your_symfony_project_name.www ~/your_symfony_project_name
Symfony needs the root directory to be in "web" so create "dotcloud_build.yml" in your aplication root directory with this:
www:
    approot: web
REMEBER: clear the symfony cache!! To clear cache:
dotcloud ssh your_symfony_project_name.www 
cd code
./symfony cache:clear

Thats all folks!

3 comentarios:

chudi dijo...

Thanks I was looking for this

cuhdi

chudi dijo...

thanks I was looking for this!

Leonardo dijo...

thank you chudi, hope you enjoy the tutorial!!

Google Analytics Alternative