I have developed a symfony application and it's done.
It's been a couple of days and I can't figure out how to deploy this into a real apache server, when I copy it to the public_html it doesn't work assets don't load properly.
Can some one give me a step by step description of how to deploy it so that when I navgiate to example.com url I see my symfony application.
Thank you
If you try to deploy your application on a server, you have to configure apache. The best way its to make a virtual host.
Here the documentation:
http://httpd.apache.org/docs/current/en/vhosts/examples.html
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
I would suggest using Capifony which provides a specialized set of tools on top of Capistrano, tailored specifically to symfony and Symfony2 projects. (according to the documentation)
The advantages of using capifony are,
deploying is as simple as running cap deploy from your project root directory.
It stores multiple releases.
It allows you to use SCM(s) to pull your application code down to the server.
You can configure it to run any batch command during the deployment.
It performs a transactional-like deployment process (if any step fails, the deployment is
rolled back and the current directory points to your last release)
You'll also need to troll through this part of the documentation to figure out how to get your application running under Apache.
Related
I'm an absolute beginner on the Google app engine.
I have gone through the documentations for deploying a basic php app. The guidelines for deploying php7 apps aren't very clear to me.
Let's say I have a CMS written in php MySQLi. Assuming the project has privileges (in separate folders) for admin, users and guests, and I want to deploy it on Google app engine;
What are the configuration(s) that are most recommended for this option.
Asides the Google SDK, is there any GUI application that could help make the process easier?
Does the SDK also have version control on them? How do it update codes without re-deploying the whole project all over again?
For #1 you probably should go through Choosing an App Engine environment first. I can't help with more details as I'm not a PHP developer (which is also why I can't answer #2).
For #3 GAE itself only tracks versions at the entire service level, each deployment consisting of the entire set of the service's deployable artifacts.
However it may be able to skip unnecessarily uploading unchanged artifacts. I know it does it at least for python standard environment services if re-deploying from the same workspace, in rsync style. You can confirm this by increasing the deployment verbosity via the --verbosity option. I'm unsure if the fact that I was using git for the project mattered.
For the flexible environment services things are a bit more complex, since the deployment artifacts are docker images, see How can I speed up Rails Docker deployments on Google Cloud Platform?
If you'll have a multi-service app each service can be deployed individually, but a service deployment in itself is a complete one, not an incremental one, creating a new version of the service.
The app-level configs (applicable to all services) are individually re-deployable, without re-deploying any of the services:
To deploy the other configuration files of your service, you must
target and deploy each file separately. For example:
gcloud app deploy cron.yaml
gcloud app deploy dispatch.yaml
gcloud app deploy index.yaml
There is another way. The google console allows for mirroring of repositories withing the cloud service.
Locate "Source Repository", connect with you GitHub account and mirror a repository.
Its faster and easier if you ask me.
I have developed a Symfony2 app on my local machine. I access it using PHP's built-in server, via http://localhost:8000/
Question: how do I move this application to my VPS (LAMP CentOS) so that it can be accessed like this:
http://example.com
and is it any different for installing it on:
http://subdomain.example.com
PLEASE if by any chance you can provide a step by step instructions, it will be much appreciated and I'm sure useful to many others too. I'm used to working with stuff where you can simply move files from one place to another, update some config data and it works (Wordpress, coding without frameworks etc.)
The best solution to me is to have your project in a versionning system like git or svn without the vendors dir of course ...
This way, your simply have to do :
1) git clone your project into the prod dir
2) php composer.phar install to install your vendors
2b) create the mysql user with correct login and password according to your parameters.yml
3) php app/console doctrine:database:create to create your database with the credentials you set up in mysql
4) php app/console doctrine:schema:update --force to perform the database tables creation
5) testing the project :)
If you are not using a versionning system just upload your project to your server with an ftp software without the vendors directory ( it will be feeded by step 2) then perform 3rd , 4th and 5th steps !
For the subdomain part of your request you have to creats a subdomain folder on your server ( by using plesk if you have it ) or by manually creating a vhost config to specify the sub domain path. I can t provide you an example right now ( i m writing this from my mobile device and i don t have clear step by step procedure in order to achieve this )
[Install your environment]
So, First you need to install and run an apache Server. Find here the minimum basics to get your application running under Apache2. Then make sure you've PHP5 and MySQL up and running. Otherwise check,
Install and Configure MySQL Database Server
Installing and Configuring PHP
[Deploy your application]
Deploying can be a complex and varied task depending on your setup and
needs - Symfony.com
It's then up to you to choose the right way to deploy your application, you can do it,
Using Basic File Transfer
Using Source Control
Using Build scripts
I would recommend using Capifony which was build on top of Capistrano to adapt it to Symfony applications.
[Post-Deployment Tasks]
Your deployment process should be tailored to guarantee that all the required post-deployment tasks (Like updating your dependencies, setting your application configuration files, clearing the cache and dumping your assets, etc) are executed.
To get the big picture, read the How to deploy a Symfony2 application of the Cookbook.
Currently using LAMP stack for my web app. My dev and prod are in the same cloud instance. Now I am getting a new instance and would like to move the dev/test environment to the new instance, separating it from the prod environment.
It used to be a simple Phing script that would do a SVN export into the prod directory (pointed to by my vhost.conf). How do I make a good build process now with the environments separated?
Thinking of transferring the SVN repository to the dev server and then doing a ssh+svn push (is this possible with Phing?)
What's the best/common practice for this type of setup?
More Info:
I'm currently using CodeIgniter for MVC framework, Phing for automated builds for localhost deployment. The web app is also supported by a few CRON scripts written in Java.
Update:
Ended up using Phing + Jenkins. Working well so far!
We use Phing for doing deployments similar to what you have described. We also use Symfony framework for our projects (which is not so much important for this but Symfony supports the concept of different environments so it's a plus).
However we still need to produce different configuration files for database, front controllers etc.
So we ended up having a folder with build.properties that define configuration for different environments (and in our case also for different clients we ship our product to). This folder is linked to the file structure using svn externals (again not necessary).
The Phing build.xml file then accept a property file as a parameter on the command line, takes the values from it and produces all necessary configuration files, controllers and other environment specific files.
We store the configuration in template files and then use copy/filter feature in Phing to replace the placeholders in the templates with the specific values.
The whole task of configuring the given environment can then be as simple as something like this:
phing configure-environment -DpropertyFile=./build_properties/build.properties.prod
In your build file you check if the propertyFile property that specifies the properties file is defined and load the file using <property file="./build_properties/build.properties.prod" override="true" />. Then you just do any magic with the values as you need.
You can still use your svn checkout/update and put all the resulting configuration files into svn ignore (you will have them generated by phing). We actually use additional steps in Phing. Those steps in the end produce a Linux shell installation self-deploy package. This is produced automatically in Jenkins. We then send the package to our clients or the support team can grab the package from Jenkins and they can do the whole deployment just by executing it (we still prefer manual deployments to production servers) or Jenkins can deploy it automatically (for example to test servers).
I'll be happy to write more info if needed.
I recommend using Capistrano (looks like they haven't updated the docs since they moved the site) and railsless-deploy for doing deployment. Eventually, you are probably going to need to add more app boxes and run other tasks as part of your deployment so choosing a framework that will support this can save you a lot of time in the future. I have used capistrano for two PHP deployments (one small and one large) and although its not perfect, it works well. It also handles all of the code checkout / update, moving symlinks into place, and rolling back if something goes wrong.
Once you have capistrano configured, all you have to do is something like:
cap dev deploy
cap prod deploy
Another option that I have explored for doing this is fabric. Although I haven't used it, if I had to deploy a complex app again, I would consider it. The interface is simple and straightforward.
A third option you might take a look at thought its still in the early stages of development is gantry (pardon the self promoting). This is something I have been working on out of frustration with using capistrano to deploy a PHP application in an environment with a lot of moving pieces. Capistrano is great and works well for non PHP application deployments, but you still have to some poking around in the code to understand what is happening and tweak it to suit your needs. This is also why I suggest giving fabric a good look.
I use a similar config now. Lamp + SVN + codeigniter + prd and dev servers.
I run the svn repos on dev. I checkout the repos into the root folder of the dev domain. Then use a post-commit hook to update the root folder everytime any developer commits.
When we are happy and have fully tested the code I ssh into the prd server and rsync the dev root to the prd root.
Heres my solution for the different configs. Outside the root folder I have a config.ini file. I parse the file in my codeigniter constants.php script. This means that the prd and dev server can have separate settings without them ever being in the repos.
If you want help with post-commit, rsync and ini code let me know.
I've developed an application which uses the Symfony 2 framework. The application code resides in a Bundle, and on my local machine I just downloaded the Symfony2 Standard Distribution and added the Bundle to the src folder as the tutorials describe, before editing the config / routing files appropriately. That's served me well from a development perspective.
I'm now starting to think about how to handle the framework dependencies with regards to deploying to a production environment / a continuous integration setup. Should I continue as I have to date, using a distribution and perhaps a build tool like Phing to check out my bundle and any other dependencies? Or should I be checking out only the Symfony source from Github, and maintain a custom 'distribution' for my application?
I'm hoping someone else has had to do a similar thing and can recommend a solution that works with minimum fuss!
Thanks.
Are your tests written with PHPUnit? If so you can run the tests directly using ant, and then run Ant from jenkins. In my set-up I then have a second project that updates the git checkout in our staging environment if the test passes. I ran into a bunch of issues duck-taping this all together ( mostly around github keys, user permissions, user shell environments, etc ) but the phpqa tools work very well. I just saw this post that seems like a more recent guide on getting everything running:
http://edorian.posterous.com/setting-up-jenkins-for-php-projects
I've got this 'Hello world' project including a working build.xml that should work if ant and the PHP tools are set up correctly:
https://github.com/canuckistani/JenkinsTest
I work a lot with the WindowsAzure4E(clipse) IDE. And it's always pain to wait for the local test deployment)
Isn't there a way to develop on the deployed PHP files which must be stored somewhere to inetput or something else?
thx for your ideas.
Yes! In fact, I just got this working myself yesterday.
After installing PHP 5.3 with CGI support for IIS (making the necessary php.ini modifications of course), I simply created a new site in IIS that mapped to a role in the workspace for my Eclipse project.
Keep in mind that there's one hiccup to this and that is that the php_azure.dll file, used to access the service configuration and mount azure drives, was built to run in the azure fabric (either development or hosted). In my case, I don't NEED these features so I removed referrences to things like getconfig and poof the project loads in IIS just fine. I only need to make sure I start Azure Storage prior to launching the application.
I've been told that some folks are able to update their systems path environment variable with the location of the azure diagnostics dll (diagnostics.dll) and have it work without this modification. But this route didn't work for me. :(
I'll actually be blogging on this more this weekend as it took me a week of evenings to get things sorted out.
I found out that after the deployment the project files are copied to the folder ServiceDefinition.csx.
When you now edit the source code in this place, you can see the changes directly, without another deployment.