Skip to content

Commit 415a0d2

Browse files
authored
Merge pull request #29 from JakePartusch/feature/oai-private-s3
feat(experimental): Add support for using a private S3 bucket
2 parents ab0b362 + 8e546bf commit 415a0d2

File tree

21 files changed

+13730
-455
lines changed

21 files changed

+13730
-455
lines changed

.github/workflows/pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,23 @@ jobs:
6161
- run: lerna run prepack
6262
- run: cd examples/gatsby && yarn install && yarn build
6363
- run: yarn sui deploy --compiled-build --dir="examples/gatsby/public"
64+
deploy-privateS3-preview:
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@v2
69+
- name: Use Node.js
70+
uses: actions/setup-node@v1
71+
with:
72+
node-version: "14.x"
73+
- name: Configure AWS Credentials
74+
uses: aws-actions/configure-aws-credentials@v1
75+
with:
76+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
77+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
78+
aws-region: us-west-2
79+
- run: npm install -g lerna
80+
- run: lerna bootstrap
81+
- run: lerna run prepack
82+
- run: cd examples/private-s3 && yarn install && yarn build
83+
- run: yarn sui deploy --compiled-build --dir="examples/private-s3/public"

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,24 @@
2727

2828
- **Own your code** Skip the 3rd Party services — get all of the benefits and security of a hosted AWS application, without going through a middleman. Deploy to a new AWS account, or an existing account and get up and running in five minutes!
2929

30-
## What’s In This Document
31-
32-
- [Get Up and Running in 5 Minutes](#-get-up-and-running-in-5-minutes)
33-
- [CLI Reference](#-cli-reference)
30+
## What's in this Document
31+
32+
- [What's in this Document](#whats-in-this-document)
33+
- [🚀 Get Up and Running in 5 Minutes](#-get-up-and-running-in-5-minutes)
34+
- [📖 CLI Reference](#-cli-reference)
35+
- [`deploy`](#deploy)
36+
- [Options](#options)
37+
- [Examples](#examples)
38+
- [`configure-domain`](#configure-domain)
39+
- [Options](#options-1)
40+
- [Examples](#examples-1)
41+
- [Additional Steps](#additional-steps)
3442
- [Continuous Integration](#continuous-integration)
35-
- [Advanced Use Cases](#-advanced-use-cases)
43+
- [GitHub Actions](#github-actions)
44+
- [👩‍🔬 Experimental Features](#-experimental-features)
45+
- [\_\_experimental_privateS3](#__experimental_privates3)
46+
- [👩‍💻 Advanced Use Cases](#-advanced-use-cases)
47+
- [Serverless UI Advanced Example](#serverless-ui-advanced-example)
3648
- [FAQ](#faq)
3749
- [License](#license)
3850

@@ -180,9 +192,7 @@ A minute or two after running this command, the deploy will "hang" while trying
180192

181193
Since Serverless UI is a command-line tool available via npm, it will work in almost any CI environment.
182194

183-
### Examples
184-
185-
#### GitHub Actions
195+
### GitHub Actions
186196

187197
> Note: Checkout the action in this repo for a live example https://github.com/JakePartusch/serverlessui/actions
188198

@@ -231,17 +241,29 @@ jobs:
231241
});
232242
```
233243

234-
## 👩‍🔬 Advanced Use Cases
244+
## 👩‍🔬 Experimental Features
245+
246+
In order to use experimental features, a `serverlessui.config.js` file must exist at the base of the project.
247+
248+
### \_\_experimental_privateS3
249+
250+
This experimental feature allows the configuration of a private S3 bucket — which may be desired for enhanced security. This feature can be enabled in `serverlessui.config.js`:
251+
252+
```javascript
253+
module.exports = {
254+
__experimental_privateS3: true,
255+
};
256+
```
257+
258+
## 👩‍💻 Advanced Use Cases
235259

236260
For existing serverless projects or those that may have additional CloudFormation and/or CDK infrastructure, Serverless UI provides CDK constructs for each of the cli actions:
237261

238262
```javascript
239263
import { ServerlessUI, DomainCertificate } from '@serverlessui/construct;
240264
```
241265

242-
### Examples
243-
244-
#### Serverless UI
266+
### Serverless UI Advanced Example
245267

246268
For a full-featured example, check out:
247269
https://github.com/JakePartusch/serverlessui-advanced-example

examples/private-s3/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.cache/
3+
public

examples/private-s3/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Gatsby Example Website for Serverless UI
2+
3+
This is simple Gatsby website that can be deployed with Serverless UI. We use this website for integration tests in this repository.
4+
5+
Try it yourself with:
6+
7+
```shell
8+
npm install -g @serverlessui/cli
9+
npm install
10+
npm run build
11+
sui deploy --dir="public"
12+
```
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
siteMetadata: {
3+
title: "gatsby",
4+
},
5+
plugins: [
6+
"gatsby-plugin-image",
7+
"gatsby-plugin-react-helmet",
8+
{
9+
resolve: "gatsby-plugin-manifest",
10+
options: {
11+
icon: "src/images/icon.png",
12+
},
13+
},
14+
"gatsby-plugin-sharp",
15+
"gatsby-transformer-sharp",
16+
{
17+
resolve: "gatsby-source-filesystem",
18+
options: {
19+
name: "images",
20+
path: "./src/images/",
21+
},
22+
__key: "images",
23+
},
24+
],
25+
};

examples/private-s3/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "private-s3",
3+
"version": "1.0.0",
4+
"private": true,
5+
"description": "gatsby",
6+
"author": "Jake Partusch",
7+
"keywords": [
8+
"gatsby"
9+
],
10+
"scripts": {
11+
"develop": "gatsby develop",
12+
"start": "gatsby develop",
13+
"build": "gatsby build",
14+
"serve": "gatsby serve",
15+
"clean": "gatsby clean"
16+
},
17+
"dependencies": {
18+
"gatsby": "^3.0.1",
19+
"gatsby-plugin-image": "^1.0.0",
20+
"gatsby-plugin-manifest": "^3.0.0",
21+
"gatsby-plugin-react-helmet": "^4.0.0",
22+
"gatsby-plugin-sharp": "^3.0.0",
23+
"gatsby-plugin-sitemap": "^3.0.0",
24+
"gatsby-source-filesystem": "^3.0.0",
25+
"gatsby-transformer-sharp": "^3.0.0",
26+
"react": "^17.0.1",
27+
"react-dom": "^17.0.1",
28+
"react-helmet": "^6.1.0"
29+
},
30+
"devDependencies": {}
31+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
domain: "serverlessui.app",
3+
zoneId: "Z10061011Y616GGTRN1OW",
4+
certificateArn:
5+
"arn:aws:acm:us-east-1:857786057494:certificate/be831128-bb68-4fcd-b903-4d112d8fd2cd",
6+
__experimental_privateS3: true,
7+
};
10.9 KB
Loading
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import * as React from "react"
2+
import { Link } from "gatsby"
3+
4+
// styles
5+
const pageStyles = {
6+
color: "#232129",
7+
padding: "96px",
8+
fontFamily: "-apple-system, Roboto, sans-serif, serif",
9+
}
10+
const headingStyles = {
11+
marginTop: 0,
12+
marginBottom: 64,
13+
maxWidth: 320,
14+
}
15+
16+
const paragraphStyles = {
17+
marginBottom: 48,
18+
}
19+
const codeStyles = {
20+
color: "#8A6534",
21+
padding: 4,
22+
backgroundColor: "#FFF4DB",
23+
fontSize: "1.25rem",
24+
borderRadius: 4,
25+
}
26+
27+
// markup
28+
const NotFoundPage = () => {
29+
return (
30+
<main style={pageStyles}>
31+
<title>Not found</title>
32+
<h1 style={headingStyles}>Page not found</h1>
33+
<p style={paragraphStyles}>
34+
Sorry{" "}
35+
<span role="img" aria-label="Pensive emoji">
36+
😔
37+
</span>{" "}
38+
we couldn’t find what you were looking for.
39+
<br />
40+
{process.env.NODE_ENV === "development" ? (
41+
<>
42+
<br />
43+
Try creating a page in <code style={codeStyles}>src/pages/</code>.
44+
<br />
45+
</>
46+
) : null}
47+
<br />
48+
<Link to="/">Go home</Link>.
49+
</p>
50+
</main>
51+
)
52+
}
53+
54+
export default NotFoundPage

0 commit comments

Comments
 (0)