Skip to content

Commit

Permalink
Better bootstrap process (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-v authored Oct 8, 2024
1 parent a93fe0f commit a3c68d7
Show file tree
Hide file tree
Showing 67 changed files with 1,599 additions and 1,774 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/branch-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@ jobs:
name: Branch CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 17
distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Maven Build
run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -Ddockerfile.skip=true -B -V
run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Maven Verify
run: |
sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
mvn verify -B
run: mvn verify -B
15 changes: 8 additions & 7 deletions .github/workflows/pre-release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ jobs:
name: Pre-release CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 17
distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Deploy pre-release version to GitHub Packages
run: |
sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
pre_release_version=${{ github.event.release.tag_name }}
echo Pre-release version $pre_release_version
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
Expand All @@ -34,9 +34,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 17
distribution: zulu
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,30 @@ jobs:
name: Release CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git checkout ${{ github.event.release.target_commitish }}
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up Java for publishing to GitHub Packages
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 17
distribution: zulu
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Maven Build
run: mvn clean install -DskipTests=true -Ddockerfile.skip=true -B -V
run: mvn clean install -DskipTests=true -B -V
env:
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
- name: Maven Verify
run: |
sudo echo "127.0.0.1 $(eval hostname)" | sudo tee -a /etc/hosts
mvn verify -B
run: mvn verify -B
- name: Configure git
run: |
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
Expand All @@ -43,17 +42,18 @@ jobs:
run: |
mvn -B build-helper:parse-version release:prepare \
-DreleaseVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion} \
-Darguments="-DskipTests=true -Ddockerfile.skip=true"
-Darguments="-DskipTests=true"
echo release_tag=$(git describe --tags --abbrev=0) >> $GITHUB_OUTPUT
- name: Perform release
run: mvn -B release:perform -Pdeploy2Github -Darguments="-DskipTests=true -Ddockerfile.skip=true -Pdeploy2Github"
run: mvn -B release:perform -Pdeploy2Github -Darguments="-DskipTests=true -Pdeploy2Github"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8
java-version: 17
distribution: zulu
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
20 changes: 6 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.scalecube</groupId>
<artifactId>scalecube-parent</artifactId>
<version>0.2.20</version>
<version>0.3.1</version>
</parent>

<artifactId>scalecube-services-parent</artifactId>
Expand Down Expand Up @@ -59,23 +59,22 @@
</scm>

<properties>
<scalecube-cluster.version>2.6.18.rc1</scalecube-cluster.version>
<scalecube-security.version>1.0.32</scalecube-security.version>
<scalecube-cluster.version>2.6.18.RC10</scalecube-cluster.version>
<scalecube-security.version>1.0.33.RC1</scalecube-security.version>

<reactor.version>2020.0.32</reactor.version>
<jackson.version>2.15.1</jackson.version>
<jackson.version>2.18.0</jackson.version>
<netty.version>4.1.93.Final</netty.version>
<rsocket.version>1.1.4</rsocket.version>
<protostuff.version>1.6.0</protostuff.version>
<slf4j.version>1.7.36</slf4j.version>
<log4j.version>2.17.2</log4j.version>
<disruptor.version>3.4.2</disruptor.version>
<jsr305.version>3.0.2</jsr305.version>
<jctools.version>2.1.2</jctools.version>

<mockito-junit.version>4.6.1</mockito-junit.version>
<junit-jupiter.version>5.8.2</junit-jupiter.version>
<hamcrest.version>1.3</hamcrest.version>
<log4j.version>2.17.2</log4j.version>
<slf4j.version>1.7.36</slf4j.version>

<distributionManagement.url>https://maven.pkg.github.com/scalecube/scalecube-services
</distributionManagement.url>
Expand Down Expand Up @@ -150,13 +149,6 @@
<scope>import</scope>
</dependency>

<!-- Disruptor -->
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
<version>${disruptor.version}</version>
</dependency>

<!-- RSocket -->
<dependency>
<groupId>io.rsocket</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ public interface ServiceDiscovery {
Address address();

/**
* Function to subscribe and listen on stream of {@code ServiceDiscoveryEvent}\s.
* Function to subscribe and listen on service discovery stream.
*
* @return stream of {@code ServiceDiscoveryEvent}\s
* @return stream of {@code ServiceDiscoveryEvent} objects
*/
Flux<ServiceDiscoveryEvent> listen();

/**
* Starts this {@link ServiceDiscovery} instance. After started - subscribers begin to receive
* {@code ServiceDiscoveryEvent}\s on {@link #listen()}.
*/
/** Starts this instance. */
void start();

/** Stops this {@link ServiceDiscovery} instance and release occupied resources. */
/** Stops this instance and release occupied resources. */
void shutdown();
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.scalecube.services.gateway;

import io.scalecube.services.Address;
import reactor.core.publisher.Mono;

public interface Gateway {

Expand All @@ -20,16 +19,12 @@ public interface Gateway {
Address address();

/**
* Starts the gateway.
* Starts gateway.
*
* @return mono result
* @return gateway instance
*/
Mono<Gateway> start();
Gateway start();

/**
* Stops the gateway.
*
* @return stop signal
*/
Mono<Void> stop();
/** Stops gateway. */
void stop();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public interface ServiceRegistry {

boolean registerService(ServiceEndpoint serviceEndpoint);

ServiceEndpoint unregisterService(String endpointId);

void registerService(ServiceInfo serviceInfo);

ServiceEndpoint unregisterService(String endpointId);

List<ServiceInfo> listServices();

ServiceMethodInvoker getInvoker(String qualifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public interface ServerTransport {
Address address();

/**
* Starts {@link ServiceTransport} instance.
* Starts this instance.
*
* @return transport instance
*/
ServerTransport bind();

/** Stops this {@link ServiceTransport} instance and release occupied resources. */
/** Stops this instance and release occupied resources. */
void stop();
}
3 changes: 0 additions & 3 deletions services-discovery/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
<groupId>io.scalecube</groupId>
<artifactId>scalecube-cluster</artifactId>
</dependency>

<dependency>
<groupId>io.scalecube</groupId>
<artifactId>scalecube-services-api</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Tests -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand All @@ -32,7 +30,6 @@
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.scalecube</groupId>
<artifactId>scalecube-codec-jackson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
import io.scalecube.services.ServiceEndpoint;
import io.scalecube.services.discovery.api.ServiceDiscovery;
import io.scalecube.services.discovery.api.ServiceDiscoveryEvent;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.nio.ByteBuffer;
import java.time.Duration;
import java.util.StringJoiner;
import java.util.function.UnaryOperator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.Exceptions;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Sinks;

public final class ScalecubeServiceDiscovery implements ServiceDiscovery {

private static final Logger LOGGER = LoggerFactory.getLogger(ServiceDiscovery.class);
private static final Logger LOGGER = System.getLogger(ServiceDiscovery.class.getName());

private ClusterConfig clusterConfig;
private Cluster cluster;
Expand Down Expand Up @@ -107,17 +107,18 @@ public void shutdown() {
}

private void onMembershipEvent(MembershipEvent membershipEvent) {
LOGGER.debug("onMembershipEvent: {}", membershipEvent);
LOGGER.log(Level.DEBUG, "onMembershipEvent: {0}", membershipEvent);

ServiceDiscoveryEvent discoveryEvent = toServiceDiscoveryEvent(membershipEvent);
if (discoveryEvent == null) {
LOGGER.warn(
"DiscoveryEvent is null, cannot publish it (corresponding membershipEvent: {})",
LOGGER.log(
Level.WARNING,
"DiscoveryEvent is null, cannot publish it (corresponding membershipEvent: {0})",
membershipEvent);
return;
}

LOGGER.debug("Publish discoveryEvent: {}", discoveryEvent);
LOGGER.log(Level.DEBUG, "Publish discoveryEvent: {0}", discoveryEvent);
sink.emitNext(discoveryEvent, busyLooping(Duration.ofSeconds(3)));
}

Expand All @@ -141,7 +142,7 @@ private ServiceEndpoint toServiceEndpoint(ByteBuffer byteBuffer) {
try {
return (ServiceEndpoint) clusterConfig.metadataCodec().deserialize(byteBuffer.duplicate());
} catch (Exception e) {
LOGGER.error("Failed to read metadata", e);
LOGGER.log(Level.ERROR, "Failed to read metadata", e);
throw Exceptions.propagate(e);
}
}
Expand Down
Loading

0 comments on commit a3c68d7

Please sign in to comment.