Deploy a customed Alfresco - java

I've customed my alfresco (classification plan, metadata, ...) and I wanted to know how to deploy this existing alfresco into a new one existing on other computer.
I think that I have to deploy my alfresco.war on the other computer in place on the existing alfresco.war and it's all ?
Thanks if you can help me !
Edit : I've tried to remplace the alfresco.war and share.war but it doesn't work.
If I produce a database dump that I restore on the new alfresco and I remplace the alf_data, do you think It can work ?

Yep, you've just about got it already. You need to:
Stop your tomcat instance.
Go to the tomcat/webapps directory in the Alfresco installation.
Delete the alfresco.war file. (taking a backup is always recommended)
Delete the alfresco directory.
Depending on the changes made delete the contents of the tomcat/temp and tomcat/work directories.
Start your tomcat instance.
Good practice is to package up your changes in to an amp and to deploy it using the Alfresco Module Management Tool so you may want to look at doing that in future.

Related

How to download application from Google Cloud Platform Java Flexible Environment

I am trying to download Application from GCP using this link: Downloading Your Application. But it looks like this works only for the Standard environment cos code executes without errors but nothing is actually downloaded after. Output is:
AM Host: appengine.google.com
AM Fetching file list...
AM Fetching files...
What will be the solution to achieve the same result in Flexible environment?
When you deploy an App Engine Flexible application, the source code is uploaded to Cloud Storage on your project in a bucket named staging..appspot.com. You can navigate in this bucket and download the source code for a specific version as a .tar file.
Alternatively, you can find the exact Cloud Storage URL for your source code by going to Dev Console > Container Registry > Build History and select the build for your version. You'll find the link to your source code under Build Information.
One thing to note however is that the staging... bucket is created by default with a Lifecycle rule that deletes files older than 15 days automatically. You can delete this rule if you want so that all versions' source code is kept indefinitely.

Wildfly Deployment going to temp folder

I am facing a little strange issue while deploying web service to WAR file.
If I deploy the application via Netbeans IDE it is going under \standalone\deployments directory.
However, if I deploy the war file from Admin Console it is always getting deployed at \standalone\tmp directory.
Please guide on this issue. The deployment should go under \standalone\deployments directory only.
The deployment should go under \standalone\deployments directory only
You are quite not right.
It is not an issue. It is what it is.
standalone/deployment folder stand there only for "hot-deployment" functionality available only with standalone mode.
So, Netbeans uses it. You can do the same just by saving EAR or WAR into standalone/deployment and server will pick it. (default scan interval is 5 sec.)
but Admin console or CLI is only (and standard) way to deploy application on domain. In domain mode deployment folder is not in use and there is no deployment scanner.
Then when you use console it goes common way - deploys as on domain regardless is it domain or standalone server.
Updated / follow-up:
In general it is better to keep .properties file(s) out of deployment, in separate location. It is main idea behind them - to be able to change properties without application rebuilding and redeploying. Usually properties are different in different environments (DEV/UAT/PROD)
So there are 2 most popular solutions:
store properties in different location add that location to class path and access them through ClassLoader.getResourceAsStream() mechanism
store properties in different location, pass that location through system (or -D) variable and access them as file. for JBoss you can place your .properties under configuration directory. there is already JBoss variable. Kind of jboss.config.dir (or such, you can find it in Admin console, I do not have JBoss right now).
But of course sometime it still needed to access resources inside WAR/EAR - in that situation it is pretty much the same as first solution above.
Just be sure your .properties file(s) are accessible through to ClassLoader (in class path) and use them from ClassLoader.getResourceAsStream (or if you use Spring point it as "classpath:" not as "file:".

Editing Folder content in tomcat manually?

I have a WAR file called ROOT.war where I uploaded into Tomcat few days back. There I have few "public" HTML pages like index.html, about.html etc. These pages has no connection with the programatic part of the application, instead containing a link for login.jsp.
Now, I need to change the content of the index.html and about.html. What I was used to do is rebuild the entire WAR file and re-uplaod it, but now can't do it for small and iterative changes like this because the application is in use.
So, can I simply access the webapps -> ROOT folder in Tomcat and replace the index.html? Will it affect the process of the application?
It works but avoid such practices which lead to discrepancies.
Follow standard deployment process - rebuild the entire WAR file and re-upload it during deployment window.
You can, and It will work. You can even change the JSP code. The only issue you may have is that when you redeploy a new version of the war, changes made in the server will ve overriden by the new version, so you better change it in the original tool also.

Wildfly hot deploy of Static content (Javascripts, HTML, CSS) without restarting the server in Spring STS

I'm using Wildfly 9.0.0.Alpha1 with Spring STS 3.6.3 and JBoss Tools, i don't find the way for update my changes to static content inside my server without the need of use incremental deploy (I enabled exploded deployment in the wildfly server), so when i do a little change to my resources, I have to refresh the project in eclipse STS so then it makes an incremental deployment, this takes about 15 - 30 seconds which is annoying and a waste of time
There is a way for update a static content in a exploded war without incremental deploy?
You can edit your subsystem entry for undertow, adding a location and file for a path within standalone/tmp. And then you can add symbolic links to that path at runtime every time you want to share additional static content. You can use Files.createSymbolicLink(...) in Java. Just be careful that the attributes of your symbolic links let them be deleted without deleting the targets. Also, make a start script that recreates your subdirectory in tmp as needed before wildly starts. If you have an undertow location that points to a folder that doesn't exist, the location (context, like /static) will not be created. Once created, undertow will serve up any subfolder or file you add to it once location is created at startup. Make sure you add directory-browsing="false" attribute to the file element for the folder if you don't want people to be able to list contents of folder.

Access AWS credentials file in WAR

I am making a Java application that uses, Spring, Maven and the AWS-SDK-Java. In order to the AWS SDK to work I have to place the AWSCredentials.properties file inside the "MyProject/src/main/resources" folder.
So far so so good. Then I have to create a .war file. To do that I use mvn install command and voilá.
Now inside the .war created, the file I want to access is in the "/WEB-INF/classes/" folder and I need to read it.
How can I access this file inside the war so I can read its content? I have experimented with ServeltContext but so far nothing I try works!
It is generally not a good practice to keep credential in code package (war). Instead I would suggest you use IAM Roles.
This will make it easy for you to move your code from one AWS account to another (say dev environment to production). Since the code will be submitted to a version control system which will be accessed by many, it is also good from a security point of view to use IAM roles.
I found a way to do it. I can access the file by using:
InputStream inputStream =
getClass().getClassLoader().getResourceAsStream("/resources/email/file.txt");
As explained in this discusison:
Reading a text file in war archive

Categories