MIFOSX-1756 Make it easy for Static Web Content such as the community-app to be served by the new standalone end-user server (not development)
This commit is contained in:
@@ -65,12 +65,17 @@ if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task dist(type:Zip){
|
task dist(type:Zip){
|
||||||
baseName= 'mifosplatform'
|
baseName = 'mifosplatform'
|
||||||
version = qualifyVersionIfNecessary(releaseVersion)
|
version = qualifyVersionIfNecessary(releaseVersion)
|
||||||
|
includeEmptyDirs = true
|
||||||
from('../') {
|
from('../') {
|
||||||
fileMode = 0755
|
fileMode = 0755
|
||||||
include '*.md'
|
include '*.md'
|
||||||
}
|
}
|
||||||
|
from('src/main/dist') {
|
||||||
|
fileMode = 0755
|
||||||
|
include '*'
|
||||||
|
}
|
||||||
from('../apps') {
|
from('../apps') {
|
||||||
fileMode = 0755
|
fileMode = 0755
|
||||||
include '*.md'
|
include '*.md'
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
Welcome to the Mifos community!
|
||||||
|
===============================
|
||||||
|
|
||||||
|
Depending on the OS you're running, you should have "runmifosx.sh" (for Linux and Mac) and
|
||||||
|
"runmifosx.bat" (for Windows) in this directory. These are small scripts that allow you to
|
||||||
|
run MifosX on your computer locally. To be able to run MifosX, just double-click on the script,
|
||||||
|
that is, "runmifosx.sh" if you are on Linux or Mac, or "runmifosx.bat" if you are on Windows.
|
||||||
|
|
||||||
|
Note
|
||||||
|
====
|
||||||
|
If you have a web front-end that you want to use along with the backend server, put your index.html
|
||||||
|
inside the "web" folder along with all the other source files.
|
||||||
|
P.S.: the index.html should be in the "web" folder itself
|
||||||
|
|
||||||
|
We hope you'll have an amazing experience working with MifosX.
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
java -version >nul 2>&1 && (
|
||||||
|
echo "Found Java."
|
||||||
|
) || (
|
||||||
|
echo "Java should be installed to run MifosX."
|
||||||
|
exit
|
||||||
|
)
|
||||||
|
|
||||||
|
echo "Starting MifosX ..... "
|
||||||
|
|
||||||
|
java -Djava.awt.headless=false -jar mifosng-provider.war
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# First of all, check if Java is installed on this computer
|
||||||
|
|
||||||
|
if hash java; then
|
||||||
|
echo "Found Java:"
|
||||||
|
echo $(java -version)
|
||||||
|
else
|
||||||
|
echo "Java should be installed to run MifosX."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting MifosX ..... "
|
||||||
|
|
||||||
|
java -Djava.awt.headless=false -jar mifosng-provider.war
|
||||||
@@ -12,6 +12,11 @@ import org.mifosplatform.infrastructure.core.boot.db.MariaDB4jDataSourceConfigur
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
|
* Mifos main() application which launches Mifos X in an embedded Tomcat HTTP
|
||||||
@@ -33,6 +38,18 @@ public class ServerWithMariaDB4jApplication {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args);
|
||||||
|
if (Desktop.isDesktopSupported()) {
|
||||||
|
Resource resource = ctx.getResource("file:" + System.getProperty("user.dir") +
|
||||||
|
System.getProperty("file.separator") + "web" +
|
||||||
|
System.getProperty("file.separator") + "index.html");
|
||||||
|
if (resource.exists()) {
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(URI.create("https://localhost:8443/mifosng-provider" +
|
||||||
|
"/web/index.html?baseApiUrl=https://localhost:8443" +
|
||||||
|
"&tenantIdentifier=default#/"));
|
||||||
|
} catch (IOException e) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ import org.springframework.context.annotation.ImportResource;
|
|||||||
* and MariaDB4j (because those differ in the subclasses).
|
* and MariaDB4j (because those differ in the subclasses).
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@Import({ WebXmlConfiguration.class })
|
@Import({ WebXmlConfiguration.class, WebFrontEndConfiguration.class })
|
||||||
@ImportResource({ "classpath*:META-INF/spring/appContext.xml" })
|
@ImportResource({ "classpath*:META-INF/spring/appContext.xml" })
|
||||||
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
|
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class,
|
||||||
HibernateJpaAutoConfiguration.class,
|
HibernateJpaAutoConfiguration.class,
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
package org.mifosplatform.infrastructure.core.boot;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
|
@EnableWebMvc
|
||||||
|
@Configuration
|
||||||
|
public class WebFrontEndConfiguration extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
registry.addResourceHandler("/web/**").addResourceLocations("file:" +
|
||||||
|
System.getProperty("user.dir") + System.getProperty("file.separator") +
|
||||||
|
"web" + System.getProperty("file.separator"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+2
@@ -9,6 +9,7 @@ import org.junit.Test;
|
|||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This integration test ensure that the "production" Spring XML configuration
|
* This integration test ensure that the "production" Spring XML configuration
|
||||||
@@ -23,6 +24,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
* AbstractApplicationConfiguration).
|
* AbstractApplicationConfiguration).
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@WebAppConfiguration
|
||||||
@ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class)
|
@ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class)
|
||||||
public class SpringConfigurationTest {
|
public class SpringConfigurationTest {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user