AWS Elastic Beanstalk application folder on EC2 instance after deployed? - amazon-elastic-beanstalk

My context
I'm having errors in my deployment using AWS EB with my Flask application.
Now I'm inside the EC2 instance via eb ssh and need to explore the deployed source code of the application.
My problem
Where is the deployed application folder?

The source code is zipped and placed in the following directory:
/opt/elasticbeanstalk/deploy/appsource/source_bundle
There is no file extension but it is in the zip file format:
[ec2-user#ip ~]$ file /opt/elasticbeanstalk/deploy/appsource/source_bundle
/opt/elasticbeanstalk/deploy/appsource/source_bundle: Zip archive data, at least v1.0 to extract

Find for a specific/unique filename in source code folder, we will find the location of our application folder which, in AWS EB, to be
/opt/python/current
/opt/python/bundle/2/app
p.s.
Search for YOUR_FILE.py
find / -name YOUR_FILE.py -print

Related

How to place files outside app deployment directory in AWS Elastic Beanstalk?

In AWS EB, how to place my environment.properties (contains app runtime config like port, logs dir, DB info, security keys, etc.) under /var/env_config/myapp, so it can be referred by the app at runtime?
Though my further plan is to put this environment.properties in a secure non app directory of local or remote file system as it contains sensitive information.
global.env = propsReader(path.join(process.env.ENV_PATH, 'env-main.properties'));
On the EB, I have added an Environment property 'ENV_PATH = /var/env_config/myapp'
EB logs:
web: > myapp#1.0.0 start /var/app/current
web: > node src/app-main.js
web: 8266 [
web: '/opt/elasticbeanstalk/node-install/node-v12.18.1-linux-x64/bin/node',
web: '/var/app/current/src/app-main.js'
web: ]
web: /var/env_config/myapp
web: internal/fs/utils.js:230
web: throw err;
web: ^
web: Error: ENOENT: no such file or directory, open '/var/env_config/myapp/env-main.properties'
I just wanna deploy my application in the same fashion in AWS EB or Docker or VM or local machine, with just an environment property saying where the required runtime input files are.
How to access Elastic Beanstalk file system to configure my .properties file?
Not sure what do you mean by "accessing file system", but usually you would create .ebextensions folder in your project directory. The extensions are commonly used for running commands or scripts when you are deploying your app. There are special sections for that:
commands: You can use the commands key to execute commands on the EC2 instance. The commands run before the application and web server are set up and the application version file is extracted.
container_commands: You can use the container_commands key to execute commands that affect your application source code. Container commands run after the application and web server have been set up and the application version archive has been extracted, but before the application version is deployed.
Therefore, you could use the above sections to modify your .properties file during deployment of your application into EB.

az webapp deployment source config choose solution file

I am trying to deploy an app using the following:
az webapp deployment source config --branch master --manual-integration --name myapp --repo-url https://$GITUSERNAME:$GITUSERPASSWORD#dev.azure.com/<Company>/Project/_git/<repo> --resource-group my-windows-resources --repository-type git
The git repo contains 2 .sln solution files and this causes an error when attempting to deploy. Is there any way I can specify which solution file to use? I can seem to find a way in the docs but wondered if there might be a workaround.
I found a solution where you create a .deployment file in the root of the solution with these contents
[config]
project = <PATHTOPROJECT>
command = deploy.cmd
Then a deploy.cmd
nuget.exe restore "<PATHTOSOLUTION>" -MSBuildPath "%MSBUILD_15_DIR%"
The -MSBuildPath may be optional for you

How to update deployed bucket on compute engine instance?

I have deployed spring boot application on google compute engine using this link (https://cloud.google.com/community/tutorials/kotlin-springboot-compute-engine#before_you_begin) from my local computer using the cloud SDK command line. I have created the google storage bucket and then followed the steps in the link to deploy the spring boot project. Deployment works fine. But now I have to deploy changes to my deployed project. How can that be achieved using command line without restarting the VM instance?
I have updated the google storage bucket which I provided in the --metadata BUCKET= while creating the instance.
Copied my new jar from the local location after building the project to the google cloud bucket. But after refreshing the URL in the browser can't see the new changes.
As far as I can understand in your description, you need to download the new version from the bucket to your VM, in the same directory where you created the instance-startup.sh as in [1], you can execute the command "gsutil cp gs://${BUCKET}/demo.jar ." this if you replaced the .jar file in the bucket, if the name changed you can change it in the previous command in order to make it match with the new version that you uploaded.
Then you can then stop the java process with the previous jar file, you may use "ps -aux | grep ${jarfilename}" and then "kill $PID", after this you can execute the new version with the command "java -jar $jarfile.jar" making it match with the new version of your jar file.
[1] https://cloud.google.com/community/tutorials/kotlin-springboot-compute-engine#create_a_startup_script

Unable to upload widget to Wirecloud instances in private server

We have downloaded and installed a running instance of Wirecloud in our company server following the steps at:
https://conwet.fi.upm.es/wirecloud/install
We created the instance using the --quick-start command to try the instance, and ran wirecloud using the Django internal web server with the following command:
$ python manage.py runserver 0.0.0.0:8080 --insecure
We are able to enter the instance, and move around the enviroment, but we have encountered a problem when we try to upload a widget to our local workspace. After I search for the widget in my computer (previously downloaded from the Fi-lab marketplace), we get the next message:
Error adding packaged resource: Internal Server Error.
We also tried to download the zip file of the widget from github, unzip it and recompress it as a wgt file (compress as a zip but changing the extension to .wgt) and we get the same answer from our wirecloud instance; but if we try to upload the same package to the instance in fi-lab, it uploads successfully.
We don't know if it's because of the quick-start installation we made or if we have to modify something from our widget files in order to be able to upload it to our local instance.
Solved
The problem was in the config.xml file: the name of the attributes and the structure of the widgets unable to upload were different from the template of the config.xml file posted at the users guide.
After changing it to follow the structure of the template it works fine.
My widget example was the NGSI Updater. The thing is that it uploads perfectly in the instance at FiLab, even though the config.xml file had a different structure from the one of the template; but it encounters an error when uploading it to the Wirecloud local instance at my server.

Unable to Deploy War file on OpenShipt using git

Please help me how to deploy war on openshift app.I have put our war file in webapps folder and push code but my war is not deployed.
after this default page will be open on app url.Please help me.
If you would like to deploy pre compiled java applications to your OpenShift gear, but you don't want to waste space by storing them in your git repository, then these directions are for you!
Create an application on OpenShift and select either the Tomcat 6 (JBoss EWS 1.0) or Tomcat 7 (JBoss EWS 2.0) cartridges.
Use the git clone command to download the source code for your application to your computer.
Remove the src directory and the pom.xml file from your application that you cloned to your computer.
DO NOT place your WAR files into the webapps directory.
Next, you need to do a git commit -am "some message here" to make sure that your changes are committed. Lastly, you need to do a git push to deploy your changes to your OpenShift gear.
Now comes the fun part, you need to use SCP or SFTP (with public key authentication of course) to upload your files to the correct location on your gear.
You need to place your WAR files into this folder: app-root/dependencies/jbossews/webapps on your gear.
If you run rhc tail $appname, shortly after the transfer is done you will see entries appear in the logs showing that your WAR file has been deployed and at what context.
The WAR files that you add into the webapps directory will be deployed at a context that matches the name of the WAR file.
For Example:
If you add a file called mywebsite.war, it will be available at app-domain.rhcloud.com/mywebsite. If there is an application that you would like to be available at app-domain.rhcloud.com/ (also known as the root context) then you should name that file ROOT.war.
If you need to replace them, just upload a new copy, or if you want to remove them, just ssh into your server and delete the file you uploaded and it will be un-deployed.