Cakephp logs in AWS Elastic Beanstalk - amazon-web-services

What is the best way to handle logging with cakePHP in an Elastic Beanstalk environment?
Normally cakePHP writes the logs to the tmp folder of the application. However I see no way to access that folder in an Elastic Beanstalk app.
Am I missing something or is there a specific way to get the logs of your app.
EDIT: The cakePHP Version I'm using is 2.10.9

You did not mention the version of CakePHP that you are using so I will assume 3.x
On the official cookbook you can see how to create a log adapter and you can then use that to push the logs to the Elastic Beanstalk environment.
If you exted the BaseLog class as the example suggests you have very little code to write.
Next you need to properly configure your new logger in app.php
For CakePHP 2.x you need look at this documentation on how to create a new log stream.

Related

Unable to send bundle from aws app deployed using aws copilot via github actions

I have deployed my application using copilot deploy which works. It creates a load balancer and when I go to the designated url I can view my react app. However, I'm trying to create a CI workflow using github actions.
My github actions appear to work, they appear to deploy the app. But when I go to the new designated url, I get Uncaught SyntaxError: Unexpected token '<'
If I go to that same url and hit a specific route on it, that actually does work. So I can do url/test and it return "hello world" but it won't return the bundle for the application or it's returning a broken version of it for some reason.
I can't figure out why using copilot deploy normally works, but this doesn't
For context, my app is set up like this. In the root folder there is a Server folder that has the node server file with the routes. In the root folder is also a src folder with the react code. There is a public file. There is the docker file containing instructions. And then there is the build file. So far I've been generating the build ahead of time and then deploying everything. The node server then sends the build.
So presumably, something about the way the docker container is being built via github actions is significantly different than the way it is building using copilot deploy. But, my understanding is that in both cases it is following the same docker file. So I can't figure out what is different about the directory structure it is creating, or maybe its having trouble creating the bundle at all. If anyone has any insight it would be appreciated.
Thanks!

Failed to register a ServiceWorker. The script resource is behind a redirect, which is disallowed

I wanna make a flutter web app and deploy it to AWS.
After researching it looks like using AWS Amplify is the easiest way so I try it, however after I successfully deploy it, it only shows a white screen with this showing on the log after I inspect:
However the web app show up just fine on my GitHub page and Codemagic, you can see it on rezyfr.github.io and fl-blog.codemagic.app. And here is my amplify yaml file:
Is anyone ever experience this and found the solution? Or anyone have a better way to deploy flutter web on AWS?

Reading environment variable from beanstalk for reactjs web app

I have a problem which seemed to be trivial at the beginning but now I am getting that it is very confusing.
So I am using reactjs for the front end of my application. I deploy my reactjs web app in a beanstalk in aws. In the beanstalk I define an environment variable called test and now I wanna read that and use it in my react application. But the problem is my react application is basically a client script in users browser so I cannot do something like this:
const config = {};
config.db = {
test: process.env.DB_DATABASE || 'my_db',
};
which is suggested in that link.
https://alexdisler.com/2016/03/26/nodejs-environment-variables-elastic-beanstalk-aws/
So I am doubting this is doable at all or it is something that is not possible.? any idea would be appreciated
Your react code will run in the browser, and will not be able to access the environment variables that have been set on the server.
The link you provided describes the process to set environment variables in a node.js environment that is hosted on an elastic beanstalk instance.
I suggest creating a config file in your react application that stores necessary parameters and initial settings you need to run your app.

AWS - Elastic Beanstalk/Glassfish index.html file

I am using Amazon's AWS Elastic Beanstalk to deploy my web application. I am having a problem where the deployed application will display a "Your server is now running" page, rather than my own index.html/jsp page. What I am really confused about is that this appears to happen at random - sometimes my deployment will work fine, but others I will get this page.
Is there a specific configuration or directory structure I need to use in order to make my index.html the default? I had previously had my project configured for Tomcat, and am using a regular .war file directory structure.
Any help is appreciated

Deploy Rails spree to Beanstalk

I have deployed rails spree app to AWS Beanstalk successfully. Then I added some new products together with their images. The app by default saves the images in my_app/public/spree/products folder. Every thing went fine until I deployed new code. The new code is deployed successfully but the "products" folder is gone. I now have to re-upload all of my images manually. Anyone has any idea what is going here?
Please let me know if you need any further info.
Thanks!!
Application will contain a public folder and under of this, we have spree products/taxons images folder...Those files are static by nature, so it’s a good idea to serve them using S3 because for every deployment our code replace.
Elastic beanstalk servers are somehow out of your control, meaning AWS controls when they are restarted and even terminated and rebuilt. Therefore, you shouldn't store anything on local disks (which is what Spree does by default).
The solution to your problem is simply to store them on S3 as described here.