Merge branch 'release/1.0.0'

This commit is contained in:
Karol Sójko
2020-07-03 09:08:19 +02:00
17 changed files with 141 additions and 20 deletions

60
.github/workflows/dev.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Dev
on:
push:
branches: [ develop ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: standardnotes/web
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest,${{ 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-dev --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-dev
image: "standardnotes/web:${{ github.sha }}"
- 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-dev
cluster: dev
wait-for-service-stability: true
notify_slack:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Notify slack
uses: pullreminders/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
args: '{ \"channel\": \"${{ secrets.SLACK_NOTIFICATION_CHANNEL }}\", \"blocks\": [{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"Successfully deployed <https://app-dev.standardnotes.org|[DEV] Web App>\"}}, {\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"Changes: <https://github.com/standardnotes/web/commit/${{ github.sha }}|${{ github.sha }}>\"}, \"accessory\": {\"type\": \"image\", \"image_url\": \"https://website-dev.standardnotes.org/assets/icon.png\", \"alt_text\": \"Standard Notes\"}}, { \"type\": \"section\", \"fields\": [{\"type\": \"mrkdwn\", \"text\": \"<https://github.com/standardnotes/web/actions/runs/${{ github.run_id }}|Build details>\"}]}]}'

60
.github/workflows/prod.yml vendored Normal file
View File

@@ -0,0 +1,60 @@
name: Prod
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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 }}"
- 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
notify_slack:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Notify slack
uses: pullreminders/slack-action@master
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
args: '{ \"channel\": \"${{ secrets.SLACK_NOTIFICATION_CHANNEL }}\", \"blocks\": [{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"Successfully deployed <https://app-prod.standardnotes.org|[PROD] Web App>\"}}, {\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"Changes: <https://github.com/standardnotes/web/commit/${{ github.sha }}|${{ github.sha }}>\"}, \"accessory\": {\"type\": \"image\", \"image_url\": \"https://website-dev.standardnotes.org/assets/icon.png\", \"alt_text\": \"Standard Notes\"}}, { \"type\": \"section\", \"fields\": [{\"type\": \"mrkdwn\", \"text\": \"<https://github.com/standardnotes/web/actions/runs/${{ github.run_id }}|Build details>\"}]}]}'

View File

@@ -6,7 +6,7 @@
# Set up Nginx to terminate SSL with LetsEncrypt and proxy_pass to http://localhost:3000/
###
FROM ruby:alpine
FROM ruby:2.7.1-alpine
RUN apk add --update --no-cache \
alpine-sdk \
@@ -34,15 +34,8 @@ COPY . /app/
# Leave RAILS_SERVE_STATIC_FILES commented if Nginx/Apache will serve static files instead of rails.
###
RUN bundle install
RUN npm install
RUN npm run build
# Uncomment the line below for production:
# RUN bundle exec rake assets:precompile
EXPOSE 3000
ENTRYPOINT [ "./docker/entrypoint" ]

View File

@@ -96,13 +96,13 @@ GEM
net-ssh (>= 2.6.5, < 6.0.0)
net-ssh (5.2.0)
nio4r (2.5.2)
nokogiri (1.10.7)
nokogiri (1.10.8)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.7-x64-mingw32)
nokogiri (1.10.8-x64-mingw32)
mini_portile2 (~> 2.4.0)
non-stupid-digest-assets (1.0.9)
sprockets (>= 2.0)
puma (4.3.1)
puma (4.3.5)
nio4r (~> 2.0)
rack (2.1.2)
rack-cors (1.1.1)

View File

@@ -13,8 +13,8 @@
*/
@font-face {
font-family: "Ionicons";
src: url("../fonts/ionicons.eot?v=2.0.0");
src: url("../fonts/ionicons.eot?v=2.0.1#iefix") format("embedded-opentype"), url("../fonts/ionicons.ttf?v=2.0.1") format("truetype"), url("../fonts/ionicons.woff?v=2.0.1") format("woff"), url("../fonts/ionicons.svg?v=2.0.1#Ionicons") format("svg");
src: url("/assets/fonts/ionicons.eot?v=2.0.0");
src: url("/assets/fonts/ionicons.eot?v=2.0.1#iefix") format("embedded-opentype"), url("/assets/fonts/ionicons.ttf?v=2.0.1") format("truetype"), url("/assets/fonts/ionicons.woff?v=2.0.1") format("woff"), url("/assets/fonts/ionicons.svg?v=2.0.1#Ionicons") format("svg");
font-weight: normal;
font-style: normal;
}

View File

@@ -89,7 +89,7 @@ iframe(
ng-attr-id='component-iframe-{{ctrl.component.uuid}}',
ng-if='ctrl.component && ctrl.componentValid',
ng-src='{{ctrl.getUrl() | trusted}}',
sandbox='allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms'
sandbox='allow-scripts allow-top-navigation-by-user-activation allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-modals allow-forms allow-downloads'
)
| Loading
.loading-overlay(ng-if='ctrl.loading')

View File

@@ -0,0 +1,5 @@
class HealthCheckController < ApplicationController
def index
render :plain => "OK"
end
end

View File

@@ -43,7 +43,7 @@ module StandardNotes
base_uri: %w('self'),
block_all_mixed_content: false, # see http://www.w3.org/TR/mixed-content/
child_src: ["*", "blob:"],
frame_src: ["*", "blob:"],
frame_src: ["*", "blob:", "data:"],
connect_src: ["*"],
font_src: %w(* 'self'),
form_action: %w('self'),

View File

@@ -2,6 +2,7 @@ Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.force_ssl = true
config.ssl_options = { redirect: { exclude: -> request { request.path =~ /healthcheck/ } } }
# Code is not reloaded between requests.
config.cache_classes = true

View File

@@ -9,7 +9,7 @@ Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets')
Rails.application.config.assets.paths << Rails.root.join('dist')
Rails.application.config.assets.precompile << ["*.svg", "*.eot", "*.woff", "*.ttf"]
Rails.application.config.assets.precompile += %w( fonts/ionicons.eot fonts/ionicons.svg fonts/ionicons.ttf fonts/ionicons.woff )
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.

View File

@@ -1,3 +1,5 @@
Rails.application.routes.draw do
get "/healthcheck" => "health_check#index"
root 'application#app'
end

6
package-lock.json generated
View File

@@ -12123,9 +12123,9 @@
}
},
"websocket-extensions": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz",
"integrity": "sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg==",
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz",
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==",
"dev": true
},
"which": {

View File

@@ -9,7 +9,7 @@
"scripts": {
"start": "webpack-dev-server --progress",
"bundle": "webpack --mode production",
"build": "bundle install && npm install && npm run bundle",
"build": "bundle install && npm ci && bundle exec rails assets:precompile && npm run bundle",
"submodules": "git submodule update --init --force --remote",
"test": "karma start karma.conf.js --single-run",
"lint": "eslint --fix app/assets/javascripts/**/*.js"

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB