Migrate from Yarn to Node lts/gallium (#1004)

* attempt upgrade over CI

update shadowbox build node version

wild guess

try other image, not holding my breath

switch image back, try no --upgrade? lol

whoops wrong SHA

trying this tip out of hand - will make platform a env var next

apparently buildx is supposed to detect the platform - lets see

find replace yarn w/ npm

fix git hook

cache npm deps

proper lock and enforce engine

licenses are... generated by yarn lmao

some weird leftovers

explode out test workflow jobs

Title Case and check for cache hit

upgrade NPM

check version...

eh, worth a try

reinstall deps for now so we can debug downstream issues

use root bin

fix npm workspace, merge lint w/ setup

HMMM

attempt cache load

fix keys

remove restore-keys

regular install

attempt more "correct" npm approach

annoyingly caching ~/.npm doesn't cache the global npm version

less correct node_module cache, will roll back if doesn't work

er... node 15 :/, restore keys

changing key...?

permission setting so cache can properly hit

separate dependecy permission task

verbose chmod

fix sentry webhook

consistency thing

* print architecture

* attempt amd64-explicit node image

* attempt nodev16 upgrade

* ah, okay, let's try picking this hash

* fix node version reference and npm run clean

* revert untouched files caught in squash

* remove yarn from travis.yml

* testing ci

* npmrc comment, revert one of cis

* Update src/server_manager/web_app/run_gallery_action.sh

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>

* Update src/server_manager/web_app/run_action.sh

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>

* licenses change

* fix package-lock regression

* fix webpack-dev-server properly

* set install to ci in Dockerfile

* forgot to include the README

* add ci where it makes sense

* delete this part of the README

* missed one

* testing sub-node_modules

* better chmod

* prefer glob

* reset .github/workflows/test.yml

* oops, yarn in ci

* rename everything (#1006)

* Update test.yml

* check_requirements (#1008)

* reqcheck draft

* finish drafting script - need to test and add to hooks

* attempt to roll our own setup...

* remove setup script and rename a couple things

* remove this nightmare lol

* Update release_manager.yml

* Update test.yml

* 'do' -> 'action'

* run -> start

* Update src/shadowbox/docker/build.action.sh

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>

* Update README.md

* Update README.md

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* rename 'action' to action

* add action list to run action itself

* Update src/shadowbox/README.md

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* Update README.md

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* Update scripts/run_action.sh

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* Update src/server_manager/scripts/fill_packaging_opts.sh

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* style guide fixes

* lower case fixes

* enforce major version

* Update scripts/run_action.sh

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

* Update package.json

Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>

Co-authored-by: Vinicius Fortuna <fortuna@users.noreply.github.com>
Co-authored-by: Benjamin M. Schwartz <bemasc@google.com>
This commit is contained in:
Daniel LaCosse 2021-11-05 20:40:34 +00:00 committed by GitHub
parent 0eca970d6a
commit 9d80b6d448
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 39425 additions and 17112 deletions

View file

@ -20,37 +20,27 @@ jobs:
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v1
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 12
cache: npm
node-version: 16
- name: Show Environment Info
run: |
yarn -v
npm -v
openssl version
env
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Check yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --prefer-offline
- name: Install Dependencies
run: npm ci
- name: Release Linux
if: runner.os == 'Linux'
run: yarn do server_manager/electron_app/release_linux
run: npm run action server_manager/electron_app/release_linux
- name: Release MacOS
if: runner.os == 'macOS'
@ -62,7 +52,7 @@ jobs:
run: |
openssl aes-256-cbc -K $ENCRYPTED_SIGNING_CERT_KEY -iv $ENCRYPTED_SIGNING_CERT_IV -in macos-signing-certificate.p12.enc -out macos-signing-certificate.p12 -d -md sha256
export CSC_LINK=$(pwd)/macos-signing-certificate.p12
yarn do server_manager/electron_app/release_macos
npm run action server_manager/electron_app/release_macos
- name: Deploy
uses: softprops/action-gh-release@v1

View file

@ -25,49 +25,33 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Show Environment Info
run: yarn -v
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Check yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
cache: npm
node-version: 16
- name: Install dependencies
run: NODE_DTRACE_PROVIDER_REQUIRE=hard yarn --prefer-offline
run: NODE_DTRACE_PROVIDER_REQUIRE=hard npm ci
- name: Lint
run: yarn lint
run: npm run lint
- name: Manager
run: |
SENTRY_DSN='test' yarn do server_manager/electron_app/release_linux
yarn do server_manager/test
SENTRY_DSN='test' npm run action server_manager/electron_app/release_linux
npm run action server_manager/test
- name: Shadowbox
if: runner.os == 'Linux'
run: |
yarn do shadowbox/server/build
yarn do shadowbox/test
yarn do shadowbox/integration_test/run
npm run action shadowbox/server/build
npm run action shadowbox/test
npm run action shadowbox/integration_test/start
- name: Metrics Server
if: runner.os == 'Linux'
run: |
yarn do metrics_server/build
yarn do metrics_server/test
npm run action metrics_server/build
npm run action metrics_server/test
- name: Sentry Webhook
if: runner.os == 'Linux'
run: yarn do sentry_webhook/build

1
.gitignore vendored
View file

@ -3,7 +3,6 @@
node_modules/
/src/server_manager/install_scripts/do_install_script.ts
/src/server_manager/install_scripts/gcp_install_script.ts
yarn-error.log
.vscode/
.idea/
third_party/shellcheck/download/

2
.npmrc Normal file
View file

@ -0,0 +1,2 @@
;enforces that the user is `npm install`ing with the correct node version
engine-strict=true

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
lts/gallium

View file

@ -1,4 +1,4 @@
# Configuration for `yarn shellcheck` and IDEs
# Configuration for `npx shellcheck` and IDEs
# Enable relative path references
source-path=SCRIPTDIR

View file

@ -4,15 +4,11 @@ node_js:
- "12"
cache:
yarn: true
directories:
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
# https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Travis-CI-supports-yarn
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.12.3
- export PATH="$HOME/.yarn/bin:$PATH"
# Install latest Docker for BuildKit support if running on linux. See https://docs.travis-ci.com/user/docker/
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
@ -51,15 +47,15 @@ jobs:
curl -L https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m) > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
- yarn do shadowbox/test
- yarn do shadowbox/docker/build && cd src/shadowbox/integration_test && ./test.sh
- npm run action shadowbox/test
- npm run action shadowbox/docker/build && cd src/shadowbox/integration_test && ./test.sh
- stage: "Deploy Server"
name: Server Docker Image
sudo: required
services: docker
script:
- yarn do shadowbox/docker/build
- npm run action shadowbox/docker/build
- docker login quay.io -u="$QUAY_IO_USERNAME" -p="$QUAY_IO_PASSWORD"
- docker tag outline/shadowbox quay.io/outline/shadowbox:$TRAVIS_TAG
- docker push quay.io/outline/shadowbox:$TRAVIS_TAG
@ -74,7 +70,7 @@ jobs:
apt:
packages:
- rpm
script: yarn do server_manager/electron_app/release_linux
script: npm run action server_manager/electron_app/release_linux
- stage: "Manager Release"
os: osx
@ -84,8 +80,8 @@ jobs:
script:
- openssl aes-256-cbc -K $encrypted_61a49da75942_key -iv $encrypted_61a49da75942_iv -in macos-signing-certificate.p12.enc -out macos-signing-certificate.p12 -d
- export CSC_LINK=$(pwd)/macos-signing-certificate.p12
# Must run yarn again due to the OS change, required for signing to work.
- yarn && yarn do server_manager/electron_app/release_macos
# Must run npm again due to the OS change, required for signing to work.
- npm install && npm run action server_manager/electron_app/release_macos
deploy:
provider: releases

View file

@ -33,39 +33,42 @@ The system comprises the following components:
## Code Prerequisites
In order to build and run the code, you need the following installed:
- [Node](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/en/docs/install)
- [Node](https://nodejs.org/) (version `16.13.0`)
- [NPM](http://npmjs.org/) (version `8.1.0`)
- [Wine](https://www.winehq.org/download), if you would like to generate binaries for Windows.
Then you need to install all the NPM package dependencies:
```
yarn
> 💡 NOTE: if you have `nvm` installed, run `nvm use` to switch to the correct node version!
Install dependencies with:
```sh
npm install
```
This project uses [Yarn workspaces](https://yarnpkg.com/blog/2017/08/02/introducing-workspaces/).
This project uses [NPM workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces/).
## Build System
We have a very simple build system based on package.json scripts that are called using `yarn`
We have a very simple build system based on package.json scripts that are called using `npm run`
and a thin wrapper for what we call build "actions".
We've defined a `do` package.json script that takes an `action` parameter:
We've defined a package.json script called `action` whose parameter is a relative path:
```shell
yarn do $ACTION
npm run action $ACTION
```
This command will define a `do_action()` function and call `${ACTION}_action.sh`, which must exist.
The called action script can use `do_action` to call its dependencies. The $ACTION parameter is
This command will define a `run_action()` function and call `${ACTION}.action.sh`, which must exist.
The called action script can use `run_action` to call its dependencies. The $ACTION parameter is
always resolved from the project root, regardless of the caller location.
The idea of `do_action` is to keep the build logic next to where the relevant code is.
The idea of `run_action` is to keep the build logic next to where the relevant code is.
It also defines two environmental variables:
- ROOT_DIR: the root directory of the project, as an absolute path.
- BUILD_DIR: where the build output should go, as an absolute path.
> ⚠️ To find all the actions in this project, run `yarn actions`
> ⚠️ To find all the actions in this project, run `npm run action:list`
### Build output
@ -87,7 +90,7 @@ The directories have subdirectories for intermediate output:
To clean up:
```
yarn run clean
npm run clean
```
## Shadowsocks Resistance Against Detection and Blocking

39166
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -4,29 +4,33 @@
"devDependencies": {
"@types/jasmine": "^3.5.10",
"clang-format": "^1.2.2",
"generate-license-file": "^1.2.0",
"husky": "^1.3.1",
"jasmine": "^3.5.0",
"prettier": "^2.4.1",
"pretty-quick": "^3.1.1",
"tslint": "^5.9.1",
"typescript": "^4"
},
"engines": {
"yarn": ">=1.0",
"node": "^12"
"node": "^16.13.0",
"npm": "^8.1.0"
},
"scripts": {
"action": "bash ./scripts/run_action.sh",
"action:help": "npm run action",
"action:list": "npm run action",
"clean": "rm -rf src/*/node_modules/ build/ node_modules/ src/server_manager/install_scripts/do_install_script.ts src/server_manager/install_scripts/gcp_install_script.ts third_party/shellcheck/download/",
"do": "bash ./scripts/do_action.sh",
"actions": "find . -name '*_action.sh' | sed -E 's:./src/(.*)_action.sh:\\1:' | grep -v 'scripts/do_action'",
"lint": "yarn shellcheck && yarn tslint",
"shellcheck": "bash ./scripts/shellcheck.sh",
"tslint": "tslint 'src/**/*.ts' -e '**/node_modules/**'"
"lint": "npm run lint:sh && npm run lint:ts",
"lint:sh": "bash ./scripts/shellcheck.sh",
"lint:ts": "npx tslint 'src/**/*.ts' -e '**/node_modules/**'"
},
"workspaces": [
"src/*"
],
"husky": {
"hooks": {
"pre-commit": "yarn run lint && yarn git-clang-format && yarn pretty-quick --staged --pattern '**/*.html'"
"pre-commit": "npm run lint && npx git-clang-format && npx pretty-quick --staged --pattern '**/*.html'"
}
}
}

View file

@ -1,48 +0,0 @@
#!/bin/bash
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eu
# TODO: Because Node.js on Cygwin doesn't handle absolute paths very
# well, it would be worth pushd-ing to ROOT_DIR before invoking
# them and making BUILD_DIR a relative path, viz. just "build".
export ROOT_DIR=${ROOT_DIR:-$(pwd)/$(git rev-parse --show-cdup)}
export BUILD_DIR=${BUILD_DIR:-${ROOT_DIR}/build}
export _DO_ACTION_INDENT=''
function do_action() {
local -r OLD_INDENT="${_DO_ACTION_INDENT}"
_DO_ACTION_INDENT="..${_DO_ACTION_INDENT}"
local -r STYLE_BOLD_WHITE='\033[1;37m'
local -r STYLE_BOLD_RED='\033[1;31m'
local -r STYLE_RESET='\033[0m'
local -r action="$1"
echo -e "${OLD_INDENT}${STYLE_BOLD_WHITE}[Running ${action}]${STYLE_RESET}"
shift
"${ROOT_DIR}/src/${action}_action.sh" "$@"
local -ir status=$?
if ((status == 0)); then
echo -e "${OLD_INDENT}${STYLE_BOLD_WHITE}[Done ${action}]${STYLE_RESET}"
else
echo -e "${OLD_INDENT}${STYLE_BOLD_RED}[Failed ${action}]${STYLE_RESET}"
fi
_DO_ACTION_INDENT=${OLD_INDENT}
return "${status}"
}
export -f do_action
do_action "$@"

67
scripts/run_action.sh Executable file
View file

@ -0,0 +1,67 @@
#!/bin/bash
#
# Copyright 2018 The Outline Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eu
# TODO: Because Node.js on Cygwin doesn't handle absolute paths very
# well, it would be worth pushd-ing to ROOT_DIR before invoking
# them and making BUILD_DIR a relative path, viz. just "build".
readonly ROOT_DIR=${ROOT_DIR:-$(pwd)/$(git rev-parse --show-cdup)}
readonly BUILD_DIR=${BUILD_DIR:-${ROOT_DIR}/build}
export ROOT_DIR
export BUILD_DIR
export run_action_indent=''
function run_action() {
local -r STYLE_BOLD_WHITE='\033[1;37m'
local -r STYLE_BOLD_GREEN='\033[1;32m'
local -r STYLE_BOLD_RED='\033[1;31m'
local -r STYLE_RESET='\033[0m'
local -r action="${1:-""}"
local -r old_indent="${run_action_indent}"
run_action_indent="=> ${run_action_indent}"
if [[ -z "${action}" ]]; then
echo -e "Please provide an action to run. ${STYLE_BOLD_WHITE}List of valid actions:${STYLE_RESET}\n"
find . -name '*.action.sh' | sed -E 's:\./src/(.*)\.action\.sh:\1:'
exit 0
fi
echo -e "${old_indent}${STYLE_BOLD_WHITE}[Running ${action}]${STYLE_RESET}"
shift
"${ROOT_DIR}/src/${action}.action.sh" "$@"
local -ir status="$?"
if (( status == 0 )); then
echo -e "${old_indent}${STYLE_BOLD_GREEN}[${action}: Finished]${STYLE_RESET}"
else
echo -e "${old_indent}${STYLE_BOLD_RED}[${action}: Failed]${STYLE_RESET}"
fi
run_action_indent="${old_indent}"
return "${status}"
}
export -f run_action
run_action "$@"

View file

@ -47,7 +47,7 @@ The metrics server supports two URL paths:
## Build
```sh
yarn do metrics_server/build
npm run action metrics_server/build
```
## Run
@ -55,7 +55,7 @@ yarn do metrics_server/build
Run a local development metrics server:
```sh
yarn do metrics_server/run
npm run action metrics_server/start
```
## Deploy
@ -66,20 +66,20 @@ yarn do metrics_server/run
```
* To deploy to dev:
```sh
yarn do metrics_server/deploy_dev
npm run action metrics_server/deploy_dev
```
* To deploy to prod:
```sh
yarn do metrics_server/deploy_prod
npm run action metrics_server/deploy_prod
```
## Test
* Unit test
```sh
yarn do metrics_server/test
npm run action metrics_server/test
```
* Integration test
```sh
yarn do metrics_server/test_integration
npm run action metrics_server/test_integration
```

View file

@ -19,7 +19,7 @@ readonly BUILD_DIR="build/metrics_server"
rm -rf "${BUILD_DIR}"
yarn 'do' metrics_server/build
npm run action metrics_server/build
cp "${SRC_DIR}/app_dev.yaml" "${BUILD_DIR}/app.yaml"
cp "${SRC_DIR}/config_dev.json" "${BUILD_DIR}/config.json"

View file

@ -19,7 +19,7 @@ readonly BUILD_DIR="build/metrics_server"
rm -rf "${BUILD_DIR}"
yarn 'do' metrics_server/build
npm run action metrics_server/build
cp "${SRC_DIR}/app_prod.yaml" "${BUILD_DIR}/app.yaml"
cp "${SRC_DIR}/config_prod.json" "${BUILD_DIR}/config.json"

View file

@ -17,9 +17,9 @@
readonly SRC_DIR="src/metrics_server"
readonly BUILD_DIR="build/metrics_server"
yarn 'do' metrics_server/build
npm run action metrics_server/build
cp "${SRC_DIR}/config_dev.json" "${BUILD_DIR}/config.json"
cp "${SRC_DIR}/package.json" "${BUILD_DIR}/"
yarn node "${BUILD_DIR}/index.js"
npx node "${BUILD_DIR}/index.js"

View file

@ -10,7 +10,7 @@ The Outline Sentry webhook is a [Google Cloud Function](https://cloud.google.com
## Build
```sh
yarn do sentry_webhook/build
npm run action sentry_webhook/build
```
## Deploy
@ -21,7 +21,7 @@ Authenticate with `gcloud`:
```
To deploy:
```sh
yarn do sentry_webhook/deploy
npm run action sentry_webhook/deploy
```
## Configure Sentry Webhooks

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
yarn 'do' sentry_webhook/build
npm run action sentry_webhook/build
cp src/sentry_webhook/package.json build/sentry_webhook/
gcloud --project=uproxysite functions deploy postSentryEventToSalesforce --runtime=nodejs12 --trigger-http --source=build/sentry_webhook --entry-point=postSentryEventToSalesforce

View file

@ -4,12 +4,12 @@
To run the Outline Manager Electron app:
```
yarn do server_manager/electron_app/run
npm run action server_manager/electron_app/start
```
To run the Outline Manager Electron app with a development build (code not minified):
```
BUILD_ENV=development yarn do server_manager/electron_app/run
BUILD_ENV=development npm run action server_manager/electron_app/start
```
## Development Server
@ -17,7 +17,7 @@ BUILD_ENV=development yarn do server_manager/electron_app/run
To run the Outline Manager as a web app on the browser and listen for changes:
```
yarn do server_manager/web_app/run
npm run action server_manager/web_app/start
```
## Gallery Server for UI Development
@ -25,7 +25,7 @@ yarn do server_manager/web_app/run
We have a server app to for quickly iterating on UI components. To spin it up, run
```
yarn do server_manager/web_app/run_gallery
npm run action server_manager/web_app/start_gallery
```
Changes to UI components will be hot reloaded into the gallery.
@ -39,7 +39,7 @@ This will enable the Developer menu on the application window.
To build the app binary:
```
yarn do server_manager/electron_app/package_${PLATFORM}
npm run action server_manager/electron_app/package_${PLATFORM}
```
Where `${PLATFORM}` is one of `linux`, `macos`, `only_windows`.
@ -54,7 +54,7 @@ The per-platform standalone apps will be at `build/electron_app/static/dist`.
To perform a release, use
```
yarn do server_manager/electron_app/release
npm run action server_manager/electron_app/release
```
This will perform a clean and reinstall all dependencies to make sure the build is not tainted.
@ -64,7 +64,7 @@ This will perform a clean and reinstall all dependencies to make sure the build
To enable error reporting through [Sentry](https://sentry.io/) for local builds, run:
``` bash
export SENTRY_DSN=[Sentry development API key]
yarn do server_manager/electron_app/run
npm run action server_manager/electron_app/start
```
Release builds on CI are configured with a production Sentry API key.

View file

@ -33,7 +33,7 @@ exports.makeConfig = (options) => {
],
target: options.target,
devtool: 'inline-source-map',
// Run the dev server with `yarn workspace outline-manager run webpack-dev-server --open`
// Run the dev server with `npm run webpack-dev-server --workspace=outline-manager --open`
devServer: {
overlay: true,
},

View file

@ -20,7 +20,7 @@ readonly OUT_DIR="${BUILD_DIR}/server_manager/electron_app"
rm -rf "${OUT_DIR}"
# Build the Web App.
do_action server_manager/web_app/build
run_action server_manager/web_app/build
# Compile the Electron app source.
# Since Node.js on Cygwin doesn't like absolute Unix-style paths,
@ -38,9 +38,9 @@ cp -r "${BUILD_DIR}/server_manager/web_app/static" "${STATIC_DIR}/server_manager
# We also need to install NPMs at this location for require()
# in order for require() to work right in the renderer process, which
# is loaded via a custom protocol.
cp src/server_manager/package.json yarn.lock "${STATIC_DIR}"
cp src/server_manager/package.json package-lock.json "${STATIC_DIR}"
cd "${STATIC_DIR}"
yarn install --prod --ignore-scripts
npm install --prod --ignore-scripts
# Icons.
cd "${ROOT_DIR}"

View file

@ -16,7 +16,7 @@
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
yarn 'do' server_manager/electron_app/build
npm run action server_manager/electron_app/build
readonly BUILD_DIR='build/server_manager/electron_app/static'

View file

@ -16,7 +16,7 @@
source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
yarn 'do' server_manager/electron_app/build
npm run action server_manager/electron_app/build
readonly BUILD_DIR=build/server_manager/electron_app/static

View file

@ -18,12 +18,12 @@ source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
yarn 'do' server_manager/electron_app/build
yarn 'do' server_manager/electron_app/write_production_environment
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static
"${ROOT_DIR}/src/server_manager/node_modules/.bin/electron-builder" \
"${ROOT_DIR}/node_modules/.bin/electron-builder" \
--projectDir="${BUILD_DIR}" \
--config.asarUnpack=server_manager/web_app/images \
--config.generateUpdatesFilesForAllChannels=true \

View file

@ -25,8 +25,8 @@ source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
yarn 'do' server_manager/electron_app/build
yarn 'do' server_manager/electron_app/write_production_environment
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static

View file

@ -18,8 +18,8 @@ source src/server_manager/scripts/fill_packaging_opts.sh "$0" "$@"
export BUILD_ENV='production'
yarn 'do' server_manager/electron_app/build
yarn 'do' server_manager/electron_app/write_production_environment
npm run action server_manager/electron_app/build
npm run action server_manager/electron_app/write_production_environment
readonly BUILD_DIR=build/server_manager/electron_app/static

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
do_action server_manager/electron_app/build
run_action server_manager/electron_app/build
readonly NODE_MODULES_BIN_DIR="${ROOT_DIR}/src/server_manager/node_modules/.bin"

View file

@ -61,7 +61,7 @@
"the bundled Chromium in our version of Electron. Whenever upgrading Electron, run the",
"server_manager tests. You'll get a failure that looks like <Expected '812852' to equal '693954>.",
"Set PUPPETEER_CHROMIUM_REVISION to the first of those numbers to get the correct revision",
"and `yarn run clean && yarn` to re-install puppeteer, causing it to download the new",
"and `npm ci` to re-install puppeteer, causing it to download the new",
"Chromium version."
]
}

View file

@ -23,15 +23,15 @@
# script, allowing fill_packaging_opts.sh to fill variables for the caller.
# Input: "/absolute/path/src/server_manager/electron_app/something_action.sh"
# Output: "yarn do server_manager/electron_app/something"
# Output: "npm run action server_manager/electron_app/something"
readonly ELECTRON_PATH='server_manager/electron_app/'
readonly RELATIVE="${1#*/src/${ELECTRON_PATH}}"
readonly YARN_COMMAND="yarn do ${ELECTRON_PATH}${RELATIVE%_action.sh}"
readonly NPM_COMMAND="npm run action ${ELECTRON_PATH}${RELATIVE%.action.sh}"
shift
function usage () {
echo "Usage:" 1>&2
echo "${YARN_COMMAND} [-s stagingPercentage]" 1>&2
echo "${NPM_COMMAND} [-s stagingPercentage]" 1>&2
echo " -s: The staged rollout percentage for this release. Must be in the interval (0, 100]. Defaults to 100" 1>&2
echo " -h: this help message" 1>&2
echo 1>&2

View file

@ -17,12 +17,12 @@
readonly TEST_DIR="${BUILD_DIR}/js/server_manager/"
rm -rf "${TEST_DIR}"
yarn 'do' server_manager/web_app/build_install_script
npm run action server_manager/web_app/build_install_script
# Use commonjs modules, jasmine runs in node.
tsc -p "${ROOT_DIR}/src/server_manager" --outDir "${TEST_DIR}" --module commonjs
jasmine --config="${ROOT_DIR}/jasmine.json"
yarn 'do' server_manager/web_app/test
npm run action server_manager/web_app/test
rm -rf "${TEST_DIR}"

View file

@ -19,7 +19,7 @@ set -eu
readonly OUT_DIR="${BUILD_DIR}/server_manager/web_app"
rm -rf "${OUT_DIR}"
do_action server_manager/web_app/build_install_script
run_action server_manager/web_app/build_install_script
# Node.js on Cygwin doesn't like absolute Unix-style paths.
# So, we use a relative path as input to webpack.

View file

@ -18,6 +18,6 @@ set -eu
rm -rf "${BUILD_DIR}/server_manager/web_app"
do_action server_manager/web_app/build_install_script
run_action server_manager/web_app/build_install_script
yarn workspace outline-manager run webpack-dev-server --config=browser.webpack.js --open
webpack-dev-server --config=src/server_manager/browser.webpack.js --open

View file

@ -16,4 +16,4 @@
set -eu
yarn workspace outline-manager run webpack-dev-server --config=gallery.webpack.js --open
webpack-dev-server --config=src/server_manager/gallery.webpack.js --open

View file

@ -14,5 +14,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
yarn 'do' server_manager/web_app/build_install_script
npm run action server_manager/web_app/build_install_script
karma start "${ROOT_DIR}/src/server_manager/web_app/karma.conf.js"

View file

@ -1,15 +1,12 @@
# HOWTO re-generate `license.txt`
## Requirements
* `yarn`
## Steps
* `cd` to the root of your clone of this repo
* Ensure `node_modules` is up to date and only include dependencies of the Electron app by running `yarn run clean && yarn && yarn do server_manager/web_app/build`
* `cd src/server_manager/web_app/ui_components/licenses`
* `yarn workspace outline-manager licenses generate-disclaimer --prod > licenses.txt`
* Ensure `node_modules` is up to date and only include dependencies of the Electron app by running `npm ci && npm run action server_manager/web_app/build`
* `cd src/server_manager`
* `npx generate-license-file --input package.json --output web_app/ui_components/licenses/licenses.txt`
* `cd web_app/ui_components/licenses`
* `cat db-ip_license.txt >> licenses.txt`
Done!

File diff suppressed because it is too large Load diff

View file

@ -27,16 +27,16 @@ Use `sudo --preserve-env` if you need to pass environment variables. Use `bash -
Shadowbox supports running on linux and macOS hosts.
Besides [Node](https://nodejs.org/en/download/) and [Yarn](https://yarnpkg.com/en/docs/install), you will also need:
Besides [Node](https://nodejs.org/en/download/) you will also need:
1. [Docker 1.13+](https://docs.docker.com/engine/installation/)
1. [docker-compose 1.11+](https://docs.docker.com/compose/install/)
2. [docker-compose 1.11+](https://docs.docker.com/compose/install/)
### Running Shadowbox as a Node.js app
Build and run the server as a Node.js app:
```
yarn do shadowbox/server/run
npm run action shadowbox/server/start
```
The output will be at `build/shadowbox/app`.
@ -46,7 +46,7 @@ The output will be at `build/shadowbox/app`.
Build the image and run server:
```
yarn do shadowbox/docker/run
npm run action shadowbox/docker/start
```
You should be able to successfully query the management API:
@ -56,7 +56,7 @@ curl --insecure https://[::]:8081/TestApiPrefix/server
To build the image only:
```
yarn do shadowbox/docker/build
npm run action shadowbox/docker/build
```
Debug image:
@ -136,14 +136,14 @@ upload it to your favorite registry
Then set your `SB_IMAGE` environment variable to point to the image you just
uploaded (e.g. `export SB_IMAGE=yourdockerhubusername/shadowbox`) and
run `yarn do server_manager/electron_app/run` and your droplet should be created with your
run `npm run action server_manager/electron_app/start` and your droplet should be created with your
modified image.
### Automated
To run the integration test:
```
yarn do shadowbox/integration_test/run
npm run action shadowbox/integration_test/start
```
This will set up three containers and two networks:
@ -156,12 +156,12 @@ client <-> shadowbox <-> target
To test clients that rely on fetching a docker image from Dockerhub, you can push an image to your account and modify the
client to use your image. To push your own image:
```
yarn do shadowbox/docker/build && docker tag quay.io/outline/shadowbox $USER/shadowbox && docker push $USER/shadowbox
npm run action shadowbox/docker/build && docker tag quay.io/outline/shadowbox $USER/shadowbox && docker push $USER/shadowbox
```
If you need to test an unsigned image (e.g. your dev one):
```
DOCKER_CONTENT_TRUST=0 SB_IMAGE=$USER/shadowbox yarn do shadowbox/integration_test/run
DOCKER_CONTENT_TRUST=0 SB_IMAGE=$USER/shadowbox npm run action shadowbox/integration_test/start
```
You can add tags if you need different versions in different clients.
@ -175,4 +175,4 @@ start-up time, then you mey need to remove the pre-existing test config:
rm /tmp/outline/persisted-state/shadowbox_server_config.json
```
This will warn about deleting a write-protected file, which is okay to ignore. You will then need to hand-edit the JSON string in src/shadowbox/docker/run_action.sh.
This will warn about deleting a write-protected file, which is okay to ignore. You will then need to hand-edit the JSON string in src/shadowbox/docker/start.action.sh.

View file

@ -15,29 +15,29 @@
ARG NODE_IMAGE
# Multi-stage build: use a build image to prevent bloating the shadowbox image with dependencies.
# Run `yarn` and build inside the container to package the right dependencies for the image.
# Run `npm ci` and build inside the container to package the right dependencies for the image.
FROM ${NODE_IMAGE} AS build
RUN apk add --no-cache --upgrade bash
WORKDIR /
# Don't copy node_modules and other things not needed for install.
COPY package.json yarn.lock ./
COPY package.json package-lock.json ./
COPY src/shadowbox/package.json src/shadowbox/
RUN yarn install
RUN npm ci
# We copy the source code only after yarn install, so that source code changes don't trigger re-installs.
# We copy the source code only after npm ci, so that source code changes don't trigger re-installs.
COPY scripts scripts/
COPY src src/
COPY tsconfig.json ./
COPY third_party third_party
RUN ROOT_DIR=/ yarn do shadowbox/server/build
RUN ROOT_DIR=/ npm run action shadowbox/server/build
# shadowbox image
FROM ${NODE_IMAGE}
# Save metadata on the software versions we are using.
LABEL shadowbox.node_version=12.16.3
LABEL shadowbox.node_version=16.12.0
ARG GITHUB_RELEASE
LABEL shadowbox.github.release="${GITHUB_RELEASE}"

View file

@ -19,12 +19,17 @@ export DOCKER_CONTENT_TRUST="${DOCKER_CONTENT_TRUST:-1}"
export DOCKER_BUILDKIT=1
# Newer node images have no valid content trust data.
# Pin the image node:12.16.3-alpine (linux/amd64) by hash.
# See versions at https://hub.docker.com/_/node?tab=tags&name=alpine
readonly NODE_IMAGE="node@sha256:12b2154fb459fa5f42c54771524609db041e7ef3465935d0ca82940d2d72669d"
# Pin the image node:16.12-alpine3.14 by hash.
# See versions at https://hub.docker.com/_/node/
readonly NODE_IMAGE="node@sha256:b45a4d2e291af6ed859c8e54d4f70389443373b9293c469b80b5435046127a75"
# Doing an explicit `docker pull` of the container base image to work around an issue where
# Travis fails to pull the base image when using BuildKit. Seems to be related to:
# https://github.com/moby/buildkit/issues/606 and https://github.com/moby/buildkit/issues/1397
docker pull "${NODE_IMAGE}"
docker build --force-rm --build-arg NODE_IMAGE="${NODE_IMAGE}" --build-arg GITHUB_RELEASE="${TRAVIS_TAG:-none}" -t "${SB_IMAGE:-outline/shadowbox}" "${ROOT_DIR}" -f src/shadowbox/docker/Dockerfile
docker build --force-rm \
--build-arg NODE_IMAGE="${NODE_IMAGE}" \
--build-arg GITHUB_RELEASE="${TRAVIS_TAG:-none}" \
-f src/shadowbox/docker/Dockerfile \
-t "${SB_IMAGE:-outline/shadowbox}" \
"${ROOT_DIR}"

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
do_action shadowbox/docker/build
run_action shadowbox/docker/build
RUN_ID="${RUN_ID:-$(date +%Y-%m-%d-%H%M%S)}"
readonly RUN_ID

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
do_action shadowbox/docker/build
run_action shadowbox/docker/build
LOGFILE="$(mktemp)"
readonly LOGFILE

View file

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
do_action shadowbox/server/build
run_action shadowbox/server/build
RUN_ID="${RUN_ID:-$(date +%Y-%m-%d-%H%M%S)}"
readonly RUN_DIR="/tmp/outline/${RUN_ID}"

View file

@ -7,4 +7,4 @@ This directory is used to lint our scripts using [Shellcheck](https://www.shellc
* Extracts the executable
* Runs the executable
The executable is cached on the developer's system after the first download. To clear the cache, run `rm download` (or `yarn clean` in the repository root).
The executable is cached on the developer's system after the first download. To clear the cache, run `rm download` (or `npm run clean` in the repository root).

11062
yarn.lock

File diff suppressed because it is too large Load diff