Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions sentinel-dashboard/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.default: &default
only:
- merge_requests
- web

.default_tag: &default_tag
tags:
- backend

stages:
- build
- quality
- deploy
- merge
- release

merge_ready:
# tags:
# - backend
stage: quality
<<: *default
<<: *default_tag
script:
- mvn test -U -Pquality_check


post_merge:
stage: merge
<<: *default_tag
script:
- mvn clean test -U -Pquality_check
only:
refs:
- develop

build_snapshot:
# tags:
# - backend
stage: build
<<: *default
<<: *default_tag
script:
- mvn clean install -DskipTests=true -U -Pdocker

deploy_snapshot:
# tags:
# - backend
stage: deploy
<<: *default_tag
only:
- web
script:
- mvn deploy -DskipTests=true -Pdocker
when: manual
allow_failure: false


release:
<<: *default_tag
stage: release
script:
- git remote set-url origin "git@gitlab.phonepe.com:${CI_PROJECT_PATH}.git"
- git checkout master
- git checkout develop
- mvn -U -Pdocker jgitflow:release-start jgitflow:release-finish
- git push --all
- git push --tags origin
when: manual
only:
refs:
- develop
13 changes: 13 additions & 0 deletions sentinel-dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM openjdk:8-jdk-alpine

ARG SENTINEL_VERSION="1.7.1"

WORKDIR /home/sentinel

ENV JAR_FILE sentinel-dashboard.jar
ADD target/sentinel-dashboard.jar ${JAR_FILE}

EXPOSE 7070
EXPOSE 7071

CMD java -Dserver.port=7070 -Dcsp.sentinel.dashboard.server=localhost:7070 -Dproject.name=sentinel -jar ${JAR_FILE}
91 changes: 85 additions & 6 deletions sentinel-dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,91 @@

<artifactId>sentinel-dashboard</artifactId>
<packaging>jar</packaging>
<version>1.7.1-SNAPSHOT</version>

<distributionManagement>
<repository>
<id>clojars</id>
<name>Clojars repository</name>
<url>https://clojars.org/repo</url>
</repository>
<snapshotRepository>
<id>phonepe-snapshots</id>
<url>http://artifactory.phonepe.com/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<spring.boot.version>2.0.5.RELEASE</spring.boot.version>
<curator.version>4.0.1</curator.version>
<project.version>1.7.1</project.version>
</properties>

<dependencies>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-web-servlet</artifactId>
<version>${project.version}</version>
<version>1.7.1</version>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-simple-http</artifactId>
<version>1.7.1</version>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-transport-common</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-extension</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-parameter-flow-control</artifactId>
<version>${project.version}</version>
<version>1.7.1</version>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-api-gateway-adapter-common</artifactId>
<version>${project.version}</version>
<version>1.7.1</version>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-parameter-flow-control</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -102,7 +156,14 @@
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
<version>1.7.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-extension</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- for Apollo rule publisher sample -->
<dependency>
Expand All @@ -117,7 +178,6 @@
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>${curator.version}</version>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -136,6 +196,25 @@
<version>1.16.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>4.2.0</version>
</dependency>

<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-zookeeper</artifactId>
<version>1.7.1</version>
<exclusions>
<exclusion>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-extension</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -171,9 +250,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven.deploy.version}</version>
<configuration>
<!--<configuration>
<skip>true</skip>
</configuration>
</configuration>-->
</plugin>
</plugins>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,34 @@
*/
package com.alibaba.csp.sentinel.dashboard.auth;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
* @author cdfive
* @since 1.6.0
*/
@Component
@Primary
@ConditionalOnProperty(name = "auth.enabled", matchIfMissing = true)
@Component
public class SimpleWebAuthServiceImpl implements AuthService<HttpServletRequest> {

public static final String WEB_SESSION_KEY = "session_sentinel_admin";
public static final String WEB_SESSION_KEY = "session_sentinel_user";
public static final String WEB_SESSION_KEY_ADMIN = "session_sentinel_admin";

@Override
public AuthUser getAuthUser(HttpServletRequest request) {
HttpSession session = request.getSession();
Object sentinelUserObj = session.getAttribute(SimpleWebAuthServiceImpl.WEB_SESSION_KEY);
if (sentinelUserObj != null && sentinelUserObj instanceof AuthUser) {
Object sentinelUserObj = session.getAttribute(SimpleWebAuthServiceImpl.WEB_SESSION_KEY_ADMIN);

if (sentinelUserObj != null && sentinelUserObj instanceof AuthService.AuthUser) {
return (AuthUser) sentinelUserObj;
}
sentinelUserObj = session.getAttribute(SimpleWebAuthServiceImpl.WEB_SESSION_KEY);
if (sentinelUserObj != null && sentinelUserObj instanceof AuthService.AuthUser) {
return (AuthUser) sentinelUserObj;
}

return null;
}

Expand Down
Loading