I have a forum application uploaded to AWS elasticbeanstalk by zip package. but now I need to change some code, but now I don't know how should I get access to the code?
Is it possible for me to fetch this code back to local , make change and redeploy with "git push"? just like how Heroku deploy works?
I try to google it but with no luck.
There are really two parts to your questions.
To get to the code, you have to go to S3. You should see a elastic beanstalk bucket with your zip file in it.
Here is a pretty good guide to get you started with elastic beanstalk command line (including git aws.push).
Related
I want to start deploying my laravel app to production. To avoid changing AWS config in the near future, I decided to try to add continuous integration. To do this I'm using elastic beanstalk and pushing the code there using another AWS tool. All this is working perfectly. I put a test message in /public/index.php to output "hello world" and it works as expected when going to the URL. When I remove this text and run my laravel app as normal, I get a 500 internal server error. I'm not sure all what elastic beanstalk does on deployment for laravel apps. Because of this I'm not sure if this error is occurring from a bad DB connection or laravel app not fully setup yet.
I created an RDS DB instance outside of elastic beanstalk. I am able to access this from sequel pro and I added the database I will use to store all my data. I added all the necessary db connection values (host, port, database, username, password) to /config/database.php and the elastic beanstalk server configuration environment variables.
I've searched online for days for info but haven't found anything specific to this. Also part of my issue is a lack of understanding of how laravel is setup during a deployment in beanstalk. Is there something with /.ebextensions that will help me accomplish these goals?
When I deploy my code I need to make sure all vendor files are installed through composer and then I also need to make sure all database migrations/changes happen. I want to automate as many steps as possible so I can just push up code changes and server will change code and keep working.
I also want to make sure there isn't anything I'm missing for setting up my db connection. Are there any other files in laravel I need to setup or something in elastic beanstalk I need to have configured? I'm keeping my db open to all connections and then I can tighten restrictions later
EDIT: My database may not be configured correctly yet, but that appers to not be source of the issue. I think my issue is knowing what scripts and how to run them during deployment. I want to make sure composer and php artisan migrate is ran to keep everything up to date. How can I do this with elastic beanstalk?
This is a little off topic but with my experience I do not recommend using beanstalk to achieve a good workflow pushing and deploying. I recommend
you to use Forgelaravel.com to deploy your GitHub repository. In forge Laravel you will be able to create a server from AWS and it will automatically create database connections and stuffs, then with just one click you can deploy to the server and keep a good workflow.
Given that we're speaking of a Laravel application, this 500 Server Error
often occurs when one is creating new infrastructure. Why? It's likely to forget to add the environment variables to the EB environment.
Simply go to that EB environment configuration, then under software modify to include at least the following environment properties
APP_DEBUG (can be, for example, false)
APP_KEY (this is the key generated with php artisan key:generate)
APP_NAME (tiagoPeres)
Then the issue will be gone.
I am trying to create my first php app using GCS.
I have placed all my php app files in the bucket (including my .yaml file) created by the app engine, but I am struggling to access the files to deploy the app using the cloud shell in app engine?
If I has them stored in git I would have used the clone commands but would assume that this would have placed the files in the same bucket that I have manually uploaded the files to through the bucket browser?!
I either cant find the correct file path as the buckets do not appear to be part of my /home/username directory or I am missing a key link like an API to the cloud storage service (GSUtil?).
Can anyone point me in the right direction?
JH
You shouldn't be manually placing any files into the (app's staging) GCS bucket yourself to deploy an app to app engine.
Instead, place the files (including your app.yaml) in a working directory on your machine (or cloud shell), then use the gcloud app deploy command to deploy them. You can see an example of how to deploy a PHP app here. The gcloud app deploy command is going to look for the source files on the local filesystem.
Note that using git isn't a requirement (though using some form of source control is always a good development practice), it is just the way the files are copied onto the local machine in this example.
(Likewise -- GCS buckets won't show up in the cloud shell filesystem -- GCS is a blob storage service not a normal filesystem, so you would need to use a tool like gsutil or the GCS API to access it).
I'm an AWS newbie and I can't seem to find a good example. There are plenty of static website examples for S3, but my site needs to run a fairly simple PHP script which then means I need to be on EC2.
I used Elastic Beanstalk to create an EC2 instance and it added a simple PHP example, so when I go to the public DNS address in a browser, I see the example PHP script run. So far, so good.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
So, how do I upload an html website to run on this instance and still get a PHP script to run?
Sorry if I have some of the terminology or methodology wrong.
Thank you.
But, where are those files and how to I access/modify them? They don't seem to be in the S3 bucket that Elastic Beanstalk created.
They probably are but in a ZIP package. You don't modify anything on the fly. You're supposed to modify your source code on a local machine, "bundle" it in a ZIP file and then either
Upload with AWS Console.
Upload it to S3, create an application version with AWS CLI and then deploy (also with AWS CLI).
Docs are here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_eb.html
It is possible to change your application by connecting to an EC2 instance, but your changes will be lost during redeployment, scaling etc.
If I try to Connect to my EC2 instance, it says there's a problem with port 22 and a key pair is needed. Not sure what to do here.
When you created your Elastic Beanstalk environment you were asked for 'EC2 key pair'. You should use that exact SSH key to connect to your instance. This step is optional, so it is possible that you skipped it and created an environment without a key. In this case there is no way to connect to your EC2 instance (almost). You'll have to upload an SSH key (EC2 dashboard -> NETWORK & SECURITY -> Key Pairs) and create a new environment.
Recently I have been involved in a project where I have set up a LAMP stack in AWS and also helping out the team for building other infrastructure. As per company policy, we need to create a new instance in every 60 days taking the latest ami and kill the previous one. For this reason, I requested the development team to move the php code to git repo. This would help me automate the build so that I can directly pull the code from git. But, they are saying they don't want to move the code in git for some licensing reason as the code they are using have been purchased from phpgrid (vendor). This is little strange to me...anyways, if the code is NOT in git, how can we automate the code deployment in webserver? Any thoughts on the best practices? Don't want to ftp the code from someone's machine :(
AWS Code Deploy service is purpose-built for code deployments like this.
AWS CodeDeploy is part of a family of AWS deployment services that
includes AWS Elastic Beanstalk, AWS CodePipeline, AWS CloudFormation,
and AWS OpsWorks. AWS CodeDeploy coordinates application deployments
to Amazon EC2 instances, on-premises instances, or both. (On-premises
instances are physical devices that are not Amazon EC2 instances.)
An application can contain deployable content like code, web, and
configuration files, executables, packages, scripts, and so on. AWS
CodeDeploy deploys applications from Amazon S3 buckets and GitHub
repositories.
You can use any repository really. You just need a process to move the code from its repo to an designated S3 bucket. The code can be anywhere: SVN, on-premise, etc. Just zip it up, move to S3 and register the revision and deploy as needed. A GIT repository is not required, but it is directly supported by CodeDeploy.
We integrate the process with Jenkins our Continuous Integration server so all builds are sent to S3 as a CodeDeploy-ready revision.
There is no cost for using this feature when deploying to AWS instances - its free!
I'm trying to run an app on Amazon Elastic Beanstalk, this app is programmed in Symfony2 and is able to run in any normal server, however I want to use it in Amazon Elastic Beanstalk.
Until now I have uploaded the code using git(thanks to the tutorial: http://vincent.composieux.fr/article/deploy-a-symfony-project-on-amazon-elastic-beanstalk),
Then I also connected to the server using SSH.
But now I want to configurate the symfony2 app parameters inside parameters.yml, but I cannot find the root location of the app in the server, does anybody know where Amazon stores source code of such an web-app?
Under /var/www/html I couldn't find anything :S
Found the location myself /var/app/ondeck
thanks to http://vincent.composieux.fr/article/deploy-a-symfony-project-on-amazon-elastic-beanstalk