Skip to content

Commit

Permalink
feat(web): remove web-server and change web to a static website deplo…
Browse files Browse the repository at this point in the history
…yment (#1360)

* feat(web): add deploying static app

* fix(web): linter ignore patterns

* fix(web): cloudfront invalidation and favicons placement

* feat(web-server): remove web-server package in favour of web

* fix(web): remove linter parallel jobs due to oom issue

* fix(mobile): eslintignore paths

* fix(web): copy of components

* fix(web): include building components in building all process

* fix(web): copying of components
  • Loading branch information
Karol Sójko committed Aug 3, 2022
1 parent 3116ae3 commit 483cac9
Show file tree
Hide file tree
Showing 110 changed files with 87 additions and 2,762 deletions.
15 changes: 0 additions & 15 deletions .dockerignore

This file was deleted.

8 changes: 0 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,6 @@ updates:
- "moughxyz"
- "karolsojko"

- package-ecosystem: "bundler"
directory: "/packages/web-server"
schedule:
interval: "daily"
reviewers:
- "moughxyz"
- "karolsojko"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install --immutable
- name: Build
Expand Down
80 changes: 30 additions & 50 deletions .github/workflows/web.release.prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Web Server Deploy
name: Web Deploy

concurrency:
group: prod_environment
Expand All @@ -7,72 +7,52 @@ concurrency:
on:
push:
tags:
- '*standardnotes/*web-server*'
- '!*standardnotes/*web-server*beta*'
- '!*standardnotes/*web-server*alpha*'
- '*standardnotes/*web*'
- '!*standardnotes/*web*beta*'
- '!*standardnotes/*web*alpha*'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install dependencies
run: yarn install
run: yarn install --immutable
- name: Build
run: yarn build:web-server
run: yarn build:web
- name: ESLint
run: yarn lint
- name: Test
run: yarn test

deploy:
runs-on: ubuntu-latest

needs: test

steps:
- uses: actions/checkout@v3

- name: Copy robots.txt
run: cp packages/web-server/public/robots.txt.production packages/web-server/public/robots.txt

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "stable,${{ github.sha }}"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition app-prod --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: app-prod
image: "standardnotes/web:${{ github.sha }}"
runs-on: ubuntu-latest

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: app-prod
cluster: prod
wait-for-service-stability: true
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build:web
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy static site to S3 bucket
run: aws s3 sync packages/web/dist/ s3://app-static.standardnotes.com --delete
- name: Invalidate CloudFront Cache
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.WEBAPP_CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: '/*'
AWS_REGION: 'us-east-1'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

notify_discord:
needs: deploy
Expand Down
83 changes: 0 additions & 83 deletions .github/workflows/web.release.test.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/webserver.pr.yml

This file was deleted.

1 change: 0 additions & 1 deletion .yarn/versions/eee2d91d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ undecided:
- "@standardnotes/mobile"
- "@standardnotes/styles"
- "@standardnotes/toast"
- "@standardnotes/web-server"
- "@standardnotes/advanced-checklist"
- "@standardnotes/markdown-visual"
- "@standardnotes/autobiography-theme"
Expand Down
35 changes: 0 additions & 35 deletions Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions docker-compose.yml

This file was deleted.

32 changes: 0 additions & 32 deletions docker/entrypoint.sh

This file was deleted.

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@
"node": ">=12.19.0 <17.0.0"
},
"scripts": {
"lint": "yarn workspaces foreach -pt --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run lint",
"test": "yarn workspaces foreach -pt --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run test",
"lint": "yarn workspaces foreach -t --jobs 10 --verbose --exclude @standardnotes/components-meta run lint",
"test": "yarn workspaces foreach -pt --jobs 10 --verbose --exclude @standardnotes/components-meta run test",
"clean": "lerna run clean",
"build:all": "yarn workspaces foreach -pt --verbose --exclude '{@standardnotes/components-meta,@standardnotes/docs}' run build",
"build:all": "yarn workspaces foreach -pt --verbose --exclude '{@standardnotes/docs}' run build",
"build:components": "yarn workspaces foreach -pt --verbose --interlaced -R --from @standardnotes/components-meta run build",
"build:web": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/web --exclude @standardnotes/components-meta run build",
"build:desktop": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/desktop --exclude @standardnotes/components-meta run build",
"build:mobile": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/mobile --exclude @standardnotes/components-meta run build",
"build:web-server": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/web-server --exclude @standardnotes/components-meta run build",
"build:snjs": "yarn workspaces foreach -pt --verbose -R --from @standardnotes/snjs --exclude @standardnotes/components-meta run build",
"start:server:web": "lerna run start --scope=@standardnotes/web-server",
"start:server:web:localhost": "lerna run start:no-binding --scope=@standardnotes/web-server",
"start:server:web": "lerna run start --scope=@standardnotes/web",
"start:server:e2e": "lerna run start:test-server --scope=@standardnotes/snjs",
"prepare": "husky install",
"reset": "find . -type dir -name node_modules | xargs rm -rf && rm -rf yarn.lock && yarn install",
Expand Down
3 changes: 3 additions & 0 deletions packages/mobile/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
metro.config.js
packages/mobile/html/Web.bundle/src/components
packages/mobile/html/Web.bundle/src/web-src
3 changes: 1 addition & 2 deletions packages/mobile/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
"@typescript-eslint/no-var-requires": "off",
"eqeqeq": ["off"],
"no-void": ["off"]
},
"ignorePatterns": ["metro.config.js"]
}
}
2 changes: 0 additions & 2 deletions packages/web-server/.bundle/config

This file was deleted.

0 comments on commit 483cac9

Please sign in to comment.