Skip to content

Commit fe0c4aa

Browse files
tjholmHomelessDinosaurdavemooreuwsjyecusch
authored
feat!: v1 (#584)
Co-authored-by: Tim Holm <[email protected]> Co-authored-by: Tim Holm <[email protected]> Co-authored-by: Jye Cusch <[email protected]> Co-authored-by: Ryan Cartwright <[email protected]> Co-authored-by: David Moore <[email protected]> Co-authored-by: Tim Holm <[email protected]> * ci: Update go version for new std libs. (#552) * add rates support (#551) * fix: websocket handlers are not cleaned up (#554) Co-authored-by: David Moore <[email protected]> * fix: azure deployments (#555) * fix gcp deployments (#553) * fix schedules and topics clean up (#556) fix: schedules and topics not cleaned up * feat: Update cloud implementations for v1 (#558) Co-authored-by: Tim Holm <[email protected]> Co-authored-by: Jye Cusch <[email protected]> * Documents -> KV (#549) Co-authored-by: Jye Cusch <[email protected]> * Add logic to support resource tree for pulumi destroy (#559) * separate engine event handler methods. * add missing returns. * debug statements. * build nitric parents ahead of time. * Ensure image shows up in progress for nitric up. * fix check for http server not registered (#564) * v1 azure fixes (#562) * common logger (#563) * wip * fix error on redeploy of torn down aws stacks * shared logger * move logger to core * v1 queues * remove redundant log output (#568) * add results outputs (#567) return endpoints for API, HTTP Proxies and Websockets. * Http Proxy Bidi stream * include queues in default order * fix aws runtime issues * fix aws http proxy routing * fix gcp runtime issues. (#571) * normalize http proxy gateway names. * add delete permission to write to allow overwriting. * fix topicname in subscription push endpoints. * add missing project configuration to pre * cleanup * gcp deployment fixes. * AWS schedule and ws fixes * deploy websockets and schedules * improve missing resource error * fix delete replaced status mapping * fix aws ws deployments and output * azure fixes (#574) Co-authored-by: Rak Siva <[email protected]> * azure fixes additional azure fixes and cleanup * update pulumi sdk (#576) * prevent panics from missing pulumi events. (#578) * make pulumi refresh configurable. (#577) * allow multiple deployment result types. (#581) * allow multiple deployment result types. * change simple -> text. * missing httpproxy for gcp provider (#580) * linting and test updates. (#579) * contract renaming (#583) Co-authored-by: Jye Cusch <[email protected]> * remove references to develop branch (#585) * fix debug provider * improve error output (#586) --------- Co-authored-by: Ryan Cartwright <[email protected]> Co-authored-by: David Moore <[email protected]> Co-authored-by: Jye Cusch <[email protected]> Co-authored-by: David Moore <[email protected]> Co-authored-by: David Moore <[email protected]> Co-authored-by: Jye Cusch <[email protected]>
1 parent 2029ab3 commit fe0c4aa

File tree

400 files changed

+31083
-58830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

400 files changed

+31083
-58830
lines changed

.github/workflows/publish-aws.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.19
25+
go-version: 1.21.6
2626
- name: Setup Golang caches
2727
uses: actions/cache@v3
2828
with:

.github/workflows/publish-azure.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.19
25+
go-version: 1.21.6
2626
- name: Setup Golang caches
2727
uses: actions/cache@v3
2828
with:

.github/workflows/publish-contracts.yaml

+4-10
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@ jobs:
1414
- name: Checkout
1515
uses: actions/checkout@v2
1616

17-
# Add validate contract to the released contracts
18-
- name: Download validate contract
19-
run: |
20-
mkdir -p ./contracts/validate
21-
curl https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/v0.6.1/validate/validate.proto --output ./contracts/validate/validate.proto
22-
2317
# Tarball the contracts repository
2418
- name: Archive Release
2519
uses: thedoctor0/zip-release@master
2620
with:
2721
type: 'tar'
28-
filename: 'contracts.tgz'
29-
path: contracts
22+
filename: 'proto.tgz'
23+
path: nitric
3024

3125
# Upload contract tarball to the releases
3226
- name: Upload Contracts
@@ -35,7 +29,7 @@ jobs:
3529
GITHUB_TOKEN: ${{ secrets.NITRIC_BOT_TOKEN }}
3630
with:
3731
upload_url: ${{ github.event.release.upload_url }}
38-
asset_path: ./contracts.tgz
39-
asset_name: contracts.tgz
32+
asset_path: ./proto.tgz
33+
asset_name: proto.tgz
4034
asset_content_type: application/tar+gzip
4135

.github/workflows/publish-gcp.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.19
25+
go-version: 1.21.6
2626
- name: Setup Golang caches
2727
uses: actions/cache@v3
2828
with:

.github/workflows/release-rc.yaml

-44
This file was deleted.

.github/workflows/test.yaml

+2-28
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
- develop
87
pull_request:
98

109
jobs:
@@ -18,7 +17,7 @@ jobs:
1817
- name: Setup Go
1918
uses: actions/setup-go@v2
2019
with:
21-
go-version: 1.20.4
20+
go-version: 1.21.6
2221
- name: Setup Golang caches
2322
uses: actions/cache@v3
2423
with:
@@ -40,7 +39,7 @@ jobs:
4039
- name: Setup Go
4140
uses: actions/setup-go@v2
4241
with:
43-
go-version: 1.20.4
42+
go-version: 1.21.6
4443
- name: Setup Golang caches
4544
uses: actions/cache@v3
4645
with:
@@ -90,28 +89,3 @@ jobs:
9089
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
9190
files: ./cloud/azure/all.coverprofile
9291
flags: azure # optional
93-
94-
95-
# Run integration tests
96-
test-integration:
97-
runs-on: ubuntu-latest
98-
env:
99-
GOPATH: /home/runner/go
100-
steps:
101-
- name: Checkout
102-
uses: actions/checkout@v2
103-
- name: Setup Go
104-
uses: actions/setup-go@v2
105-
with:
106-
go-version: 1.20.4
107-
- name: Setup Golang caches
108-
uses: actions/cache@v3
109-
with:
110-
path: |
111-
~/.cache/go-build
112-
~/go/pkg/mod
113-
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
114-
restore-keys: |
115-
${{ runner.os }}-golang-
116-
- name: Run Integration Tests
117-
run: make test-integration

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ lint: $(all)
2626
$(MAKE) lint -C $$dir || exit 1; \
2727
done
2828

29-
test-integration:
30-
@echo Running integration tests
31-
@cd ./e2e && make
32-
29+
.PHONY: test
3330
test: $(all)
3431
for dir in $(all); do \
3532
$(MAKE) test -C $$dir || exit 1; \

cloud/aws/Makefile

+9-6
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@ sec:
1717
# More binaries can be distributed in future if required
1818
runtimebin:
1919
@echo Building AWS Runtime Server
20-
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/runtime-aws -ldflags="-s -w -extldflags=-static" ./runtime/cmd
20+
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/runtime-aws -ldflags="-s -w -extldflags=-static" ./cmd/runtime
2121

2222
predeploybin: runtimebin
2323
@cp bin/runtime-aws deploy/runtime-aws
2424

25-
# FIXME: proto server registration error
26-
# There appears to be an old namespace conflict with the protobuf definitions
2725
deploybin: predeploybin
2826
@echo Building AWS Deployment Server
29-
@CGO_ENABLED=0 go build -o bin/deploy-aws -ldflags="-s -w -extldflags=-static" -ldflags="-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore" ./deploy/cmd
27+
@CGO_ENABLED=0 go build -o bin/deploy-aws -ldflags="-s -w -extldflags=-static" -ldflags="-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore" ./cmd/deploy
3028
@rm deploy/runtime-aws
3129

3230
.PHONY: install
3331
install: deploybin
3432
@echo installing aws deployment server to ${HOME}/.nitric/providers/nitric/aws-0.0.1
3533
@mkdir -p ${HOME}/.nitric/providers/nitric/
34+
@rm -f ${HOME}/.nitric/providers/nitric/aws-0.0.1
3635
@cp bin/deploy-aws ${HOME}/.nitric/providers/nitric/aws-0.0.1
3736

3837
license-check: runtimebin
@@ -61,7 +60,11 @@ test-coverage: generate-mocks
6160
@echo Running unit tests
6261
@go run github.com/onsi/ginkgo/ginkgo -cover -outputdir=./ -coverprofile=all.coverprofile ./runtime/...
6362

64-
generate-mocks:
63+
64+
clean-mocks:
65+
@rm -rf ./mocks
66+
67+
generate-mocks: clean-mocks
6568
@echo Generating Mock Clients
6669
@mkdir -p mocks/secrets_manager
6770
@mkdir -p mocks/s3
@@ -76,6 +79,6 @@ generate-mocks:
7679
@go run github.com/golang/mock/mockgen github.com/nitrictech/nitric/cloud/aws/ifaces/secretsmanageriface SecretsManagerAPI > mocks/secrets_manager/mock.go
7780
@go run github.com/golang/mock/mockgen github.com/nitrictech/nitric/cloud/aws/ifaces/s3iface S3API,PreSignAPI > mocks/s3/mock.go
7881
@go run github.com/golang/mock/mockgen github.com/nitrictech/nitric/cloud/aws/ifaces/sqsiface SQSAPI > mocks/sqs/mock.go
79-
@go run github.com/golang/mock/mockgen github.com/nitrictech/nitric/cloud/aws/runtime/core AwsProvider > mocks/provider/aws.go
82+
@go run github.com/golang/mock/mockgen github.com/nitrictech/nitric/cloud/aws/runtime/resource AwsResourceProvider > mocks/provider/aws.go
8083

8184
generate-sources: generate-mocks

cloud/aws/deploy/cmd/main.go cloud/aws/cmd/deploy/main.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
package main
1818

1919
import (
20-
"log"
21-
2220
"github.com/nitrictech/nitric/cloud/aws/deploy"
23-
commondeploy "github.com/nitrictech/nitric/cloud/common/deploy"
21+
"github.com/nitrictech/nitric/cloud/common/deploy/provider"
2422
)
2523

2624
// Start the deployment server
2725
func main() {
28-
deploySrv, err := deploy.NewServer()
29-
if err != nil {
30-
log.Fatalf("error creating deployment server %v", err)
31-
}
26+
awsStack := deploy.NewNitricAwsProvider()
27+
28+
providerServer := provider.NewPulumiProviderServer(awsStack)
3229

33-
commondeploy.StartServer(deploySrv)
30+
providerServer.Start()
3431
}

cloud/aws/cmd/runtime/README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Nitric plugins for AWS
2+
3+
## Development
4+
5+
### Requirements
6+
- Git
7+
- Nitric Membrane Project
8+
- Golang
9+
- Make
10+
- Docker
11+
12+
### Getting Started
13+
14+
### Building Static Membrane Image
15+
From the repository root run
16+
```bash
17+
make aws-docker-static
18+
```
19+
20+
### Building Plugin Images
21+
22+
> __Note:__ Prior to building these plugins, the nitric pluggable membrane image must be built for local development
23+
24+
25+
Alpine Linux
26+
```bash
27+
make aws-docker-alpine
28+
```
29+
30+
Debian
31+
```bash
32+
make aws-docker-debian
33+
```
34+
35+
> __Note:__ Separate distributions required between glibc/musl as dynamic linker is used for golang plugin support
36+
37+

cloud/aws/cmd/runtime/main.go

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright 2021 Nitric Pty Ltd.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package main
16+
17+
import (
18+
"os"
19+
"os/signal"
20+
"syscall"
21+
22+
"github.com/nitrictech/nitric/cloud/aws/runtime/api"
23+
"github.com/nitrictech/nitric/cloud/aws/runtime/env"
24+
lambda_service "github.com/nitrictech/nitric/cloud/aws/runtime/gateway"
25+
dynamodb_service "github.com/nitrictech/nitric/cloud/aws/runtime/keyvalue"
26+
sqs_service "github.com/nitrictech/nitric/cloud/aws/runtime/queue"
27+
"github.com/nitrictech/nitric/cloud/aws/runtime/resource"
28+
secrets_manager_secret_service "github.com/nitrictech/nitric/cloud/aws/runtime/secret"
29+
s3_service "github.com/nitrictech/nitric/cloud/aws/runtime/storage"
30+
sns_service "github.com/nitrictech/nitric/cloud/aws/runtime/topic"
31+
"github.com/nitrictech/nitric/cloud/aws/runtime/websocket"
32+
base_http "github.com/nitrictech/nitric/cloud/common/runtime/gateway"
33+
"github.com/nitrictech/nitric/core/pkg/logger"
34+
"github.com/nitrictech/nitric/core/pkg/membrane"
35+
)
36+
37+
func main() {
38+
term := make(chan os.Signal, 1)
39+
signal.Notify(term, os.Interrupt, syscall.SIGTERM)
40+
signal.Notify(term, os.Interrupt, syscall.SIGINT)
41+
42+
logger.SetLogLevel(logger.INFO)
43+
44+
gatewayEnv := env.GATEWAY_ENVIRONMENT.String()
45+
46+
membraneOpts := membrane.DefaultMembraneOptions()
47+
48+
provider, err := resource.New()
49+
if err != nil {
50+
logger.Fatalf("could not create aws provider: %v", err)
51+
return
52+
}
53+
54+
// Load the appropriate gateway based on the environment.
55+
switch gatewayEnv {
56+
case "lambda":
57+
membraneOpts.GatewayPlugin, _ = lambda_service.New(provider)
58+
default:
59+
membraneOpts.GatewayPlugin, _ = base_http.NewHttpGateway(nil)
60+
}
61+
62+
membraneOpts.ApiPlugin = api.NewAwsApiGatewayProvider(provider)
63+
membraneOpts.SecretManagerPlugin, _ = secrets_manager_secret_service.New(provider)
64+
membraneOpts.KeyValuePlugin, _ = dynamodb_service.New(provider)
65+
membraneOpts.TopicsPlugin, _ = sns_service.New(provider)
66+
membraneOpts.StoragePlugin, _ = s3_service.New(provider)
67+
membraneOpts.ResourcesPlugin = provider
68+
membraneOpts.WebsocketPlugin, _ = websocket.NewAwsApiGatewayWebsocket(provider)
69+
membraneOpts.QueuesPlugin, _ = sqs_service.New(provider)
70+
71+
m, err := membrane.New(membraneOpts)
72+
if err != nil {
73+
logger.Fatalf("There was an error initializing the membrane server: %v", err)
74+
}
75+
76+
errChan := make(chan error)
77+
// Start the Membrane server
78+
go func(chan error) {
79+
errChan <- m.Start()
80+
}(errChan)
81+
82+
select {
83+
case membraneError := <-errChan:
84+
logger.Errorf("Membrane Error: %v, exiting\n", membraneError)
85+
case sigTerm := <-term:
86+
logger.Infof("Received %v, exiting\n", sigTerm)
87+
}
88+
89+
m.Stop()
90+
}

cloud/aws/deploy/config/api.go cloud/aws/common/const.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
package config
17+
package common
1818

19-
type ApiConfig struct {
20-
Domains []string
21-
}
19+
const (
20+
// DefaultWsStageName - Also used to connect to the ws, e.g. wss://<api-id>.execute-api.<region>.amazonaws.com/<stage>
21+
DefaultWsStageName = "ws"
22+
)

0 commit comments

Comments
 (0)