Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for release 0.4.0 #849

Merged
merged 19 commits into from
Nov 18, 2021
Merged
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
6 changes: 6 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github:
protected_branches:
master:
foo: bar
master-0.2.0:
foo: bar
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache Dubbo Admin
Copyright 2018-2019 The Apache Software Foundation
Copyright 2018-2021 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
### Quick start

* prebuilt docker image https://hub.docker.com/r/apache/dubbo-admin
* quick start a live demo with [play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#) (version:0.1.0)
* quick start a live demo with [play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#) (version:0.3.0)

### Screenshot

Expand Down
2 changes: 1 addition & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
### 快速开始

* 预构建的Docker镜像 https://hub.docker.com/r/apache/dubbo-admin
* 快速启动一个演示环境 [play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#) (版本:0.1.0)
* 快速启动一个演示环境 [play-with-docker](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/apache/dubbo-admin/develop/docker/stack.yml#) (版本:0.3.0)

### 页面截图

Expand Down
11 changes: 5 additions & 6 deletions docker/0.3.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
# limitations under the License.

FROM maven:3-openjdk-8
RUN mkdir -p /source/dubbo-admin-snapshot
ADD . /source/dubbo-admin-snapshot
WORKDIR /source/dubbo-admin-snapshot
RUN mvn --batch-mode -Prelease clean package -Dmaven.test.skip=true
RUN mkdir /source && wget https://github.com/apache/dubbo-admin/archive/0.3.0.zip && unzip -q 0.3.0.zip -d /source
WORKDIR /source/dubbo-admin-0.3.0
RUN mvn --batch-mode clean package -Dmaven.test.skip=true

FROM openjdk:8-jre
LABEL maintainer="[email protected]"
RUN apt-get update && apt-get install -y tini
COPY --from=0 /source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar /app.jar
COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --from=0 /source/dubbo-admin-0.3.0/dubbo-admin-distribution/target/dubbo-admin-0.3.0.jar /app.jar
COPY --from=0 /source/dubbo-admin-0.3.0/docker/entrypoint.sh /usr/local/bin/entrypoint.sh

ENV JAVA_OPTS ""

Expand Down
23 changes: 23 additions & 0 deletions docker/0.3.0/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ubuntu:trusty
RUN apt-get update && apt-get install -yq curl && apt-get clean

WORKDIR /app

ADD test.sh /app/test.sh

CMD ["bash", "test.sh"]
33 changes: 33 additions & 0 deletions docker/0.3.0/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

zookeeper:
image: zookeeper:3.5
admin:
build: .
dockerfile: Dockerfile
links:
- zookeeper
environment:
- admin.registry.address=zookeeper://zookeeper:2181
- admin.config-center=zookeeper://zookeeper:2181
- admin.metadata-report.address=zookeeper://zookeeper:2181
ports:
- 8080
sut:
build: .
dockerfile: Dockerfile.test
links:
- admin
34 changes: 34 additions & 0 deletions docker/0.3.0/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOOP_SIZE=60
i=0

while [[ $i -lt LOOP_SIZE ]]; do
status_code=$(curl --write-out %{http_code} --silent --output /dev/null http://admin:8080)

if [[ "$status_code" -eq 200 ]] ; then
echo "Tests passed!"
exit 0
else
curl -v http://admin:8080
echo "status is incorrect, waiting for next turn"
fi
sleep 5
i=$i+1
done

echo "Tests failed!"
exit 1
2 changes: 1 addition & 1 deletion docker/latest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN apt-get update && apt-get install -y tini
COPY --from=0 /source/dubbo-admin-snapshot/dubbo-admin-distribution/target/dubbo-admin-0.3.0-SNAPSHOT.jar /app.jar
COPY --from=0 /source/dubbo-admin-snapshot/docker/entrypoint.sh /usr/local/bin/entrypoint.sh

ENV JAVA_OPTS ""
ENV JAVA_OPTS "-Dloader.path=/opt-libs"

ENTRYPOINT ["tini", "--", "/usr/local/bin/entrypoint.sh"]
EXPOSE 8080
15 changes: 14 additions & 1 deletion docker/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ services:
- zookeeper
ports:
- 8080:8080
# the db driver path
volumes:
- "/mnt/opt-libs:/opt-libs"
environment:
- admin.registry.address=zookeeper://zookeeper:2181
- admin.config-center=zookeeper://zookeeper:2181
- admin.metadata-report.address=zookeeper://zookeeper:2181
- admin.metadata-report.address=zookeeper://zookeeper:2181
- dubbo.application.name=dubbo-admin
- dubbo.registry.address=zookeeper://zookeeper:2181
- mybatis-plus.global-config.db-config.id-type=none
- spring.datasource.driver-class-name=com.mysql.jdbc.Driver
- spring.datasource.url=jdbc:mysql://xxx:3306/dubbo-admin?characterEncoding=utf8&connectTimeout=1000&socketTimeout=10000&autoReconnect=true
- spring.datasource.username=root
- spring.datasource.password=mysql
# use internal h2 as database
# - spring.datasource.url=jdbc:h2:mem:~/dubbo-admin;
# - spring.datasource.username=sa
4 changes: 2 additions & 2 deletions dubbo-admin-distribution/src/NOTICE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Apache Dubbo Admin
Copyright 2018-2019 The Apache Software Foundation
Copyright 2018-2021 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down Expand Up @@ -100,7 +100,7 @@ dubbo NOTICE

========================================================================
Apache Dubbo
Copyright 2018-2019 The Apache Software Foundation
Copyright 2018-2021 The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Down
1 change: 1 addition & 0 deletions dubbo-admin-distribution/src/assembly/source-release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<exclude>**/.mvn/**</exclude>
<exclude>**/*.jar</exclude>
<exclude>**/mvnw*</exclude>
<exclude>**/.flattened-pom.xml</exclude>
<exclude>dubbo-admin-distribution/src/LICENSE</exclude>
<exclude>dubbo-admin-distribution/src/NOTICE</exclude>
<exclude>dubbo-admin-distribution/src/licenses/**</exclude>
Expand Down
18 changes: 18 additions & 0 deletions dubbo-admin-distribution/src/bin/config/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,21 @@ admin.check.sessionTimeoutMilli=3600000
server.compression.enabled=true
server.compression.mime-types=text/css,text/javascript,application/javascript
server.compression.min-response-size=10240

#dubbo config
dubbo.application.name=dubbo-admin
dubbo.registry.address=${admin.registry.address}

# mysql
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://localhost:3306/dubbo-admin?characterEncoding=utf8&connectTimeout=1000&socketTimeout=10000&autoReconnect=true
#spring.datasource.username=root
#spring.datasource.password=mysql

# h2
spring.datasource.url=jdbc:h2:mem:~/dubbo-admin;
spring.datasource.username=sa
spring.datasource.password=

# id generate type
mybatis-plus.global-config.db-config.id-type=none
2 changes: 1 addition & 1 deletion dubbo-admin-distribution/src/bin/startup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ set SERVER=dubbo-admin

set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"

set "JAVA_OPT=%JAVA_OPT% -jar %BASE_DIR%\lib\%SERVER%.jar"
set "JAVA_OPT=%JAVA_OPT% -Dloader.path=%BASE_DIR%\opt-libs -jar %BASE_DIR%\lib\%SERVER%.jar"

call "%JAVA%" %JAVA_OPT% dubbo.admin %*
4 changes: 2 additions & 2 deletions dubbo-admin-distribution/src/bin/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ if [ ! -f "${BASE_DIR}/logs/start.out" ]; then
fi

JAVA_OPT="${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m"
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/lib/${SERVER}.jar"
nohup $JAVA ${JAVA_OPT} dubbo.admin >> ${BASE_DIR}/logs/catlog.out 2>&1 &
JAVA_OPT="${JAVA_OPT} -Dloader.path=${BASE_DIR}/opt-libs -jar ${BASE_DIR}/lib/${SERVER}.jar"
nohup "$JAVA" ${JAVA_OPT} dubbo.admin >> ${BASE_DIR}/logs/catlog.out 2>&1 &
echo "${SERVER} is starting,you can check the ${BASE_DIR}/logs/catlog.out"
52 changes: 47 additions & 5 deletions dubbo-admin-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<mockito-version>2.23.4</mockito-version>
<jwt-version>3.4.1</jwt-version>
<jjwt-version>0.6.0</jjwt-version>
</properties>

<dependencies>
Expand Down Expand Up @@ -128,6 +130,11 @@
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-x-discovery</artifactId>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
Expand Down Expand Up @@ -172,11 +179,6 @@
<artifactId>netty-all</artifactId>
</dependency>

<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-serialization-kryo</artifactId>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -189,6 +191,43 @@
<artifactId>zookeeper</artifactId>
</dependency>

<!--JWT-->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>${jwt-version}</version>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt-version}</version>
</dependency>


<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-mock-api</artifactId>
</dependency>

<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>

<!-- the mysql db driver need user put it in /opt-libs path -->
<!-- <dependency>-->
<!-- <groupId>mysql</groupId>-->
<!-- <artifactId>mysql-connector-java</artifactId>-->
<!-- <version>5.1.49</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -197,6 +236,9 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.2.RELEASE</version>
<configuration>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<phase>package</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@

package org.apache.dubbo.admin;

import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;

@SpringBootApplication(exclude={
DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class
HibernateJpaAutoConfiguration.class
})
@EnableDubbo(scanBasePackages = {"org.apache.dubbo.admin.provider"})
@MapperScan(basePackages = {"org.apache.dubbo.admin.mapper"})
public class DubboAdminApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.dubbo.admin.authentication;

import org.apache.dubbo.common.extension.SPI;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Permission interception validation
*
*/
@SPI
public interface InterceptorAuthentication {

boolean authentication(HttpServletRequest request, HttpServletResponse response, Object handler);

}
Loading