Update all elements
This commit is contained in:
parent
772ec1e9a5
commit
d29e219fa4
@ -74,6 +74,6 @@ COPY --from=buildFront /tmp/dist /application/karideo/
|
||||
|
||||
WORKDIR /application/
|
||||
|
||||
EXPOSE 18080
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["java", "-Xms64M", "-Xmx1G", "-cp", "/application/application.jar", "org.kar.karideo.WebLauncher"]
|
||||
|
@ -70,7 +70,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.45</version>
|
||||
<version>8.0.30</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.kar.karideo;
|
||||
|
||||
import org.glassfish.grizzly.http.server.HttpServer;
|
||||
|
||||
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
|
||||
import org.glassfish.jersey.media.multipart.MultiPartFeature;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
@ -14,12 +15,37 @@ import org.kar.karideo.util.JWTWrapper;
|
||||
import org.glassfish.jersey.jackson.JacksonFeature;
|
||||
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
class UpdateJwtPublicKey extends Thread {
|
||||
boolean kill = false;
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000*20, 0);
|
||||
} catch (InterruptedException e2) {
|
||||
// TODO Auto-generated catch block
|
||||
e2.printStackTrace();
|
||||
}
|
||||
while (this.kill == false) {
|
||||
// need to uppgrade when server call us...
|
||||
try {
|
||||
JWTWrapper.initLocalTokenRemote(ConfigVariable.getSSOAddress(), "karideo");
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
System.out.println("Can not retreive the basic tocken");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Thread.sleep(1000*60*5, 0);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void kill() {
|
||||
this.kill = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class WebLauncher {
|
||||
public static DBConfig dbConfig;
|
||||
@ -29,25 +55,15 @@ public class WebLauncher {
|
||||
private static URI getBaseURI() {
|
||||
return UriBuilder.fromUri(ConfigVariable.getlocalAddress()).build();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// ===================================================================
|
||||
// Configure resources
|
||||
// ===================================================================
|
||||
ResourceConfig rc = new ResourceConfig();
|
||||
// need to uppgrade when server call us...
|
||||
try {
|
||||
JWTWrapper.initLocalTokenRemote(ConfigVariable.getSSOAddress(), "karideo");
|
||||
} catch (Exception e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
System.out.println("Wait 10 seconds ....");
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// add multipart models ..
|
||||
// add multi-part models ..
|
||||
//rc.register(new MultiPartFeature());
|
||||
//rc.register(new InjectionBinder());
|
||||
rc.register(new MultiPartFeature());
|
||||
@ -69,7 +85,7 @@ public class WebLauncher {
|
||||
rc.registerClasses(VideoResource.class);
|
||||
rc.registerClasses(HealthCheck.class);
|
||||
rc.registerClasses(Front.class);
|
||||
// add jackson to be discovenr when we are ins standalone server
|
||||
// add jackson to be discover when we are ins standalone server
|
||||
rc.register(JacksonFeature.class);
|
||||
// enable this to show low level request
|
||||
//rc.property(LoggingFeature.LOGGING_FEATURE_LOGGER_LEVEL_SERVER, Level.WARNING.getName());
|
||||
@ -96,7 +112,16 @@ public class WebLauncher {
|
||||
}
|
||||
}, "shutdownHook"));
|
||||
|
||||
// run
|
||||
|
||||
// ===================================================================
|
||||
// start periodic update of the token ...
|
||||
// ===================================================================
|
||||
UpdateJwtPublicKey keyUpdater = new UpdateJwtPublicKey();
|
||||
keyUpdater.start();
|
||||
|
||||
// ===================================================================
|
||||
// run JERSEY
|
||||
// ===================================================================
|
||||
try {
|
||||
server.start();
|
||||
System.out.println("Jersey app started at " + getBaseURI());
|
||||
@ -106,5 +131,12 @@ public class WebLauncher {
|
||||
System.out.println("There was an error while starting Grizzly HTTP server.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
keyUpdater.kill();
|
||||
try {
|
||||
keyUpdater.join(4000, 0);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ package org.kar.karideo.api;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.kar.karideo.util.JWTWrapper;
|
||||
|
||||
@Path("/health_check")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ -16,7 +19,10 @@ public class HealthCheck {
|
||||
// todo : do it better...
|
||||
@GET
|
||||
@PermitAll
|
||||
public HealthResult getHealth() {
|
||||
return new HealthResult("alive and kicking");
|
||||
public Response getHealth() {
|
||||
if (JWTWrapper.getPublicKey() == null) {
|
||||
return Response.status(500).entity(new HealthResult("Missing Jwt public token")).build();
|
||||
}
|
||||
return Response.status(200).entity(new HealthResult("alive and kicking")).build();
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,6 @@ public class DBConfig {
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return "jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.dbName + "?useSSL=false&serverTimezone=UTC";
|
||||
return "jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.dbName + "?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC";
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.kar.karideo.util;
|
||||
|
||||
public class ConfigVariable {
|
||||
public static final String BASE_NAME = "ORG_KARIDEO_";
|
||||
|
||||
public static String getTmpDataFolder() {
|
||||
String out = System.getenv("org.kar.karideo.dataTmpFolder");
|
||||
String out = System.getenv(BASE_NAME + "DATA_TMP_FOLDER");
|
||||
if (out == null) {
|
||||
return "/application/data/tmp";
|
||||
}
|
||||
@ -11,7 +12,7 @@ public class ConfigVariable {
|
||||
}
|
||||
|
||||
public static String getMediaDataFolder() {
|
||||
String out = System.getenv("org.kar.karideo.dataFolder");
|
||||
String out = System.getenv(BASE_NAME + "DATA_FOLDER");
|
||||
if (out == null) {
|
||||
return "/application/data/media";
|
||||
}
|
||||
@ -19,7 +20,7 @@ public class ConfigVariable {
|
||||
}
|
||||
|
||||
public static String getFrontFolder() {
|
||||
String out = System.getenv("ORG_KARIDEO_FRONT_FOLDER");
|
||||
String out = System.getenv(BASE_NAME + "FRONT_FOLDER");
|
||||
if (out == null) {
|
||||
return "/application/karideo";
|
||||
}
|
||||
@ -28,7 +29,7 @@ public class ConfigVariable {
|
||||
|
||||
|
||||
public static String getDBHost() {
|
||||
String out = System.getenv("ORG_KARIDEO_DB_HOST");
|
||||
String out = System.getenv(BASE_NAME + "DB_HOST");
|
||||
if (out == null) {
|
||||
return "localhost";
|
||||
}
|
||||
@ -36,31 +37,32 @@ public class ConfigVariable {
|
||||
}
|
||||
|
||||
public static String getDBPort() {
|
||||
String out = System.getenv("ORG_KARIDEO_DB_PORT");
|
||||
String out = System.getenv(BASE_NAME + "DB_PORT");
|
||||
if (out == null) {
|
||||
return "17036";
|
||||
return "3306";
|
||||
//return "17036";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String getDBLogin() {
|
||||
String out = System.getenv("ORG_KARIDEO_DB_LOGIN");
|
||||
String out = System.getenv(BASE_NAME + "DB_USER");
|
||||
if (out == null) {
|
||||
return "root";
|
||||
return "karideo";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String getDBPassword() {
|
||||
String out = System.getenv("MYSQL_ROOT_PASSWORD");
|
||||
String out = System.getenv(BASE_NAME + "DB_PASSWORD");
|
||||
if (out == null) {
|
||||
return "ZERTYSDGFVHSDFGHJYZSDFGSQxfgsqdfgsqdrf4564654";
|
||||
return "karideo_password";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
public static String getDBName() {
|
||||
String out = System.getenv("MYSQL_DATABASE");
|
||||
String out = System.getenv(BASE_NAME + "DB_DATABASE");
|
||||
if (out == null) {
|
||||
return "karideo";
|
||||
}
|
||||
@ -68,9 +70,10 @@ public class ConfigVariable {
|
||||
}
|
||||
|
||||
public static String getlocalAddress() {
|
||||
String out = System.getenv("ORG_KARIDEO_ADDRESS");
|
||||
String out = System.getenv(BASE_NAME + "ADDRESS");
|
||||
if (out == null) {
|
||||
return "http://0.0.0.0:18080/karideo/api/";
|
||||
return "http://0.0.0.0:80/karideo/api/";
|
||||
//return "http://0.0.0.0:18080/karideo/api/";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -78,7 +81,8 @@ public class ConfigVariable {
|
||||
public static String getSSOAddress() {
|
||||
String out = System.getenv("SSO_ADDRESS");
|
||||
if (out == null) {
|
||||
return "http://192.168.1.156/karauth/api/";
|
||||
return "http://sso_host/karauth/api/";
|
||||
//return "http://192.168.1.156/karauth/api/";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -59,11 +59,11 @@ public class JWTWrapper {
|
||||
}
|
||||
in.close();
|
||||
// print result
|
||||
System.out.println(response.toString());
|
||||
//System.out.println(response.toString());
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
;
|
||||
PublicKey values = mapper.readValue(response.toString(), PublicKey.class);
|
||||
rsaPublicJWK = RSAKey.parse(values.key);
|
||||
return;
|
||||
}
|
||||
System.out.println("GET JWT validator token not worked");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
"scripts": {
|
||||
"all": "npm run build && npm run test",
|
||||
"ng": "ng",
|
||||
"start": "ng serve --watch",
|
||||
"start": "ng serve --watch --port 4202",
|
||||
"build": "ng build --prod",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
|
@ -18,7 +18,7 @@ export class ElementSeasonComponent implements OnInit {
|
||||
// input parameters
|
||||
@Input() element:NodeData;
|
||||
|
||||
numberSeason: number;
|
||||
numberSeason: string;
|
||||
count: number;
|
||||
covers: string[];
|
||||
description: string;
|
||||
@ -34,7 +34,7 @@ export class ElementSeasonComponent implements OnInit {
|
||||
this.covers = undefined;
|
||||
this.description = undefined;
|
||||
}
|
||||
this.numberSeason = this.element.id;
|
||||
this.numberSeason = this.element.name;
|
||||
this.description = this.element.description;
|
||||
this.covers = this.dataService.getCoverListThumbnailUrl(this.element.covers);
|
||||
let self = this;
|
||||
|
@ -209,7 +209,7 @@ export class VideoScene implements OnInit {
|
||||
self.generatedName = "????????? TODO: ???????" //response.generatedName;
|
||||
if(self.dataId !== -1) {
|
||||
self.videoSource = self.httpService.createRESTCall2({
|
||||
api: `data/${ self.dataId}/${self.generatedName}`,
|
||||
api: `data/${self.dataId}/${self.generatedName}`,
|
||||
addURLToken: true,
|
||||
});
|
||||
} else {
|
||||
|
@ -3,6 +3,22 @@
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
const environment_back_prod = {
|
||||
production: false,
|
||||
// URL of development API
|
||||
applName: "karideo",
|
||||
defaultServer: "karideo",
|
||||
server: {
|
||||
karideo: 'http://192.168.1.156/karideo/api',
|
||||
karauth: 'http://192.168.1.156/karauth/api',
|
||||
},
|
||||
ssoSignIn: 'http://192.168.1.156/karso/signin/karideo-dev/',
|
||||
ssoSignUp: 'http://192.168.1.156/karso/signup/karideo-dev/',
|
||||
ssoSignOut: 'http://192.168.1.156/karso/signout/karideo-dev/',
|
||||
frontBaseUrl: '',
|
||||
//apiMode: 'REWRITE'
|
||||
};
|
||||
|
||||
const environment_local = {
|
||||
production: false,
|
||||
// URL of development API
|
||||
@ -36,5 +52,5 @@ const environment_hybrid = {
|
||||
};
|
||||
|
||||
|
||||
export const environment = environment_hybrid;
|
||||
export const environment = environment_back_prod;
|
||||
|
||||
|
@ -24,9 +24,7 @@ docker-compose up -d
|
||||
|
||||
build the local image:
|
||||
|
||||
docker build -t kangaroo-and-rabbit/karideo .
|
||||
|
||||
docker tag kangaroo-and-rabbit/karideo:latest gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest
|
||||
docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karideo:latest .
|
||||
|
||||
docker login gitea.atria-soft.org
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user