I have a VPS on Godaddy with CentOs6 and I want to setup a testing environment for my project.
I got myself a free domain and set it up on my VPS with no problems. I uploaded my CakePHP Project to my testing environment with my new domain, so far so good.
The problems come when I realize that my testing environment which is running on the same server with a different domain and a different account is using my Production files. If a check my APP Global Variable it returns /home/production/public_html/app/ and it should return /home/testing/public_html/app/.
If I delete bootstrap.php I get an error that the file couldn't be found but if it is found the files that are used are the ones from my production environment.
I hope I've explained myself well.
Probably a caching problem. If you're using cakephp 2.x make sure that you clear the files in app/tmp.
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.
Until yesterday my Phalcon PHP application was running perfectly on PROD and today is working only on DEV and LOCAL environments... and I don't have a clue what is going on there! The codebase is exactly the same on all environments, the configs and the routes are correct as well.
For example, if I want to get to a custom defined route, like "/my-custom-route", it always gives me the error message "MyCustomRouteController handler class cannot be loaded". But the rest routes are working fine, like "/contacts" which comes from ContactsController.
As an additional information, "/my-custom-route" has been implemented through ToolsController and gearAction().
The problem appears only on PROD! On DEV and LOCAL there are no such issues which is super strange... The LIVE server is Debian with Apache. DEV server is the same (Debian/Apache), and LOCAL has Ubuntu/Apache installed. All versions are the latest ones - Phalcon Framework (3.4.5), Apache (2.4.41), PHP7 (7.0.33), MariaDB (10.1.43).
Does anyone have an idea where might be the issue?
My first guess would be a case sensitive issue. But since you're running Debian on dev as well don't think this is the issue.
Not sure what changes are done but maybe you're looking at a file being cached by opcache?
Problem solved! Turns out that it was a configuration issue. I use values from an INI file where env, site_url, api_url are defined and the site_url was set without 'www.' which caused the custom URLs to be unavailable.
I got started with Laravel 5.3 and I got my development environment working on local, but now I need to upload the app to production server. I cant found nothing about configuring two environments on same app.
I use Apache web server on both (local and production).
Any guide/doc is well received!
The docs (as pointed by Marcin) suggest to use the .env file to configure your environment. Different environments = different .env files. Thus, on local machine you'd have an .env file with your local enviroment configuration, and on production you'd have a different .env file, and a diffrent one for staging, and so on... APP_ENV=production
Which can be brought forth with App::environment()
Remember to exclude the .env from versioning, cheers.
Better to follow this blog:
https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/
With that blog, if you're not using Nginx but Apache, that's fine because we are more concerned with the Laravel configuration and permissionings on files and folders than the web server.
My web application is up and running on production. But I lost my development sources due to laptop got formatted. Can I recreate my development environment from production environment?
I tried following steps but no success:
Installed Laravel 4.0 server.
Copied public html folder content.
ran composer
copied /app/config/ to /app/config/local/
modified /bootstrap/start.php to local host name.
But still when start my local server it is not able to map path of files correctly.
If your development and production server is same version then you should just change the url, database credentials etc.,
If the versions are different versions then you should place the views, controllers, then in the controller you should require all the stuffs that you need
I believe you should have same versions of laravel in production and development.
So, you should probably change only the db credentials.
Note : Clear the views and sessions in the storage after you change the credentials
Advice :
Please use SVN to avoid such happenings in future
I'm currently working on a symfony webapp, which is already on production. To develop and add/delete/modify functionnality of the model, I work on my laptop, using symfony 'dev' environnemment.
I test if everything work fine, then I pray a little and deploy it on the prod server (with all the risk of data error, like when I add new not null attributes on the model, prod server configuration special stuff, version of php/apache etc.).
The problem is that I would like to setup a "staging" server, which would be a copy of the production server (same database, same configuration apache/php), so that, if the deployment goes bad, the production user stay untouched and working, only the staging server is down. But my client has only 1 FTP available.
So, the question is : can I run 2 symfony project, with different models, on the same FTP ?
Or is there another way to do what I want to do ?
Thank you !
A staging server should really be exactly the same as production. Same versions, same directory structure, etc... a clone. However, you can still get most of the benefits by installing the site into a subdomain (staging.domain.com). Check to see if their host allows subdomains (%99.999 of them do) and install your application there.