Skip to content

Commit

Permalink
Merge branch 'release/0.6.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Holy committed Jan 26, 2021
2 parents 54dfb74 + edd7b5b commit c1663cd
Show file tree
Hide file tree
Showing 314 changed files with 5,721 additions and 1,974 deletions.
5 changes: 2 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
build --strategy=TypeScriptCompile=worker

# Use java 11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 --workspace_status_command=tools/build/bazel_status.sh

# Output test errors by default
test --test_output=errors
Expand All @@ -21,7 +21,6 @@ build:ci --test_env=ROOT_LOG_LEVEL=ERROR

build:ci --noshow_progress
build:ci --verbose_failures
build:ci --disk_cache=~/.cache/bazel
build:ci --repository_cache==~/.cache/bazel_external
build:ci --remote_cache=https://storage.googleapis.com/airy-ci-cache

test:ci --flaky_test_attempts=2
8 changes: 8 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ template: |
## Changes
$CHANGES
## Airy CLI
You can download the Airy CLI for your operating system from the following links:
[MacOS](https://airy-core-binaries.s3.amazonaws.com/$RESOLVED_VERSION/darwin/amd64/airy)
[Linux](https://airy-core-binaries.s3.amazonaws.com/$RESOLVED_VERSION/linux/amd64/airy)
[Windows](https://airy-core-binaries.s3.amazonaws.com/$RESOLVED_VERSION/windows/amd64/airy.exe)
25 changes: 17 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ jobs:
java-version: '11'
architecture: 'x64'

- name: Mount bazel cache
uses: actions/cache@v2
with:
path: |
/home/runner/.cache/bazel
/home/runner/.cache/bazel_external
key: bazel

- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64"
Expand All @@ -32,9 +24,13 @@ jobs:
- name: Enable CI settings
run: |
echo "$GCS_SA_KEY" > key.json
cat <<EOF >>.bazelrc
common --config=ci
build:ci --google_credentials=key.json
EOF
env:
GCS_SA_KEY: ${{secrets.GCS_SA_KEY}}

- name: Lint
run: |
Expand All @@ -53,3 +49,16 @@ jobs:
run: |
echo ${{ secrets.PAT }} | docker login ghcr.io -u airydevci --password-stdin
./scripts/push-images.sh ${{ github.ref }}
- name: Install aws cli
uses: chrislennon/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Upload airy binary to S3
if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
run: |
aws s3 cp bazel-bin/infrastructure/cli/airy_linux_bin s3://airy-core-binaries/`cat ./VERSION`/linux/amd64/airy
aws s3 cp bazel-bin/infrastructure/cli/airy_darwin_bin s3://airy-core-binaries/`cat ./VERSION`/darwin/amd64/airy
aws s3 cp bazel-bin/infrastructure/cli/airy_windows_bin s3://airy-core-binaries/`cat ./VERSION`/windows/amd64/airy.exe
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Editors and IDE's

!.ijwb/.idea/fileTemplates/

.idea/
.code/
.vscode/
.ijwb/

# Bazel
!.ijwb/.bazelproject

dist/
bazel-*

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ exports_files(
],
)

# gazelle:proto disable_global
# gazelle:build_file_name BUILD
# gazelle:prefix
gazelle(name = "gazelle")
Expand Down
79 changes: 69 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,75 @@
<p align="center">
<img src="https://global-uploads.webflow.com/5e9d5014fb5d85233d05fa23/5ea6ab4327484b79bdb4cea4_airy_primary_rgb.svg" alt="Airy-logo" width="240">


<div align="center">The open source, fully-featured, production ready</div>
<div align="center">Messaging platform</div>
</p>



# Airy Core Platform

[![Join the chat on Airy community](https://img.shields.io/badge/forum-join%20discussions-brightgreen.svg)](https://airy.co/community/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Documentation Status](https://img.shields.io/badge/docs-stable-brightgreen.svg)](https://docs.airy.co/)
[![CI](https://github.com/airyhq/airy/workflows/CI/badge.svg)](https://github.com/airyhq/airy/actions?query=workflow%3ACI)
[![Commit Frequency](https://img.shields.io/github/commit-activity/m/airyhq/airy)](https://docs.airy.co/)
[![License](https://img.shields.io/github/license/airyhq/airy)](https://docs.airy.co/)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/airyhq/airy/projects)


The Airy Core Platform is an open source, fully-featured, production ready
messaging platform to process conversational data from a variety of sources
(like Facebook Messenger, Google Business Messages, Website Live Chat, and
more).
messaging platform.
With Airy you can process conversational data from a variety of sources:

- **Facebook**
- **WhatsApp**
- **Google's Business Messages**
- **SMS**
- **Website Chat Plugins**
- **Twilio**
- **Your own conversational channels**

You can then use Airy to:

- **Unify your messaging channels**
- **Stream your conversational data wherever you want**
- **Integrate with different NLP frameworks**
- **Mediate open requests with Agents via our messaging UI**
- **Analyze your conversations**

Since Airy's infrastructure is built around Apache Kafka, it can process a
large amount of conversations and messages simultaneously and stream the
relevant conversational data to wherever you need it.

Learn more about what we open-sourced in the
[announcement blog post](https://airy.co/blog/what-we-open-sourced).

## About Airy

- **What does Airy do? 🚀**
[Learn more on our Website](https://airy.co/developers)

- **I'm new to Airy 😄**
[Get Started with Airy](https://docs.airy.co/)

- **I'd like to read the detailed docs 📖**
[Read The Docs](https://docs.airy.co/)

- **I'm ready to install Airy ✨**
[Installation](https://docs.airy.co/)

- **I have a question ❓**
[The Airy Community will help](https://airy.co/community)

- **Or continue reading the Read Me**

- [Getting Started](#getting-started)
- [Components](#components)
- [Organization of this Repo](#organization-of-the-repository)
- [Design Principles](#design-principles)
- [How to contribute](#how-to-contribute)
- [Code of Conduct](#code-of-conduct)
- [Getting started](#getting-started)
- [Components](#components)
- [Organization of the Repository](#organization-of-the-repository)
- [Design Principles](#design-principles)
- [How to contribute](#how-to-contribute)
- [Code of Conduct](#code-of-conduct)

## Getting started

Expand All @@ -19,7 +78,7 @@ You can run the Airy Core Platform locally by running the following commands:
```sh
$ git clone https://github.com/airyhq/airy
$ cd airy
$ AIRY_VERSION=beta ./scripts/bootstrap.sh
$ ./scripts/bootstrap.sh
```

The bootstrap installation requires
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.6.0
12 changes: 8 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
artifacts = airy_jvm_deps + [
"com.amazonaws:aws-java-sdk-core:1.11.933",
"com.amazonaws:aws-java-sdk-s3:1.11.933",
"com.fasterxml.jackson.core:jackson-annotations:2.10.0",
"com.fasterxml.jackson.core:jackson-core:2.10.0",
"com.fasterxml.jackson.core:jackson-databind:2.10.0",
Expand Down Expand Up @@ -60,6 +62,7 @@ maven_install(
"org.apache.lucene:lucene-queryparser:8.7.0",
"org.apache.lucene:lucene-analyzers-common:8.7.0",
"org.apache.lucene:lucene-core:8.7.0",
"org.aspectj:aspectjweaver:1.8.10",
"org.bouncycastle:bcpkix-jdk15on:1.63",
"org.flywaydb:flyway-core:5.2.4",
"org.hamcrest:hamcrest-library:2.1",
Expand All @@ -84,6 +87,7 @@ maven_install(
"org.springframework.boot:spring-boot-starter-web:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-websocket:2.3.1.RELEASE",
"org.springframework.boot:spring-boot-starter-security:2.3.1.RELEASE",
"org.springframework.retry:spring-retry:1.2.5.RELEASE",
"org.springframework:spring-aop:4.1.4.RELEASE",
"org.springframework:spring-jdbc:4.1.4.RELEASE",
"org.springframework:spring-context-support:5.2.0.RELEASE",
Expand Down Expand Up @@ -184,10 +188,10 @@ container_pull(

container_pull(
name = "nginx_base",
digest = "sha256:662a0c5a8677063c27b0ddd42f1c801be643b9502f7b1a4e2e727cb2bc3808a8",
registry = "index.docker.io",
repository = "nginx",
tag = "stable-alpine",
digest = "sha256:0340d329672fb3f0192754e4e1ccd7518ecc83f6644e8f0c317012bbc4d06d24",
registry = "ghcr.io",
repository = "airyhq/frontend/nginx-lua",
tag = "1.0.0",
)

load(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ ResponseEntity<?> disconnect(@RequestBody @Valid ChannelDisconnectRequestPayload
}

if (channel.getConnectionState().equals(ChannelConnectionState.DISCONNECTED)) {
return ResponseEntity.accepted().build();
return ResponseEntity.accepted().body(new EmptyResponsePayload());
}

channel.setConnectionState(ChannelConnectionState.DISCONNECTED);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package co.airy.core.api.config;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ClientConfigController {
private final ServiceDiscovery serviceDiscovery;

public ClientConfigController(ServiceDiscovery serviceDiscovery) {
this.serviceDiscovery = serviceDiscovery;
}

@PostMapping("/client.config")
public ResponseEntity<ClientConfigResponsePayload> getConfig() {
return ResponseEntity.ok(ClientConfigResponsePayload.builder()
.components(serviceDiscovery.getComponents())
.features(Map.of())
.build());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package co.airy.core.api.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClientConfigResponsePayload {
private Map<String, Map<String, Object>> components;
private Map<String, String> features;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.airy.core.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

@EnableScheduling
@Configuration
public class ClientControllerConfig {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package co.airy.core.api.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class ServiceDiscovery {
private final String namespace;
private final RestTemplate restTemplate;

private final Map<String, Map<String, Object>> components = new ConcurrentHashMap<>();

private static final List<String> services = List.of(
"sources-chatplugin",
"sources-facebook-connector",
"sources-twilio-connector",
"sources-google-connector"
);

public ServiceDiscovery(@Value("${kubernetes.namespace}") String namespace, RestTemplate restTemplate) {
this.namespace = namespace;
this.restTemplate = restTemplate;
}

public Map<String, Map<String, Object>> getComponents() {
return components;
}

@Scheduled(fixedRate = 1_000)
private void updateComponentsStatus() {
for (String service : services) {
try {
ResponseEntity<Object> response = restTemplate.exchange(String.format("http://%s.%s/actuator/health", service, namespace), HttpMethod.GET, null, Object.class);
components.put(service.replace("-connector", ""), Map.of("enabled", response.getStatusCode().is2xxSuccessful()));
} catch (Exception e) {
components.put(service.replace("-connector", ""), Map.of("enabled",false));
}
}
}
}
Loading

0 comments on commit c1663cd

Please sign in to comment.