git aws.push uploaded new php application to Elastic Beanstalk - php

I have a similar question to Pushing to an existing AWS Elastic Beanstalk application from the command line and Git pushes entire project even if few files are changed. AWS but did not see the answer I am looking for.
There have been comments about the confusing changes to Amazon's documentation because different versions of the documentation state they are the latest when some functions have actually been replaced and I think a new question is warranted now.
I used the Deploying a Symfony2 Application to AWS Elastic Beanstalk guide to setup my dev app and it works great. After I make several changes and want to update the aws app, I use git aws.push which creates a new version of my app and restarts the server.
I do not have my configuration files finalized (this is just a dev app) and need to manually run several commands on the remote server before my app can be viewed. For very minor temporary changes, I connected to the remote server via ssh and edited the php files directly which works fine. This way the server does not need to be restarted because everyimt I use git aws.push the server restarts. I would like to have a method to update those files using git without restarting the entire server/app.
Main question - Is there anyway I can push only the files that were changed in the recent commit and not have the server restart?
Side question for new aws commands - Should I use the eb commands Getting Started with EB CLI 3.x and use eb deploy instead of the git command?

No, currently there is no scenario where Elastic Beanstalk pulls changes without reinitiating and restarting server.
You can try to write your own workaround for that purpose, but you
will need to mention files that need to be updated manually and be
sure that files will be delivered to each EB instance. If you are
pushing from windows don't forget to convert line ending dos2unix.
eb deploy is a canonical command for aws.push
If you experience "full upload" issue instead of sending "only changes", please read my fresh answer here:
Elastic Beanstalk "git aws.push" only commited difference?

Related

How to push new local dependencies to shared hosting with Laravel?

My website is running smoothly with Laravel in a sub-domain, but now I have added a new dependency https://github.com/PHPOffice/PHPExcel to my local project using composer require phpoffice/phpspreadsheet.
The code is already working fine in my local environment, but now I need to push my new changes to the website.
Pushing the controllers, routes, views, etc it's easy, but how do I push the dependency?
I have full access to the cPanel
I can create SSH keys
The project is running in a sub-domain
I'm using Visual Studio Code
I have generated a private and public key for SSH
I have initially deployed my Laravel project to the server using FTP Filezilla
For what I have read so far, I should be using SSH with PuTTY, but if I could use an extension in Visual Studio Code, would be great.
Composer stores all the imported libraries in the /vendor folder. When you push your local copy of the website up, it will push up the vendor folder and you'll be set.
If you're working on a remote server and you need to still download the dependencies, run
php composer.phar update
That will download the dependencies for the project. You'll need to run it from the command line (ssh) and be in the website directory.
Some companies don't allow ssh access to the server. In that case, you can run php composer.phar update on your local machine, assuming you have a php runtime install (WAMP, XXAMP, ect). Then when you push or copy your code to your server, the libraries will be included.
Well I can create SSH keys but don't have access to login with them. With that said I follow the tutorial here https://laraveldaily.com/laravel-and-shared-hosting-working-with-ftp-and-phpmyadmin/ that teaches how to use FTP to upload/update the application.

Updating Laravel application from git on multiple servers

I am working on development of a web app (for learning) in Laravel and I`m using Bitbucket for source control. It will be deployed on couple servers (20 or so, perhaps more over time), and I would like to be able to update all of them as the app changes over time.
The problem is that I will not have SSH access to most of those servers so I wont be able to use a simple "git pull" (a server we test on does not even have git installed so shell_exec is not an option also).
My plan was to make a script that will download latest zip from Bitbucket server, unpack it overwriting the old code, and then running a Laravel script to run migrate (for eventual database changes).
Is there maybe a more sensible way of doing this?
What are you looking for is CI/CD, i.e. Continues Integration/ Continues Delivery. There are so many ways to automatically deploy or pull a code over server. You can use following methods
Automating Deployment to EC2 Instance With Git
Using Bitbucket for Automated Deployments
CI\CD workflow with BitBucket Cloud, Bamboo, AWS CodeDeploy
Bitbucket - Manage Web Hooks
Apart from this you can find so many articles on this, but if you wants to automate the process at laravel level then use Laravel Envoy

Issues Deploying Site with Git & PHP (Cpanel/WHM Server)

We are trying to automatically deploy our web application using Git, GitHub, and PHP on a Cpanel/WHM server.
I've tried, using the information in the article below, to set up a deploy script on our server that GitHub posts to when we push to the repo.
https://gist.github.com/1809044
Unfortunately, it seems that the fact that apache is running scripts as "nobody" is preventing the script from running. We created SSH keys as the account's user, and the git pull command is not running.
Is there any way to successfully pull a git repo from GitHub on a deploy hook and have it update without installing something complex like Jenkins?
Do you have control over how apache runs? I'm dealing with some e-mail/spam issues. I've also been reading that if you run suPHP, your apache will run as the user of that account. Sounds like that might be what you need.

Best way to manage PHP web app source code

I am currently developing a medium sized web application using PHP and need to use some kind of version control. I also need to have the master copy of the code running in the apache document root so I can test the app while it is in development. Does anyone have any sugestions?
Thanks,
RayQuang
You can't go wrong with Git; everything you need to know is here: http://progit.org/book/
Yeah you should definitely use version control (Git or Subversion).
Here a short explanation how I'm using it in my web projects (I am using SVN):
I have a SVN project which I have checkouted on my local machine and on the webserver
Always when you change something you can commit your current running version
Log into the server (Could also be multiple servers) and do a svn update, so the newest code gets automatically deployed on the machine. The only thing you have to do is restart of the webserver
Note:
Take care what you commit. You've maybe another database configuration file on your local machine than on your server. You can put this into the svn ignore file list (guess git has something similar)
It is also easy possible that multiple persons work on the same project..
Don't commit logfiles
Links:
Git: http://git-scm.com/
Subversion: http://subversion.tigris.org/
I'd recommend Mercurial for its ease of use and that it keeps the working copy uncluttered, all versioning information is kept in just one .hg folder. I'd do it like this:
Set up a Mercurial repository at the server (hg init)
Do a hg clone of that repository to where you want your working copy
Work away!
When you want to test on the server, do a hg commit and hg push to move the changed files to the server
Run hg update on the server, or add
[hooks]
changegroup = hg update >&2
to the .hg/hgrc file (create it if it doesn't exist) on the server to have it automatically update.
For more info, you can also check out: http://hginit.com/

What tools can I use to deploy PHP code to an EC2 instance

We can bundle all files into an Amazon Machine Instance and upload it. But I'd like to see if there is a more efficient way to regularly upload source code on to test our app and constantly have the latest version up and running. Thanks!
A while ago I discovered an easy way to deploy PHP using Git's push. The one caveat is that the process assumes you're already using Git as your VCS, and that you've installed it on both your development machine and the server:
Deploy a project using Git push
I am not sure I understand your question correctly, but an Amazon Machine Instance is just like any other machine running Linux (or Windows). You can use the same tools you would use if the machine was in your network. Of course you need to do this remotely. From a windows machine you can connect to an instance using tools like Putty or WinScp - you probably know about these, if you are able to create a new image. Use these tools to configure your instance as you would have configured a machine in your local network.
it depends on what you call 'deployment'. I've seen people calling ftp-ing files over to the server 'deployment' :)
in short you want your deployment be:
automated
atomic
reversible
manage db schema
longer description is here:
http://blog.astrails.com/2008/12/17/deployment-process-requirements
Note that you can have most of it using deployment tools from the ruby land:
capistrano
vlad

Categories