Good day,
I have an application written using the Symfony framework. The application works on my development server, where I have shell access. However, I am unable to load my application on my host, as I need to run symfony doctrine::build on the command line on the host.
Is there another way to load the database after or during symfony project:deploy?
You shouldn't be building anything on the production environment - to deploy your SQL, use whatever tool you use to connect to the server, ie. SQLYog, PHPMyAdmin, etc. and use the SQL schema created by Doctrine in your dev environment. If you need fixtures too, you can always just dump the SQL schema and data from your dev database.
Consider that over a project lifecycle, you only really need to deploy the main SQL schema once - the rest is iterative via migrations.
Related
I want to move my application from custom framework to laravel and I try to figure out how I'll provide tests on Laravel in future.
At the moment I test like this:
I have my app in 2 folders main and test
main folder for appexample.com domain
test folder for test.appexample.com domain
So when I want to do some changes, firstly I make it in test folder and check if everything works fine, then I copy with replace test folder to main folder
If I would want to use laravel, how should I do those tests correctly with laravel?
Thanks
So, what you have is not a test environment but a staging environment...
What you would have to have is 2 Laravel apps:
Production (appexample.com) should be using a production GIT tag (for example, v1.5.3) or at least use a production branch like master or main
Staging (test.exampleapp.com) should be using a development branch like develop or whatever your team defined as it
You can have a look at Laravel Forge and Laravel Envoyer.
Forge: Allows you to manage servers, environments, deployments, PHP versions, databases (I do not recommend to have a database on the Laravel app server), and more stuff
Those servers can be on AWS, Digital Ocean, and more
Envoyer: Allows you to manage deployments, environments, and more
The take away from Envoyer is that it will help you deploy easier to multiple servers (let's say you have a load balancer and 4 servers behind it, it will automatically deploy the same code and run deployment steps on each server, and if any fails, it just goes back without the client knowing anything happened)
This means you SHOULD (I would say MUST) have separate databases, one for staging and one for production (YOU NEVER RUN PHPUNIT TEST ON ANY ENVIRONMENT EXCEPT LOCAL OR DEVELOPMENT).
Also, you should "replicate" your data on staging, so staging is as similar as possible related to prouction:
Same database version
Same web server engine
Same PHP version
Etc.
If you are going to upgrade any, it is fine if staging has a newer database, web server, PHP, etc. version than production, that is the idea, test stuff there before release.
I developed a desktop application in react and electronjs. And built an API with laravel, eveything works perfectly. The challenge I have is, how I can deploy and run my electron app locally without having to manually setup the laravel API.
I am looking for a way to have all of this setup and installed once. I checked out a couple of options and one of such is php-server but that wasn't still going to cut it.
Shell Scripting
I have thought about executing a shell script to create the server instance pull my laravel application from github, set it all up on docker.
The challenge is, if any of my users run docker ps they would see all the processes running on my docker instance.
A possible solution would be isolating docker so it's not accessible globally but only within the application.
I don't know how to achieve this.
If this is achievable please drop some guide on how to achieve that or maybe suggest a better way to handle my current situation.
I just started out with CakePHP and try to configure a plugin.
The plugin requires a table and contains a schema.php file that contains a class describing the table. From what I gather I have to run a command in my server CLI that will build a table according to this schema.
But my server doesn't seem to have CLI (it's cPanel, and my website is hosted by a good but cheap host). I tried to access the server using Putty, but the connection is aborted when I try.
However, I do have phpMyAdmin where I can run SQL commands. So if I can 'convert' my schema.php in the appropiate SQL commands, I can copy these manually and run them. Is there an easy way to do this?
(I know, the fasted solution is probably to just enter the table by hand. but that would be boring)
Thank you!!
Scipio
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.
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.