Deployment of php7 on appengine - php

I'm an absolute beginner on the Google app engine.
I have gone through the documentations for deploying a basic php app. The guidelines for deploying php7 apps aren't very clear to me.
Let's say I have a CMS written in php MySQLi. Assuming the project has privileges (in separate folders) for admin, users and guests, and I want to deploy it on Google app engine;
What are the configuration(s) that are most recommended for this option.
Asides the Google SDK, is there any GUI application that could help make the process easier?
Does the SDK also have version control on them? How do it update codes without re-deploying the whole project all over again?

For #1 you probably should go through Choosing an App Engine environment first. I can't help with more details as I'm not a PHP developer (which is also why I can't answer #2).
For #3 GAE itself only tracks versions at the entire service level, each deployment consisting of the entire set of the service's deployable artifacts.
However it may be able to skip unnecessarily uploading unchanged artifacts. I know it does it at least for python standard environment services if re-deploying from the same workspace, in rsync style. You can confirm this by increasing the deployment verbosity via the --verbosity option. I'm unsure if the fact that I was using git for the project mattered.
For the flexible environment services things are a bit more complex, since the deployment artifacts are docker images, see How can I speed up Rails Docker deployments on Google Cloud Platform?
If you'll have a multi-service app each service can be deployed individually, but a service deployment in itself is a complete one, not an incremental one, creating a new version of the service.
The app-level configs (applicable to all services) are individually re-deployable, without re-deploying any of the services:
To deploy the other configuration files of your service, you must
target and deploy each file separately. For example:
gcloud app deploy cron.yaml
gcloud app deploy dispatch.yaml
gcloud app deploy index.yaml

There is another way. The google console allows for mirroring of repositories withing the cloud service.
Locate "Source Repository", connect with you GitHub account and mirror a repository.
Its faster and easier if you ask me.

Related

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

How to deploy a php application from local machine to google app engine

I am new to google cloud plateform. I have a php application on my local host and want to set up this on App engine. I followed some documentation and used gcloud deploy command for example given in documents. It was working properly. But in examples it first clone a git repository and deploy a code from that on app engine. I know how to launch app engine instance. But I am not getting how I will upload code from my local host to app engine. I know app.yaml and config files are needed but my question is - how I will upload and deploy code to app engine even if I created app.yaml and config files.
I heard about google app engine launcer but didn't find any valid source for installing on ubuntu. Is there any client software that can be used to deploy my code on app engine or is it compulsory to first set up my code on git then use it as given in example in document.
Follow the quickstart in the documentation. It covers everything that you need:
Downloading the Cloud SDK (The launcher is ancient and deprecated, don't use it.)
Creating a Cloud Platform project in case you haven't yet.
Running locally, which you've already figured out.
Deploying your project to App Engine using the gcloud app deploy <path_to_app.yaml> command.
You don't need or want the launcher. You don't need to do anything with git.
After installing google cloud SDK and following all instruction on here i sucessfully set up local development server and php application.

How do I deploy php code in GAE once I've connected it to Bitbucket?

So I connected my Bitbucket to Google App Engine project. I assumed a simple deploy mechanism would be present but I'm unable to find it. I remember in the past there was some kind of pipeline feature that allowed skipping of testing for php and deployment but I no longer see it. Is there a simple way to deploy (skipping unit tests) that doesn't require Jenkins to GAE?

Where to deploy symfony2 application

I have developed a symfony application and it's done.
It's been a couple of days and I can't figure out how to deploy this into a real apache server, when I copy it to the public_html it doesn't work assets don't load properly.
Can some one give me a step by step description of how to deploy it so that when I navgiate to example.com url I see my symfony application.
Thank you
If you try to deploy your application on a server, you have to configure apache. The best way its to make a virtual host.
Here the documentation:
http://httpd.apache.org/docs/current/en/vhosts/examples.html
http://symfony.com/doc/current/cookbook/configuration/web_server_configuration.html
I would suggest using Capifony which provides a specialized set of tools on top of Capistrano, tailored specifically to symfony and Symfony2 projects. (according to the documentation)
The advantages of using capifony are,
deploying is as simple as running cap deploy from your project root directory.
It stores multiple releases.
It allows you to use SCM(s) to pull your application code down to the server.
You can configure it to run any batch command during the deployment.
It performs a transactional-like deployment process (if any step fails, the deployment is
rolled back and the current directory points to your last release)
You'll also need to troll through this part of the documentation to figure out how to get your application running under Apache.

Deploying a PHP webapp to multiple EC2 instances behind a Elastic Load Balancer

my question is basically two questions, but since they are closely related I thought that it makes sense to ask them en-bloque.
Case:
I am running a webapplication, which is distributed over multiple AWS EC2 instances behind a AWS Elastic Load Balancer
Intended goals:
a) When deploying new app code (php) it should be automatically distributed to all EC2 instances.
b) When new EC2 instances are added, they should automatically "bootstrap" with the latest appcode
My thoughts so far:
ad a)
phing (http://phing.info) is probably the answer for this part. i would probably add multiple targets for each EC2 instance and when running a deploy it would deploy to all machines. probably unfortunately not in parallel. but that might be even beneficial when scripting it in a way where the EC2 instance is "paused" in the load balancer, upgraded, "unpaused" again and on to the next instance.
ad b)
not sure how i would achieve that. in a conventional "hardware based setup" i probably had a "app code" volume on a network storage device and when adding a new server i'd simply attach that volume. when deploying new appcode i had just one deploy operation to this volume. so i need some "central storage" from where the newly bootstrapped machine/instance downloads it's appcode. i thought about git, but after all git is not a deploy tool and probably shouldn't be forced to be used as one.
I'd be happy to see your setups for such tasks and hear your hints and ideas for such a situation.
Thanks,
Joshua
This could be made using phing. However, I'm not sure why you want new instances to automatically retrieve the appcode? Do you get extra instance very often? And in order for a) to deploy code to several instances, it would still need to know them?
This setup requires a master deploy server and uses a push strategy. The master server needs phing, any required phing packages, and optionally ssh keys for the EC2 instances.
Suggestion for a)
(This is just a general outline of the phing tasks required)
Retrieve instance list (either config file or suuplied parameters)
Export appcode from repository to master server(e.g. SubVersion)
Tar appcode
scp tarball to all EC2 instances (to a deploy folder)
With rsh unpack tarball on EC2 instances
With rsh update symbolic link on EC2 instances so webserver folder points at new deploy folder
Clear any caches on webserver
The above could be called after you have made a new release.
Suggestion for b)
This could be achieved by running the phing script every couple of hours, have it login to the EC2 instances and check for the appcode. If it doesn't find it, it will deploy the newest final release.
This of course, requires the EC2 instances to be setup correctly in regard to webservers, config files, etc. (However, this could also be achieved by remote shell via phing).
I've previously used similar setups, but haven't tried it with services like EC2.
a) Take a look a Capistrano and since you're not using Ruby (and RoR) use the railsless-deploy plugin. Capistrano can deploy to multiple servers.
b) Haven't gotten any experience with this, but I wouldn't be surprised if there isn't a plugin/gem for Capistrano that can pretty much do this for you.
I believe phing is a good tool for this. Capistrano might also help.
I deploy my application in a very similar environment. So far, I've been using simple bash scirpts, but I'll probably be moving towards a phing based solution, mostly because of the difficulty involved in developing shell scripts (you have to know a new syntax that's not very flexible, not to mention cross-platform) and the availability of parallel processing, which is present in phing.
Phing is a great tool for managing your deployment tasks, that pretty much covers most of (a).
We use OpsCode Chef for the infrastructure management. It has a deploy_revision target that supports both SVN and Git repos for application code deployment as well, and knife (the main Chef command-line tool) has an EC2 plug-in that allows you, with one command, to spin up a new EC2 instance with whatever roles and environments you have defined in Chef, and deploy your application code.
For managing this with multiple EC2 instances behind an ELB, we have used the Python boto library to write very simple scripts that connect to the ELB, get a list of all instances attached to that ELB and one-by-one removes an instance from the ELB, runs the Chef update on that instance (which deploys the new application code and any machine configuration changes), re-attaches the instance to the ELB and moves on to the next instance.

Categories