Skip to content

Commit

Permalink
Merge branch 'release/0.43.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ljupcovangelski committed Apr 27, 2022
2 parents 1a54507 + 6132ab8 commit df65b71
Show file tree
Hide file tree
Showing 351 changed files with 3,298 additions and 1,207 deletions.
2 changes: 1 addition & 1 deletion .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_language_version=11
# Remove once annotation processing fix is released (https://github.com/bazelbuild/bazel/issues/12837)
build --nojava_header_compilation

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
5.1.1
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,17 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
GITHUB_BRANCH: ${{ github.ref }}

- name: Publish helm charts to S3
- name: Publish helm charts
if: startsWith(github.ref, 'refs/heads/release') || startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/develop')
run: |
./scripts/upload-helm-charts.sh
./scripts/push-helm-charts.sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION : ${{ secrets.AWS_REGION }}
GITHUB_BRANCH: ${{ github.ref }}
HELM_REPO_USERNAME: ${{ secrets.HELM_REPO_USERNAME }}
HELM_REPO_PASSWORD: ${{ secrets.HELM_REPO_PASSWORD }}

- name: Publish http-client library to npm
if: ${{ startsWith(github.ref, 'refs/heads/main') }}
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
build/
bazel-*
**/*/.docusaurus
**/*/sources/chatplugin/messageExamples.md


2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.42.0
0.43.0
17 changes: 12 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Airy Bazel tools
git_repository(
name = "com_github_airyhq_bazel_tools",
commit = "594a0ec552998293674edff959ce8c782683faef",
commit = "340e636d2ad91b8d9c03bb3c6d829b6d845f498e",
remote = "https://github.com/airyhq/bazel-tools.git",
shallow_since = "1649147253 +0200",
shallow_since = "1650889500 +0200",
)

load("@com_github_airyhq_bazel_tools//:repositories.bzl", "airy_bazel_tools_dependencies", "airy_jvm_deps")
Expand Down Expand Up @@ -86,9 +86,9 @@ protobuf_deps()

http_archive(
name = "io_bazel_rules_docker",
sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
strip_prefix = "rules_docker-0.23.0",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
sha256 = "59536e6ae64359b716ba9c46c39183403b01eabfbd57578e84398b4829ca499a",
strip_prefix = "rules_docker-0.22.0",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.22.0/rules_docker-v0.22.0.tar.gz"],
)

load(
Expand Down Expand Up @@ -183,3 +183,10 @@ http_archive(
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

### Helm
load("@com_github_airyhq_bazel_tools//helm:helm.bzl", "helm_tool")

helm_tool(
name = "helm_binary",
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,34 @@
import co.airy.spring.auth.PrincipalAccess;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

@RestController
public class ClientConfigController {
private final ServiceDiscovery serviceDiscovery;
private final PrincipalAccess principalAccess;
private final JsonNode tagConfig;
private final String clusterVersion;

public ClientConfigController(ServiceDiscovery serviceDiscovery, PrincipalAccess principalAccess) throws IOException {
public ClientConfigController(ServiceDiscovery serviceDiscovery, PrincipalAccess principalAccess, @Value("classpath:VERSION") Resource version) throws IOException {
this.serviceDiscovery = serviceDiscovery;
this.principalAccess = principalAccess;
final String tagConfigResource = StreamUtils.copyToString(getClass().getClassLoader().getResourceAsStream("tagConfig.json"), StandardCharsets.UTF_8);
this.tagConfig = new ObjectMapper().readTree(tagConfigResource);
try (InputStream is = version.getInputStream()) {
clusterVersion = StreamUtils.copyToString(is, StandardCharsets.UTF_8);
;
}
}

@PostMapping("/client.config")
Expand All @@ -32,6 +40,7 @@ public ResponseEntity<ClientConfigResponsePayload> getConfig(Authentication auth
.services(serviceDiscovery.getServices())
.userProfile(principalAccess.getUserProfile(auth))
.tagConfig(tagConfig)
.clusterVersion(clusterVersion)
.build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ public class ClientConfigResponsePayload {
private Map<String, ServiceInfo> services;
private UserProfile userProfile;
private JsonNode tagConfig;
private String clusterVersion;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.InjectMocks;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
Expand Down Expand Up @@ -50,9 +49,6 @@ public class ClientConfigControllerTest {

private MockRestServiceServer mockServer;

@InjectMocks
private ClientConfigController configController;

@Autowired
private WebTestHelper webTestHelper;

Expand Down
2 changes: 1 addition & 1 deletion bazel.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"./*"
],
"handles": [
"./frontend/ui/handles"
"./frontend/inbox/handles"
],
"chat-plugin-handles": [
"./frontend/chat-plugin/handles"
Expand Down
4 changes: 2 additions & 2 deletions cli/pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (h *Helm) Setup() error {
}

func (h *Helm) InstallCharts() error {
chartURL := "https://airy-core-helm-charts.s3.amazonaws.com/stable/airy-" + h.version + ".tgz"
chartURL := "https://helm.airy.co/charts/airy-" + h.version + ".tgz"
return h.runHelm(append([]string{"install",
"--values", "/apps/config/airy-config-map.yaml",
"--namespace", h.namespace,
Expand All @@ -88,7 +88,7 @@ func (h *Helm) InstallCharts() error {
}

func (h *Helm) UpgradeCharts() error {
chartURL := "https://airy-core-helm-charts.s3.amazonaws.com/stable/airy-" + h.version + ".tgz"
chartURL := "https://helm.airy.co/charts/airy-" + h.version + ".tgz"
return h.runHelm(append([]string{"upgrade",
"--values", "/apps/config/airy-config-map.yaml",
"--namespace", h.namespace,
Expand Down
30 changes: 2 additions & 28 deletions docs/docs/api/endpoints/channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,35 +110,9 @@ Update a channel's name or image URL.

### Airy Live Chat Plugin

Connects a Chat Plugin source to Airy Core.
import ConnectChatPlugin from './connect-chatPlugin.mdx'

```
POST /channels.chatplugin.connect
```

- `name` is a unique identifier of your choice.

```json5
{
"name": "website-identifier-42",
"image_url": "http://example.org/plugin_icon.jpeg" // optional
}
```

**Sample response**

```json5
{
"id": "1f679227-76c2-4302-bb12-703b2adb0f66",
"source": "chatplugin",
"source_channel_id": "website-identifier-42",
"metadata": {
"name": "website-identifier-42",
"image_url": "http://example.org/plugin_icon.jpeg" // optional
},
"connected": true
}
```
<ConnectChatPlugin />

### Facebook

Expand Down
158 changes: 158 additions & 0 deletions docs/docs/api/endpoints/client-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
title: Client Config
sidebar_label: Client Config
---

The `config.client` endpoint responds with the configuration for an instance’s services, user profile, and tags.

The `services` property in the response gives the status of the instance’s components and reflects the [airy.yaml configuration file](/getting-started/installation/configuration). For example, [contacts](contacts) is an optional feature that can be enabled in the [airy.yaml configuration file](/getting-started/installation/configuration). If [contacts](contacts) is enabled (i.e. the `integration.contacts.enabled` field is marked as `true` in the [airy.yaml configuration file](/getting-started/installation/configuration)), the `config.client` endpoint will mark the component `api-contacts` as `enabled` in its response.

[Authentication is disabled by default in Airy Core](/api/introduction), thus the `user_profile` property in the response is by default `null`. If the instance features authentification, the `user_profile` property will include information about the user that is currently logged in.

The `tag_config` property in the response represents the configuration for [tags](/ui/inbox/tags). The [Inbox UI](/ui/inbox/introduction) uses these settings for the [tags](/ui/inbox/tags)' default styling.

`POST /client.config`

**Sample request**

```json5
{}
```

**Sample Response**

```json5
{
"cluster_version": "0.42.0",
"services": {
"frontend-ui": {
"enabled": true,
"healthy": true,
"component": "frontend-ui"
},
"source-api": {
"enabled": true,
"healthy": true,
"component": "integration-source-api"
},
"sources-google-connector": {
"enabled": true,
"healthy": true,
"component": "sources-google"
},
"sources-viber-connector": {
"enabled": false,
"healthy": false,
"component": "sources-viber"
},
"webhook-publisher": {
"enabled": true,
"healthy": true,
"component": "integration-webhook"
},
"api-contacts": {
"enabled": true,
"healthy": true,
"component": "api-contacts"
},
"sources-google-events-router": {
"enabled": true,
"healthy": false,
"component": "sources-google"
},
"sources-viber-events-router": {
"enabled": false,
"healthy": false,
"component": "sources-viber"
},
"api-communication": {
"enabled": true,
"healthy": true,
"component": "api-communication"
},
"sources-facebook-events-router": {
"enabled": true,
"healthy": false,
"component": "sources-facebook"
},
"media-resolver": {
"enabled": true,
"healthy": true,
"component": "media-resolver"
},
"webhook-consumer": {
"enabled": true,
"healthy": true,
"component": "integration-webhook"
},
"sources-twilio-connector": {
"enabled": true,
"healthy": true,
"component": "sources-twilio"
},
"sources-chatplugin": {
"enabled": true,
"healthy": true,
"component": "sources-chat-plugin"
},
"sources-twilio-events-router": {
"enabled": true,
"healthy": false,
"component": "sources-twilio"
},
"api-admin": {
"enabled": true,
"healthy": false,
"component": "api-admin"
},
"api-websocket": {
"enabled": true,
"healthy": true,
"component": "api-websocket"
},
"frontend-chat-plugin": {
"enabled": true,
"healthy": true,
"component": "sources-chat-plugin"
},
"sources-facebook-connector": {
"enabled": true,
"healthy": true,
"component": "sources-facebook"
}
},
"user_profile": null,
"tag_config": {
"colors": {
"tag-green": {
"default": "0E764F",
"background": "F5FFFB",
"font": "0E764F",
"position": 3,
"border": "0E764F"
},
"tag-blue": {
"default": "1578D4",
"background": "F5FFFB",
"font": "1578D4",
"position": 1,
"border": "1578D4"
},
"tag-red": {
"default": "E0243A",
"background": "FFF7F9",
"font": "E0243A",
"position": 2,
"border": "E0243A"
},
"tag-purple": {
"default": "730A80",
"background": "FEF7FF",
"font": "730A80",
"position": 4,
"border": "730A80"
}
}
}
}
```
Loading

0 comments on commit df65b71

Please sign in to comment.