Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loginservice
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanmw
loginservice
Commits
d62ffd50
Commit
d62ffd50
authored
Jul 24, 2020
by
linxu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加Dockerfile
parent
ef31b0d6
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
96 additions
and
115 deletions
+96
-115
Dockerfile
Dockerfile
+17
-0
build-image.sh
build-image.sh
+4
-0
pom.xml
pom.xml
+23
-20
settings.xml
settings.xml
+23
-0
LoginApplication.java
src/main/java/com/keymobile/proxy/LoginApplication.java
+2
-0
ServiceInfo.java
src/main/java/com/keymobile/proxy/api/ServiceInfo.java
+0
-55
application-dev.yml
src/main/resources/application-dev.yml
+23
-12
application-test.yml
src/main/resources/application-test.yml
+2
-2
bootstrap.yml
src/main/resources/bootstrap.yml
+2
-5
login.html
src/main/resources/templates/login.html
+0
-21
No files found.
Dockerfile
0 → 100644
View file @
d62ffd50
FROM
openjdk:8-jre
ENV
WORKING_DIR /opt/jboss
USER
root
RUN
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&&
echo
'Asia/Shanghai'
>
/etc/timezone
COPY
target/login-1.0.0-SNAPSHOT.jar $WORKING_DIR/login.jar
RUN
ls
RUN
cd
$WORKING_DIR
&&
chown
-R
jboss:jboss login.jar
USER
jboss
CMD
["/bin/sh", "-c", "java -Xmx128M -jar login.jar"]
build-image.sh
0 → 100755
View file @
d62ffd50
#!/bin/bash
set
-e
sudo
docker build
--rm
-t
login:1.0.0
.
pom.xml
View file @
d62ffd50
...
...
@@ -3,37 +3,41 @@
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
LV77
</groupId>
<artifactId>
ads-mds-
login
</artifactId>
<version>
0.0.1
-SNAPSHOT
</version>
<groupId>
com.keymobile.common
</groupId>
<artifactId>
login
</artifactId>
<version>
1.0.0
-SNAPSHOT
</version>
<packaging>
jar
</packaging>
<name>
mdslogin
</name>
<description>
mdslogin
</description>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.
0.4
.RELEASE
</version>
<relativePath
/>
<version>
2.
1.15
.RELEASE
</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
<spring-cloud.version>
Finchley
.RELEASE
</spring-cloud.version>
<spring-cloud.version>
Greenwich
.RELEASE
</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-
eureka-client
</artifactId>
<artifactId>
spring-cloud-starter-netflix-
zuul
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-zuul
</artifactId>
<artifactId>
spring-cloud-starter-kubernetes
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-kubernetes-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.session
</groupId>
<artifactId>
spring-session-data-redis
</artifactId>
...
...
@@ -68,17 +72,9 @@
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-config-client
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
...
...
@@ -93,8 +89,15 @@
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>
maven-snapshots
</id>
<name>
maven-snapshots
</name>
<url>
http://mgr-00:8081/repository/maven-public/
</url>
</repository>
</repositories>
<build>
<finalName>
mdslogin
</finalName>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
...
...
settings.xml
0 → 100644
View file @
d62ffd50
<settings>
<mirrors>
<mirror>
<id>
nexus
</id>
<mirrorOf>
*
</mirrorOf>
<url>
http://mgr-00:8081/repository/maven-public/
</url>
</mirror>
</mirrors>
<servers>
<server>
<id>
nexus-snapshots
</id>
<username>
admin
</username>
<password>
dataSharing
</password>
</server>
<server>
<id>
nexus-releases
</id>
<username>
admin
</username>
<password>
dataSharing
</password>
</server>
</servers>
</settings>
\ No newline at end of file
src/main/java/com/keymobile/proxy/LoginApplication.java
View file @
d62ffd50
...
...
@@ -2,8 +2,10 @@ package com.keymobile.proxy;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
@SpringBootApplication
@EnableDiscoveryClient
public
class
LoginApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/keymobile/proxy/api/ServiceInfo.java
deleted
100644 → 0
View file @
ef31b0d6
package
com
.
keymobile
.
proxy
.
api
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.net.DatagramSocket
;
import
java.net.InetAddress
;
@RestController
@RequestMapping
(
value
=
"/info"
)
public
class
ServiceInfo
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
ServiceInfo
.
class
);
@Value
(
"${server.port}"
)
private
int
port
;
@Value
(
"${redirect-url.system-management}"
)
private
String
managementSystemUrl
;
@RequestMapping
(
value
=
"/port"
,
method
=
RequestMethod
.
GET
)
public
Integer
getPort
()
{
return
port
;
}
@RequestMapping
(
value
=
"/ip"
,
method
=
RequestMethod
.
GET
)
public
String
getIP
(
HttpServletResponse
response
)
{
response
.
setContentType
(
"text/plain;charset=utf-8"
);
try
{
try
(
final
DatagramSocket
socket
=
new
DatagramSocket
())
{
socket
.
connect
(
InetAddress
.
getByName
(
"8.8.8.8"
),
10002
);
String
ip
=
socket
.
getLocalAddress
().
getHostAddress
();
return
ip
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"Failed to get server IP."
,
e
);
return
"127.0.0.1"
;
}
}
@RequestMapping
(
value
=
"/api-prefix"
,
method
=
RequestMethod
.
GET
)
public
String
getApiPrefix
(
HttpServletResponse
response
)
{
response
.
setContentType
(
"text/plain;charset=utf-8"
);
return
"http://"
+
getIP
(
response
)
+
":"
+
getPort
();
}
@GetMapping
(
"/manager-url"
)
public
String
getManagementSystemUrl
(
HttpServletResponse
response
)
{
response
.
setContentType
(
"text/plain;charset=utf-8"
);
return
managementSystemUrl
;
}
}
src/main/resources/application-dev.yml
View file @
d62ffd50
...
...
@@ -7,26 +7,37 @@ spring:
session
:
store-type
:
redis
redis
:
host
:
localhost
port
:
6379
cluster
:
nodes
:
192.168.0.192:6379
max-redirects
:
6
timeout
:
10000
maxIdle
:
300
maxTotal
:
1000
maxWaitMillis
:
1000
minEvictableIdleTimeMillis
:
300000
numTestsPerEvictionRun
:
1024
timeBetweenEvictionRunsMillis
:
30000
testOnBorrow
:
true
testWhileIdle
:
true
password
:
datasource
:
url
:
jdbc:mysql://127.0.0.1:3306/d0?autoReconnect=true
username
:
root
password
:
dataSharing
url
:
jdbc:mysql://192.168.0.192:3306/dev0?autoReconnect=true
username
:
test
password
:
test
driver-class-name
:
com.mysql.jdbc.Driver
cloud
:
kubernetes
:
enabled
:
false
eureka
:
client
:
registerWithEureka
:
fals
e
registerWithEureka
:
tru
e
region
:
default
registryFetchIntervalSeconds
:
5
serviceUrl
:
defaultZone
:
http://localhost:8081/eureka/
zuul
:
prefix
:
/api
sensitive-headers
:
defaultZone
:
http://dev-vm-12:8081/eureka/
logging
:
level
:
org.springframework.security
:
DEBUG
org.springframework.security
:
info
src/main/resources/application-test.yml
View file @
d62ffd50
...
...
@@ -9,10 +9,10 @@ spring:
redis
:
namespace
:
dataplatformdev
redis
:
host
:
localhost
host
:
192.168.0.192
port
:
6379
datasource
:
url
:
jdbc:mysql://
localhost:3306
/dataSharing?autoReconnect=true
url
:
jdbc:mysql://
192.168.0.192:test
/dataSharing?autoReconnect=true
username
:
root
password
:
dataSharing
servlet
:
...
...
src/main/resources/bootstrap.yml
View file @
d62ffd50
...
...
@@ -2,7 +2,4 @@ spring:
application
:
name
:
auth
profiles
:
active
:
test
cloud
:
config
:
uri
:
http://localhost:8082
\ No newline at end of file
active
:
dev
\ No newline at end of file
src/main/resources/templates/login.html
deleted
100644 → 0
View file @
ef31b0d6
<!DOCTYPE html>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:th=
"http://www.thymeleaf.org"
xmlns:sec=
"http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
>
<head>
<title>
Spring Security Example
</title>
</head>
<body>
<div
th:if=
"${param.error}"
>
Invalid username and password.
</div>
<div
th:if=
"${param.logout}"
>
You have been logged out.
</div>
<form
th:action=
"@{/api/auth/signin}"
method=
"post"
>
<div><label>
User Name :
<input
type=
"text"
name=
"username"
/>
</label></div>
<div><label>
Password:
<input
type=
"password"
name=
"password"
/>
</label></div>
<div><input
type=
"submit"
value=
"Sign In"
/></div>
</form>
</body>
</html>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment