This project is using the FuelPHP framework but the question is around organisation of files.
My file structure is as follows:
/fuel
/app
/assets
...
/public
I current have assets.mydomain.com pointing to /fuel/app/assets but where would I place user content files such as profile pictures, etc.
In terms of deployment, I have never deployed a project like this before and I need some way of automating it, (using rsync or something). I wondered if anyone could recommend a way I can do this without wiping user files.
As suggested, I kept the assets directory under public. User content is stored in the media directory:
/public
/assets
/media
Regarding deployment, I use a simple git workflow: I have a bare git repo on my target server and a post-receive hook that checkout the branch in the working directory under my docroot.
To deploy, I just push from my local repo to the bare remote.
More details here: http://toroid.org/ams/git-website-howto
Related
I finished my symfony project, and bought a hosting and domain. Previously I have uplaoded sites to web, but it was just put everything in public_html folder, and the site is running. I tryed this with the project, but it wasn's the case. I'm a bit confused, because at the my storage I had a lot of folders on default. This is how it looks:
Where should I upload my folders?
Uploading symfony is a little tricky thing , symfony is not a normal website it's a big framework
First you need hosting with ssh access ( without it you'll have a lot more problems )
create folder symfony on the same level that is public_html
copy all your project data , without vendor directory and composer.lock file
login via ssh and
cd symfony
composer install
You shoud always use composer - because it 'll check all dependencies with you php version on server (different libs and extensions may require different php version and diffent modules) , and let you know if something will be not right.
rm public_html folder, and create symlink to symfony/web
ln -s public_html ~/symfony/web
upload sql to database
I developed application in laravel 5.2. I was using the Virtual host on local and pointing publice/index.php easily.
But on production why we need to using the put index.php & all stuff out of public folder. Is this best practice to deploy on production?
I copied whole in project folder and public folder stuff copied on the root(public_html) of server.
I changed the index.php accordingly and its working fine.
require __DIR__.'/project/bootstrap/autoload.php';
$app = require_once __DIR__.'/project/bootstrap/app.php';
Issue is When i use auto deployment tool, It pushes whole code in project folder. Every time I move assets by ssh from project/public/assets to root/assets manually.
Main Issue
I am also facing issue, saving profile picture in assets folder. But it save picture in project/public/asset instead it should in root/assets. I am really confused on this issue too.
Advise me
Please recommend me the best practice, where should i keep public folder stuff and how to manage auto deployment.
Can we keep index.php inside public and point directly index.php here. In this way auto deployment work fine.
Issue in after deployment commands
I am using DeployHQ.com to deploy my code. It execute ssh commands, but unfortunatly my command doesn't work because artisan file is inside of root/abc/project folder. I dont know where this shell execute commands. or How to point project folder directly to execute these commands.
Bitbucket webhook return 422 error code
I am using bitbucket webhook on approve event. I have given it deployment url and auto deployment is switched on. Hook triggerred as well, but it didn't deploy any thing, It shows error code 422 and error "Could not decode the deployement".
The index.php file should be in the public folder. Everything else should not. Your web server should be configured to point to this directory.
The index.php file bootstraps the Laravel framework. The framework files should sit in a directory outside of the publicly accessible folder. This is usually in the directory above the public/ folder.
You shouldn't work around your deployment tool. It should be configured to maintain this directory structure. Once there is no confusion as to where files should be pushed, you can begin to solve your other path related deployment problems. To avoid future pain, I'd recommend setting up your dev environment as close to production as possible.
Docs basically says I need a envoyer-root/storage folder alongside with envoyer-root/current and envoyer-root/releases and then use a system link to link envoyer-root/storage to envoyer-root/releases/{latest one}/public/storage in order to read those files.
What nobody seems to explain is, where are the newly uploaded files saved to? By my application, they'd be uploaded to envoyer-root/releases/{latest one}/public/storage but that wont make it accessible for the new releases.
Do I have to create a post-deploy and manually copy all the files from the previous release to the envoyer-root/storage folder and THEN linking it? Am I missing something?
PD: for references, I'm using Envoyer with a non-laravel project, so I need to understand if I have to modify my source code to work with Envoyer (which seems smelly to me but w/e we already paid for it), or if I don't and I'm not seeing something.
Use the "Linked Folders" (within the Deployment hooks tab) to create a symlink from the currently deployed release to a shared storage folder on the server.
So in your case, you'd want to create a symlink from the currently deployed release to the envoyer-root/storage. In Envoyer, the link from/link at is relative to the "PHP project root", which is your currently deployed release, and the to link is relative to the server root, so you'd have:
Create link at: public/storage (relative to release path)
To: storage (relative to server root)
Symlinks created through the linked folders feature are created on each deployment, so it will always create a symlink for each new release.
More and more projects are starting to pile up and I want some workflow and also version control over the different projects. I'm trying to set the "right" workflow with Xampp, Git, GitDesktop and PhpStorm on a Windows 2012r2 machine.
Xampp base: d:\xampp
http://localhost = d:\xampp\htdocs
Dev repositories: d:\xampp\htdocs\repositories\dev\GitDemo
Live repositories: d:\xampp\htdocs\repositories\live\GitDemo
Live folder: d:\xampp\htdocs\GitDemo
Live URL: http://servername/GitDemo (intranet use only)
Right now I have my repositories folder inside the htdocs folder, otherwise I would need another alias/copy action to be able to see what I'm developing. But at the same time the repositories folder is exposed. How to hide this? htaccess?
I've ran git init --bare inside the live folder for this project. With GitDesktop I've created the repository for GitDemo inside d:\xampp\htdocs\repositories\dev.
Using PhpStorm I've created a project based upon local files and pointed it towards d:\xampp\htdocs\repositories\dev\GitDemo. I'm able to see the changes made using git status, add them using git add . and commit them succesfully with git commit -m "my commit..".
I've created a remote server git remote add live master and created a post-receive to checkout the files inside d:\xampp\htdocs\repositories\live\GitDemo to d:\xampp\htdocs\GitDemo.
This all feels like a "ton" of work to set up initially and somewhat redundant (having the same files in 3 locations).
Is this the ideal way to set this up, or do you suggest an alternative approach? Thanks for sharing your thoughts!
I've been thinking about the most logical solution (to my opinion at this moment). Here's how I solved my unclear items as described:
I've optimized it by:
Bringing the repositories directory outside htdocs to d:\repositories\dev\ and d:\repositories\live.
I've set up a symlink to http://localhost/dev/GitDemo that links to
d:\repositories\dev\GitDemo. In this way I don't need to place the
repositories folder inside the htdocs folder and still benefit from
Apache being able to serve the content, which actually resides outside the htdocs folder.
The live version is now placed at http://localhost/GitDemo and with a post-receive hook it gets deployed from d:\repositories\live\GitDemo.git to d:\xampp\htdocs\GitDemo.
If you think I made a mistake or have mistaken something from the way it's supposed to be, please correct me as I'm still not sure this is the correct way but at least it seems like it to me.
I have a Git repository which contains an ASP.net application and a PHP application, each in its own subdirectory under the root of the Git repository. I would like to create two websites in Azure websites and deploy each of these applications to one of those websites. I can deploy the ASP.net application with no problem by setting the project variable in the settings panel on the website properties to the path to the CS project file. However I cannot successfully get the PHP site to deploy. I have tried setting the WWWroot directory, but Azure is still trying to build the csproj file even though it is not specified by the variable on that website, nor is it present in the root directory of the Git repository. How can I make the PHP site deploy correctly, without needing to put it in its own repository?
Figured it out: I just set the "Project" attribute in app settings to the directory name of the PHP application, relative to the root of the repo.
In case it helps, I used to do this on a number of my projects, but have since migrated to a new strategy.
Now, I create a git repository for my overall project and repositories for each of the "sub projects" within it. For my Tweet Monkey project, for instance, I have http://github.com/codefoster/tweetmonkey as well as http://github.com/codefoster/tweetmonkey-raspi, http://github.com/codefoster/tweetmonkey-edison, and the website at http://github.com/codefoster/tweetmonkey.io.
Then I link the sub projects into the main project using submodules by typing the following at the command prompt...
git submodule add http://github.com/codefoster/tweetmonkey-raspi
git submodule add http://github.com/codefoster/tweetmonkey-edison
git submodule add http://github.com/codefoster/tweetmonkey.io
That way I can deploy the website to Azure using CI by simply tying up to the tweetmonkey.io repository, but I can also clone the entire project or point other people to the entire project using the http://github.com/codefoster/tweetmonkey link.
Hope that helps.