-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(console): console preview environment (#3891)
Builds the console (`@wingconsole/app`) and deploys it to fly.io on every pr (if its not from a fork). ## Checklist - [X] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted) - [X] Description explains motivation and solution - [ ] Tests added (always) - [ ] Docs updated (only required for features) - [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing *By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
- Loading branch information
Showing
6 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Delete Console Preview | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
FLY_VERSION: "0.1.80" | ||
APP_NAME: wing-console-pr-${{github.event.number}} | ||
|
||
jobs: | ||
destroy: | ||
name: "Destroy" | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && !startsWith(github.head_ref, 'mergify/merge-queue/') }} | ||
steps: | ||
- name: Install flyctl | ||
uses: superfly/flyctl-actions/setup-flyctl@1.4 | ||
with: | ||
version: ${{env.FLY_VERSION}} | ||
|
||
- name: Delete preview environment | ||
run: | | ||
if flyctl status --app "$APP_NAME"; then | ||
flyctl apps destroy "$APP_NAME" -y | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:18.16.0-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY dist dist | ||
COPY apps/wing-console/console/app/preview/index.mjs dist/ | ||
COPY apps/wing-console/console/app/demo demo | ||
|
||
RUN npm init -y && npm install --no-package-lock ./dist/*-[0-9]*.[0-9]*.[0-9]*.tgz | ||
|
||
ENTRYPOINT ["node", "dist/index.mjs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
primary_region = "lhr" | ||
|
||
[build] | ||
dockerfile = "Dockerfile" | ||
ignorefile = ".dockerignore" | ||
|
||
[[services]] | ||
protocol = "tcp" | ||
internal_port = 3000 | ||
auto_stop_machines = false | ||
auto_start_machines = false | ||
min_machines_running = 1 | ||
|
||
[services.concurrency] | ||
hard_limit = 250 | ||
soft_limit = 200 | ||
type = "connections" | ||
|
||
[[services.ports]] | ||
port = 80 | ||
handlers = ["http"] | ||
|
||
[[services.ports]] | ||
port = 443 | ||
handlers = ["tls", "http"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { fileURLToPath } from "node:url"; | ||
import { createConsoleApp } from "@wingconsole/app"; | ||
|
||
await createConsoleApp({ | ||
wingfile: fileURLToPath(new URL("../demo/index.w", import.meta.url)), | ||
requestedPort: 3000, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters