Deploying a PHP CMS with Capistrano - php

I have recently started playing around with Capistrano for my PHP projects, I have it working great on a static site, however the majority of my projects are built on a CMS, the most common one is Concrete5.
The problem I am having when it comes to a CMS driven sites is that a bunch of the content of the site is uploaded files which I do not want in my git repository but they need to exist within a folder that is in my repository. As an example, all of my code within a concrete5 site lives inside /application, but the user uploaded files live in /application/files. How can I preserve this folder between versions?
I have done a ton of googling on this and haven't been able to find a decent answer, I'm not sure if I am searching for the correct term though.
Many thanks in advance.

Related

Laravel - One CMS / multiple sites

Laravel Folder Structure
I developed a CMS with laravel which I want to use for multiple websites. My goal is to have a single place to develop my CMS further and don't have old "CMS code" in older websites.
The problem is that I dont know how to structure my laravel folder structure.
This is what I have in mind:
--cms
--website-1
--website-2
--website-3
each website must have it's own
- public folder
- .env file (or config for database and other website specific settings)
- routes
- resources(views, assets)
- controller('s)
- lang files
- etc.
Development Environment
In development I want to use the website's domain(website-1.test) as indicator what website folder should be used.
Production Environment & Git
I use forge to deploy my websites. My idea is to have a git repository for the CMS and a git repository for each of the websites. In the websites repositories I only push the website folder. In the CMS repository the whole project is saved but all the website folders are .gitignored.
So for the production server i had this folder structure in mind:
CMS (git repo)
website (git repo)
When updating the front of a website I push the website repo, if I want to update the CMS I push the CMS repo.
Conclusion
Bare in mind that these are my first thoughts and I am aware that my ideas might not be possible at all. I'm looking for advice and suggestions for my situation. If it can be achieved in another way or a better way I'd be glad to receive advice on that.
Thanks in advance!
Ok .
It is not posible in same project.
But you can make subdirectories for you domain name.
It will become website-one.yoursitename.com.
And this each subdirectory will have its own files.
Thats all you need to accomplish what you want.
Regards.
I have two initial ideas of how what you are asking for potentially could be achieved:
API
Make one repo for backend creation through CMS in witch you can create multiple APIs for various sites. Then make a front-end repo for each site that calls the corresponding API.
https://laravel.com/docs/5.8/eloquent-resources
Package
You could make a composer package for your cms code and then pull that package in to each of your website project
https://blog.jgrossi.com/2013/creating-your-first-composer-packagist-package/

Eclipse: Share a large framework with multiple projects?

We develop in PHP and HTML/Javascript.
Over time we developed a very big source code library, that contains a couple of hundred PHP and Javascript libraries, that we use for every project. The framework resides its own svn-repository, that we include with an external svn link in each project.
The problem is, that the entire framework itself is about 800MB now.
With only a few projects that we worked on, this wasn't really a problem, but now we have about 30 projects, that all contain a FULL copy of the framework, which takes up a lot of space, and requires constant updating of each copy.
Somehow I would like to have the framework outside the project folders. I've read about referencing other projects in Eclipse, but couldn't really get it to work.
How do you setup the include paths so that each projet 'thinks' that the framework is normally inside the project folder? And can you make a virtual link in an Eclipse project to edit files in the framework just as you would normally do, and get code assist for the libraries too?
One of the main problems is that all our code (and some libraries in the framework itself too) relies on the fact that the framework is in a folder 'framework' inside each project. I'd rather not change all those references to a different path, so maybe I need some .htaccess trick to make this work...
Does anybody else follow the same procedure?
Any advice ?
can you use the "big" project as target platform?
why-create-a-custom-target-platform
If you define it as target platform, the sources are available in your workspace, but they are placed in 1 folder for multiple workspaces. the workspaces will link to the platform, but will not check them out.

PHP-based CMS that can use static files as pages and include a forum and blog?

I am currently working on a project documentation site for an OSS PHP project. Presently all of the docs are written in Markdown and stored as separate files.
I would really like to keep the core documentation as static files within the project so that they can be downloaded and used as well as read on my website. But on the website, I'd like to render those pages from within a CMS.
In addition to presenting the code docs, I also want to provide a forum for discussion and a blog.
Wordpress is what I have experience with, but is there a better system for what I am trying to accomplish specifically?
For Blog and CMS I would suggest stick with Wordpress since you already have experience on it. And as far as Forum is concerned I would suggest SimplePress forum. I have been using it on my Wordpress installation and found it really good. You can see live forum on the link above to see how it looks in real world.
Also Wordpress has several nice plugins like Download Manager that will give you ability to manage your downloads/files.
Can't confirm if wp is the best, but it's certainly good enough.
To include your docs, you'll have to write a plugin, not likely that you will find one existing that does exactly what you want.
For forum, you should find a plugin. Google for posts similar to this to choose a best match.
Firstly Wordpress isn't a framework.
I believe CakePHP has the functionality to load hardcoded pages when they're placed in the webroot folder of the app. I'm unsure as to how they're loaded in regards to routing/templating however.

PHP Application Structure/Pattern - 2 sites with shared libraries and assets

I'm having a bit of an application structure design dilemma.
I have created a web app that creates online surveys. It all works fine, but I would now like to create a new site that does different types of online surveys. This new site will be pretty much 95% similar in terms of layout, logic, functions, etc.
Rather than duplicate all the code from the current web app, I'd like the new app to share in the "fountain of knowledge" created by the current app - so to speak.
Can anyone enlighten me with their experiences of doing this sort of thing? Their best practices?
As a rough guide, I'm currently thinking of using symlinks for all the major logic files (library.php, functions.php, etc), and then deciding which logic to use based on which URL the user logged-in from.
Does that sound like a good or bad idea?
Would it be any better or worse to divide the whole system in to 3 sites, with the site in the middle containing all the common elements and logic? This middle site would have no independent use - it would be used from either of the 2 applications looking for functionality and assets, etc.
Any help and experience on this matter is very much appreciated indeed.
I'm very wary of going down a dead-end solution.
Kind Regards,
Seb
Good solution if:
you host your website yourself and creating symlinks between differents virtual hosts is not a problem
you won't have to make significative changes between the 2 websites
But instead of using symlinks, I could take advantage of PHP's include_path directive and put the common libraries in this path. This way, just write your includes relative to this path, the files will be accessible from any site you want on the same server.
The second advantage of using include_path is you can bypass any open_basedir directives which wouldn't allow you to include files which are not in the same virtual host base dir.
This is how I'd do it...
Create a core library.
Create you 2 site directories.
Create site specific code folders in
each site.
Create core library folders in each
site that simlink to the main core
library created.

Using the same php sofware for multiple domains inside the same apache webserver?

Basically, lets say i have a webserver and i resell hosting specifically for local churches.
i have 5 churches as clients, i have a simple CMS made for them they are equal copies of the same files, for each website i install the CMS , database and the website, i think it's a waste of resources.
i would like to know if i can do the following, afaik most webhosts have the following structure:
A main directory (home)
www.church1.com (church1)
www.church2.com (church2)
www.church3.com (church3)
www.church4.com (church4)
www.church5.com (church5)
basically i want the CMS to be on the Home directory, and each one of the Churches (clients) would only have a Config file, a Database ant the template regarding their websites.
so the system source code would be shared, but the website design and the database files would be completelly separated.
i'm not a webhosting or a development expert, but i know my way around, i'm sorry if the question is too basic, i'm having a hard time finding if this is possible.
EDIT: I Think Rudu's reference pretty much solved my problem!
Since you are building it yourself, put the include files (application logic) in a folder or include path that is accessible to all the domains. Then you can put your template files, images and stylesheets in the individual domain folders. If you are database driven you can check the domain $_SERVER['HTTP_HOST'] and load results from a certain table or database based off of that. You really can go a lot of different directions here if you are building it yourself.
It is possible - the answer. Exactly - there are some settings ( and now i dont remember them ) that can block it - but set up in all sites that libraries are there and be happy

Categories