Accidentally deleted tomcat `webapps` folder - linux

I have accidentally deleted the webapps folder in tomcat. I had 2 web applications there deployed as .war files and the default tomcat folder, "Root", "manager", "host-manager", "examples" and "docs".
Since I am on cloud amazon EC2 instance (ubuntu) and I have no use of tomcat manager, can I simply create a new directory manually called webapps and copy and paste the .war files of my projects?
Will this work or is this subjected to break something at some point?

Absolutely yes, your apps will be automatically deployed again after some seconds.
Moreover, you can download those Root, manager, host-manager, examples and docs folders from the tomcat distribution, and copy them into your webapps directory. The manager and host-manager apps will restart automatically.
Since the configuration to access manager and host-manager is inside conf/tomcat-users.xml, it has not been deleted. So the apps will work like previously, without any change.

Related

What files are relevant to Azure Web App?

I'm deploying files to an Azure Web App via Octopus Deploy, and want to clean out the Azure Web App directories before deploying new versions. This way I can be sure I'm deploying each app version onto a clean slate. I don't want to entirely delete and re-create the app, because there are some app settings that need to carry over from previous deployments.
Kudu documentation lists the web app file structure here (all under D:\home), but I'm wondering if there's any possibility of other files outside of the D:\home directory that could affect app performance.
I tried running get-childItem D:\ -recursive in the kudu powershell console before and after deployment to compare results and found 268 new files (not counting those in wwwroot) after deployment, all within these directories:
D:\Windows\Temp
D:\Windows\Logs
D:\Windows\security\logs
D:\Users\\AppData\Roaming\Microsoft\SystemCertificates
D:\home\LogFiles
D:\home\Microsoft\Windows\PowerShell
D:\home\data\aspnet\CompilationSnapshots
D:\local\VirtualDirectory0\LogFiles
D:\local\VirtualDirectory0\data
D:\local\VirtualDirectory0\site\wwwroot
D:\local\VirtualDirectory0\Microsoft\Windows\PowerShell
D:\local\Config\
D:\local\Temporary ASP.NET Files\msdeploy
So which files do I need to clear or reset in order to ensure that new versions of the web app run as intended? Is it sufficient to clear out the wwwroot directory?
The only writable folders are d:\home and d:\local. But d:\local is temporary, and gets wiped clean on app restart. So effectively, you should only be concerned about d:\home when it comes to deployment.
Within that, wwwroot is typically the most important, though if you set up virtual directories and applications, you can end up with other folders as part of your app.
See also https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system which has related info.

How to package synced folder in vagrant box

What I want and achieved so far:
I want to create a custom vagrant box including a configuration and an application to reuse it in different client or serve environments.
Specifically I managed to create vagrant box, based on Ubuntu (precise/64), that has node.js installed, and package it on my dev machine with
vagrant package my-box --output filename.box
I am able to copy the filename.box to a remote server and vagrant up the box there. Node.js is installed within the vagrant box as expected.
The problem is, that I am not able to package the files in the synced folder vagrant. After starting the box on the remote server, the synced folder is empty
Therefore the application I developed on the local machine is not included in the box.
I tried to find a solution or any information about this behavior, but apart from this unanswered Post i couldn't find anything on the net.
My questions:
How can i preserve the files in the synced folder and package them in the filename.box for reuse in the server environment.
Is this even possible? Is the behavior I see a bug or is Vagrant not meant to package the files also?
I didn't do any configuration for the synced folders so far. Is it possible to package files from a different synced folder than the regular /vagrant?
If this is not possible at all, what are best practices for deployment or reusage of vagrant environments including applications?
1-3) No. This is not possible and not intended to work in the way you expect it to work.
Think of VirtualBox's shared folder as a mounted volume on a remote machine. It's not part of the file system of your virtual machine. The actual data is saved on the host machine, not the virtual one.
4) If you want to add data into your box, just copy your data over to the vm before you pack it. No need to use shared folders.
You cannot package a synced folder but what you are desiring is absolutely possible.
The easiest way to accomplish this is to put the data in some other directory in the box (thus ensuring it gets packaged with the box). And during the Vagrant box's provisioning, move or copy the data to the synced directory.
Once the box is up and running, the synced directory will have the files you want in it.

Can I migrate the installed OpenAM to another machine?

Thank you everyone in advance... ^^;
My manager asked me to migrate the installed OpenAM (already used) to another machine (newly obtained).
I tried to migrate it by file level.
(.openamcfg folder, openam folder, tomcat whole folder, ...)
But, after file migration... first access to /openam, it showed initial page(wizard) again. (no using installed configurations)
So, I should do first step. (amadmin password setting, and so on...)
Hmm... Is there any solution for pre-installed OpenAm instance migration?
If No, I can tell her there's no migration way.
Migrating the files should be enough, however you must make sure that :
The .openamcfg folder is in Tomcat's home folder
The file inside the .openamcfg folder contains a valid path to the openam folder
The .openamcfg and openam folders can be read/write by the user who runs the Tomcat service
The webapp context (the part of the URL after the server's IP address, typically /openam) stays the same
Also, when you copy the files, you must first properly stop the Tomcat service, especially if you use OpenAM's embedded datastore.

Liferay projects building in wrong deploy folder

Working with liferay and portlets from last 3 weeks.
I downloaded the bundled liferay server and placed it on my local drive.
I did the set up and was able to access localhost:8080 properly.
I also created some custom portlets and when build them in eclipse the war files were getting deployed in the path C:/liferay/deploy.
Now, I changed the server location, I wanted to have the server in D:/ drive.
When I did the transition, started the tomcat server from D:/liferay/tomcat/bin/startup.bat
and then build the project, the war files are still building in c:/ drive.
When I copy the war file manually from c:/liferay/deploy to D:/liferay/deploy it gets deployed successfully.
I want the war file to be created directly in the d:/liferay/deploy folder.
Can someone help me understand what all changes do i need to do here?
If you are using Liferay plugin sdk then there would be file named as
build.<userid>.properties
in your plugin sdk.Change the below properties as per new configuration and give a try
app.server.portal.dir
app.server.lib.portal.dir
app.server.lib.global.dir
app.server.deploy.dir
auto.deploy.dir

How to deploy a WAR file on Linux machine

I have a Linux Machine. Apache server is running and I need to deploy my project which is a .war file developed on Windows machine.
Can someone give me bit idea how to do that?
if you have FTP or SCP access to the directories where Tomcat is installed, you should be able to simply copy the generated WAR file to the tomcat/webapps directory. Tomcat will automatically deploy the war for you.
When redeploying, I find it safest to delete the original .WAR file in Tomcat, and tomcat will automatically destory the exploded directory for you. When that's done, copy up the .WAR file.
Finally, make sure you copy the .WAR file "all at once". If you have a slow upload, Tomcat will try and deploy the .WAR file even though it has not completely been uploaded yet. This will lead to a partial or unsuccessful deployment. It's best if you upload to a neutral directory (home directory, temp, whichever), and then either rename (using mv) the .WAR into tomcat, or simply copy it there using the local file systems copy command. Much faster than the upload. Safest way is to mv the file from the same filesystem.
All of this assumes you do not have any of the manager or admin ports open for Tomcat, as it provides mechanisms to remotely deploy applications directly.
But, in truth, simply removing the old app and slipping in the new app works simply and well for many applications.

Resources