This question already has answers here:
How do you deploy a website to your webservers?
(7 answers)
Closed 8 years ago.
We have a small company and we have developed our own CMS in PHP/MySQL.
The code is stored in local files and in the database.
We'd like to be able to update the code of the CMS on our client's servers.
This process should be semi-automatic, once we 'publish' the update, the code gets replaced on the client's server and in the database.
I was thinking about using Bazaar in combination with Bazaar Upload. This would take care of the files.
But what about the database? Is there a standard method already available or should I upload a .sql file that gets installed when a user logs in to the CMS?
Thanks in advance for your suggestions!
For this sort of thing I'm considering liquibase, but it needs java to run so you either need java on the server or maybe on the machine from where you are triggering the deployment.
Use combination of SVN/SVN and Cron
use install package (.rpm,.sh,.deb, whatever) and setup cron job to run your update script
UML:
#!/bin/sh
fetch $version
if(version > current_version); do
cd /path/on/client/server
svn update
/path/on/client/server/update_script.sh
done;
where update_script.sh will take care about whatever you need (sql,cron,files,certificates, ...)
Second variant
You can use something like fake cron job
In Administration you can create "Autoupdate" feature, which can be triggered by button/link or by timer. Timer is activated by running autoupdate script after login to CMS Administration
Simple check time from last update check and perform download of files, running .sql scripts or whatever you need.
Related
This question already has answers here:
Convert a PHP script into a stand-alone windows executable
(7 answers)
Closed 9 years ago.
I developed one project using YII framework. Now I want the project in single executable file.
Is it possible to create using yii or php libraries.
How to create .exe executable file for yii project.
And is it possible to convert project file to some format that if I install it any others
place that they can't read may be some encrypted format.
Short answer: Not possible.
Long answer: It depends.
You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.
or
You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.
It might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.
PHP Desktop which allows you to create desktop apps in the same way as you build websites with php/html/js.
The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysql and make the website work from a usb or CD with autorun.
there are many good options for the same and you can find them at PHP Compilers
I have used PHPLanger for the same
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Best Practices for Code/Web Application Deployment?
I don't know if this is relevant to stackoverflow or not.
I always update & test code locally, then when it's time to upload the changes it's giving me a nightmare.
Like I will either have to go through Git repo & check what I've done & selectively upload files (not to mention DB changes) or I'll have to upload the whole thing all over again.
Selectively uploading files & applying DB changes is a headache & the full upload results in interruption of service for a few minutes or even worse.
Is there some standard way of doing this?
codeigniter specific -
name your codeigniter application folder something relevant - the date or your version number. do the same with the system folder so you can quickly see what version of codeigniter you are running.
if you need to do a full upload heres how to do it with no interruption - name the application folder with a newer date or version. upload the folder. then in your index.php file change the name of the application folder to new version. besides switching to new version with no down time - it also gives you instant roll back if you find a bug - just change the application name back in your index file. much less stress then trying to selectively replace files on a live site.
you need to get an app like SmartGit or similar so you can do your git tracking and changes locally on your computer. make your commits locally - you will do it more often because its local so you will have a better commit history - and will be much faster when you need to push to remote.
small point but if you put your application and system folders one level above the index.php file -- its much much more secure, and it keeps things organized if you have different application folders.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Currently I'm trying to build a good scheduler system as an interface for setting and editing cron jobs on my system. My system is built using Zend framework 1.11.11 on a Linux server.
I have 2 main problems that I want your suggestion for:
Problem 1: The setup of the application itself
I have 2 ways to run the cron job:
First way is to create a folder scripts and create a common bootstrap file in it where I'll load only the resources that I need. Then for each task I'll create a separate script and in each script I'll include the bootstrap file. Finally, I'll add a cron task in the crontab file for each one of these scripts and the task will be something like ***** php /path/to/scripts/folder/cronScript_1.php .
Secondly treat the cron job like a normal request (no special bootstrap). Add a cron task in the crontab file for each one of these scripts and the task will be something like ***** curl http://www.mydomain.com/module/controller/action .
Problem 2: The interface to the application
Adding a cron job also can be done in 2 ways:
For each task there will be an entry in the crontab file. when I want to add a new task I must do it via cPanel or any other means to edit the crontab (which might not be available).
Store the tasks in the database and provide a UI for interacting with the database (grid to add few tasks and configuration). After that write only 1 cron job in the crontab file that runs every minute. This job will select all jobs from the database and checks if there is a job that should be run now (the time for the tasks will be stored and compared with the current time of the server).
In your opinion which way is better to implement for each part? Is there a ready made solution for this that is better in general??
Note
I came across Quartz will searching for a ready made solution. Is this what I'm looking for or is it something totally different?
Thanks.
Just my opinion, but I personally like both 1 & 2 dependent on what your script is intending to accomplish. For instance, we mostly do 1 with all of our cron entries as it becomes really easy to look at /etc/crontab and see at a glance when things are supposed to run. However, there are times when a script needs to be called every minute because logic within the script will then figure out what to run in that exact minute. (i.e. millions of users that need to be processed continually so you have a formula for what users to do in each minute of the hour)
Also take a look at Gearman (http://gearman.org/). It enables you to have cron scripts running on one machine that then slice up the jobs into smaller bits and farm those bits out to other servers for processing. You have full control over how far you want to take the map/reduce aspect of it. It has helped us immensely and allows us to process thousands of algorithm scripts per minute. If we need more power we just spin up more "workhorse" nodes and Gearman automatically detects and utilizes them.
We currently do everything on the command line and don't use cPanel, Plesk, etc. so I can't attest to what it's like editing the crontab from one of those backends. You may want to consider having one person be the crontab "gatekeeper" on your team. Throw the expected crontab entries into a non web accessible folder in your project code. Then whenever a change to the file is pushed to version control that person is expected to SSH into the appropriate machine and make the changes. I am not sure of your internal structure so this may or may not be feasible, but it's a good idea for developers to be able to see the way(s) that crontab will be executing scripts.
For Problem 2: The interface to the application I've used both methods 1 & 2. I strongly recommend the 2nd one. It will take quite more upfront work creating the database tables and building the UI. In the long run though, it will make it much easier adding new jobs to be run. I build the UI for my current company and it's so easy to use that non-technical people (accountants, warehouse supervisors) are able to go in and create jobs.
Much easier than logging onto the server as root, editing crontab, remembering the patterns and saving. Plus you won't be known as "The crontab guy" who everyone comes to whenever they want to add something to crontab.
As for setting up the application itself, I would have cron call one script and have that script run the rest. That way you only need 1 cron entry. Just be aware that if running the jobs takes a long time, you need to make sure that the script only starts running if there are no other instances running. Otherwise you may end up with the same job running twice.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Making a distribultable standalone program in PHP
I don't know how to explain my idea...let me explain it by example....
Typically, I can have an application on the client side, when I launch it, it runs, until I close the application. Many desktop application works like that, right? But an application on php server is different, it only start processing when the user make request.... ....
So, my question is, can I make the php program become something like the desktop application, when I start it, it launch, until I kill the program, (for example, when I launch the application, it keeps pinging the google.com, until I stop the application.), doesn't need the user make request to "active" the program... Thank you.
If you have regular stuff to do, it usually done by cron ( http://en.wikipedia.org/wiki/Cron ), which invokes your script to run on the server.
If you want to start it from a command line, and want to do stuff again-and-again, you can write a while loop like
while($end==1) { do(); sleep(100); }
If you want to do a desktop application (which runs on the client, rather than the server), you can use: PHP-GTK http://gtk.php.net/manual/en/tutorials.php
If yours not one of the cases, please clarify.
What you are describing sounds like a daemon process, not a standalone application.
This is possible in PHP, the functionality is included in PEAR's System_Daemon package.
See this tutorial: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
I was wondering how to start coding a script using php, and that script will be used on many websites.
so should I start first by creating the database ? and then start creating php files that will process data from the database ?
and should I start thinking of an install wizard for this script at first, or later when I finish the project I'll create one ?
I'm really confused on how to start a project, can you please give me some advice ?
and thanks everyone :D
should I start first by creating the database?
If you are going to use a database in your PHP script, then yes, you should install a database first. MySQL is a good start.
and then start creating php files that will process data from the database?
I would start on one server first, and create one PHP file called index.php that will do a database query. Then work your way to multiple PHP files from there.
and should I start thinking of an install wizard for this script at first, or later when I finish the project I'll create one.
Installing PHP files is 90% of the times as simple as just copying them onto your new server. I wouldn't worry about an install wizard just yet.
Another general tip because you are a beginner: install WAMPServer, it is a webserver/PHP server/MySQL Server in one that runs on your local computer. This is great for developing because you can just put your PHP files in C:\WAMP, edit them and directly see the result in your browser through http://localhost/. Then when you are happy you can upload to the server, or multiple servers. (Just by copying).
Most php software does not have, or need for that matter, what you would call an install wizzard.
I would suggest you to develop whichever way feels most natural to you.
Some people find it easier to start with the database design, while others prefer to write some code first and then expand the db schema further. There really is no right way to do it.
Starting a PHP project can be as easy as creating a text file and pumping out lines of code, however if you plan on creating a sizeable project, I would suggest a fully featured IDE.
Decide what dependencies your script has.
Decide which minimum version of PHP the script will be compatible with.
Work out a script which queries the users setup to detect whether these conditions are met or not. (eg does it rely on the mysql extension to be installed).
Detail how to meet each of the dependencies in case they are missing.
Explain which is the minimum version number supported, if your script detects it is below that version number.
Test it on your target Operating Systems.
Run a script which creates a database, test whether that was created. Provide detailed instructions on how to do this manually, and how to provide the correct privileges.
If necessary give them a config file which permits them to enter key information such as doc_root etc.
Conform to common wisdom such as short_tags = off else override these settings. Imagine the user is on shared hosting and is running on safe_mode = on.
Try and follow your own instructions and re-install it on your localhost, then on a live server - ideally on a variety of OSs too.