Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jamesgibson14/meteor-up
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: nudger-labs/meteor-up
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 14,442 additions and 11,185 deletions.
  1. +2 −3 .eslintrc.yml
  2. +12 −0 .github/FUNDING.yml
  3. +1 −1 .gitignore
  4. +11 −10 .travis.yml
  5. +107 −0 CHANGELOG.md
  6. +30 −3 CONTRIBUTING.md
  7. +1 −2 docs/.stylelintrc
  8. +0 −1 docs/Gemfile
  9. +204 −158 docs/Gemfile.lock
  10. +0 −1 docs/_includes/docs_nav.html
  11. +5 −8 docs/_includes/footer.html
  12. +4 −8 docs/_includes/head.html
  13. +7 −56 docs/_includes/header.html
  14. +0 −15 docs/_includes/home-intro.html
  15. +0 −26 docs/_includes/social-share.html
  16. +37 −34 docs/_layouts/docs.html
  17. +1 −3 docs/_layouts/home.html
  18. +0 −20 docs/_layouts/post.html
  19. +80 −0 docs/css/base.css
  20. +0 −11 docs/css/bootstrap.min.css
  21. +0 −196 docs/css/custom.css
  22. +161 −78 docs/css/docs.css
  23. +389 −65 docs/css/highlight.css
  24. +162 −0 docs/css/index.css
  25. +233 −33 docs/docs.md
  26. +18 −11 docs/getting-started.md
  27. BIN docs/imgs/cli2.gif
  28. BIN docs/imgs/docker.png
  29. BIN docs/imgs/global.png
  30. BIN docs/imgs/rocket.png
  31. BIN docs/imgs/swatches.png
  32. +101 −110 docs/index.html
  33. +2 −1 docs/migrating.md
  34. 0 docs/scripts/bootstrap.min.js
  35. +0 −34 docs/scripts/github-request.js
  36. +93 −0 docs/scripts/index-data.js
  37. +0 −4 docs/scripts/jquery-3.2.1.min.js
  38. 0 docs/scripts/toc-bot.js
  39. +0 −136 docs/scripts/tocbot.js
  40. +1 −1 index.js
  41. +0 −9,230 npm-shrinkwrap.json
  42. +9,171 −0 package-lock.json
  43. +43 −47 package.json
  44. +5 −7 src/.babelrc
  45. +1 −1 src/__tests__/hooks.unit.js
  46. +6 −1 src/__tests__/plugin-api.unit.js
  47. +148 −0 src/__tests__/swarm-utils.unit.js
  48. +3 −3 src/__tests__/utils.unit.js
  49. +31 −29 src/index.js
  50. +2 −2 src/node-version.js
  51. +16 −1 src/nodemiral.js
  52. +98 −23 src/plugin-api.js
  53. +11 −3 src/plugins/default/__tests__/index.js
  54. +10 −2 src/plugins/default/command-handlers.js
  55. +13 −2 src/plugins/default/commands.js
  56. +4 −2 src/plugins/default/template/mup.js.sample
  57. +5 −24 src/plugins/docker/assets/docker-setup.sh
  58. +3 −0 src/plugins/docker/assets/docker-update.sh
  59. +1 −1 src/plugins/docker/assets/init-swarm.sh
  60. +18 −0 src/plugins/docker/assets/install-docker.sh
  61. +24 −0 src/plugins/docker/assets/swarm-demote.sh
  62. +1 −3 src/plugins/docker/assets/swarm-join.sh
  63. +2 −2 src/plugins/docker/assets/swarm-labels.sh
  64. +1 −1 src/plugins/docker/assets/swarm-leave.sh
  65. +1 −1 src/plugins/docker/assets/swarm-promote.sh
  66. +115 −41 src/plugins/docker/command-handlers.js
  67. +5 −0 src/plugins/docker/commands.js
  68. +14 −0 src/plugins/docker/index.js
  69. +59 −17 src/plugins/docker/swarm.js
  70. +17 −7 src/plugins/docker/utils.js
  71. +52 −0 src/plugins/docker/validate.js
  72. +59 −3 src/plugins/meteor/__tests__/index.js
  73. +121 −0 src/plugins/meteor/__tests__/swarm.js
  74. +33 −8 src/plugins/meteor/assets/meteor-deploy-check.sh
  75. +10 −0 src/plugins/meteor/assets/meteor-destroy.sh
  76. +14 −2 src/plugins/meteor/assets/meteor-start.sh
  77. +50 −11 src/plugins/meteor/assets/prepare-bundle.sh
  78. +21 −0 src/plugins/meteor/assets/start-swarm.sh
  79. +0 −45 src/plugins/meteor/assets/swarm/start.sh
  80. +32 −6 src/plugins/meteor/assets/templates/start.sh
  81. +1 −6 src/plugins/meteor/build.js
  82. +338 −183 src/plugins/meteor/command-handlers.js
  83. +31 −5 src/plugins/meteor/commands.js
  84. +16 −8 src/plugins/meteor/index.js
  85. +123 −26 src/plugins/meteor/status.js
  86. +154 −8 src/plugins/meteor/utils.js
  87. +6 −3 src/plugins/meteor/validate.js
  88. +18 −3 src/plugins/mongo/__tests__/index.js
  89. +21 −40 src/plugins/mongo/assets/mongo-start.sh
  90. +56 −0 src/plugins/mongo/assets/templates/start.sh
  91. +47 −59 src/plugins/mongo/command-handlers.js
  92. +7 −1 src/plugins/mongo/commands.js
  93. +6 −1 src/plugins/mongo/index.js
  94. +4 −1 src/plugins/mongo/validate.js
  95. +11 −4 src/plugins/proxy/__tests__/index.js
  96. +5 −0 src/plugins/proxy/assets/cleanup-template.sh
  97. +2 −2 src/plugins/proxy/assets/nginx-config.sh
  98. +365 −0 src/plugins/proxy/assets/nginx.tmpl
  99. +16 −0 src/plugins/proxy/assets/proxy-setup.sh
  100. +10 −4 src/plugins/proxy/assets/proxy-stop.sh
  101. +53 −0 src/plugins/proxy/assets/service-configure.sh
  102. +33 −10 src/plugins/proxy/assets/templates/start.sh
  103. +37 −0 src/plugins/proxy/assets/upstream.sh
  104. +92 −17 src/plugins/proxy/command-handlers.js
  105. +41 −17 src/plugins/proxy/index.js
  106. +51 −0 src/plugins/proxy/utils.js
  107. +16 −2 src/plugins/proxy/validate.js
  108. +24 −29 src/server-info.js
  109. +108 −0 src/status.js
  110. +16 −6 src/swarm-options.js
  111. +104 −49 src/swarm-utils.js
  112. +31 −0 src/tasks/assets/create-service.sh
  113. +6 −0 src/tasks/assets/restart-service.sh
  114. +6 −0 src/tasks/assets/stop-service.sh
  115. +17 −0 src/tasks/assets/update-service.sh
  116. +176 −0 src/tasks/index.js
  117. +84 −57 src/updates.js
  118. +100 −19 src/utils.js
  119. +12 −1 src/validate/__tests__/index.unit.js
  120. +10 −6 src/validate/index.js
  121. +3 −2 src/validate/servers.js
  122. +2 −1 src/validate/utils.js
  123. +1 −1 tests/clean-shrinkwrap.js
  124. +26 −6 tests/fixtures/Dockerfile
  125. +7 −4 tests/fixtures/Dockerfile_docker
  126. +157 −0 tests/fixtures/docker.conf
  127. +0 −7 tests/fixtures/helloapp/.meteor/packages
  128. +0 −8 tests/fixtures/helloapp/.meteor/versions
  129. +5 −0 tests/fixtures/project-1/mup.buildkit.js
  130. +5 −0 tests/fixtures/project-1/mup.db-name.js
  131. +2 −2 tests/fixtures/project-1/mup.js
  132. +7 −0 tests/fixtures/project-1/mup.no-bridge.js
  133. +3 −0 tests/fixtures/project-1/mup.old.js
  134. +7 −0 tests/fixtures/project-1/mup.user-network.js
  135. +1 −1 tests/fixtures/project-2/mup.js
  136. +1 −1 tests/fixtures/project-3/mup.js
  137. +35 −0 tests/fixtures/project-swarm/mup.js
  138. +1 −0 tests/fixtures/project-swarm/settings.json
  139. +39 −11 tests/run.js
  140. +2 −20 tests/setup.js
  141. +2 −0 tests/validate-docs.js
5 changes: 2 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -45,13 +45,11 @@ rules:
array-bracket-spacing:
- 2
- never
arrow-spacing: 2
block-scoped-var: 2
brace-style:
- 2
- 1tbs
- allowSingleLine: true
callback-return: 2
camelcase:
- 2
- properties: always
@@ -259,6 +257,7 @@ rules:
keyword-spacing:
- 2
- before: true
after: true
space-before-blocks:
- 2
- always
@@ -291,4 +290,4 @@ rules:
newline-per-chained-call: 0
class-methods-use-this: 0
no-empty-function: 0
sort-imports: [2, { memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], ignoreCase: true }]
sort-imports: [2, { memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], ignoreCase: true }]
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: [zodern] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: meteor-up # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -3,9 +3,9 @@ node_modules
.vscode
.idea
*.log
package-lock.json
docs/_site
coverage
tests/**/package-lock.json

tests/ssh/
.nyc_output/
21 changes: 11 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
sudo: required

language: node_js
node_js:
- "4"
- "8"

env:
- TEST_PLUGIN='default'
- TEST_PLUGIN='meteor'
- TEST_PLUGIN='mongo'
- TEST_PLUGIN='docker'
- TEST_PLUGIN='proxy'
jobs:
include:
- node_js: "8"
env: TEST_PLUGINS='meteor' TEST_OPTIONS="--non-root"
- node_js: "8"
env: TEST_PLUGINS='docker,mongo,proxy,default' TEST_OPTIONS="--non-root"
- node_js: "14"
env: TEST_PLUGINS='meteor'
- node_js: "14"
env: TEST_PLUGINS='docker,mongo,proxy,default'

services:
- docker

before_script:
- echo 'DOCKER_OPTS="--storage-driver=devicemapper"' | sudo tee --append /etc/default/docker >/dev/null && sudo service docker restart

script: npm run test -- --plugin="$TEST_PLUGIN" --skip-pull
script: npm run test -- --plugins="$TEST_PLUGINS" $TEST_OPTIONS
107 changes: 107 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,110 @@
## Next

- Fix selecting server for `mup ssh` and `mup meteor debug`

## 1.5.1 - June 2, 2020

- Fix some commands failing when using a non-root user on the server
- Fix deploying with privateDockerRegistry enabled.

## 1.5.0 - June 1, 2020

**Upgrading notes**

- Node 8 is now required to run `mup`. If you are using an older version, it will tell you and exit. This does not affect what versions of Meteor mup supports (Meteor 1.2 and newer)
- As always, you should run `mup setup` and `mup reconfig` after upgrading

**Load Balancing and Zero Downtime Deploys**

There are two different implementations for load balancing. This is the simpler one. The other one is mentioned under the `Swarm` section.

Mup is now able to use Nginx to load balance across multiple servers with sticky sessions. When this is used with at least two servers, there will be zero downtime during deploys.

How it works:
1. So the app is available to nginx instances on other servers, it will be exposed to the internet (or to the private network if the new `privateIp` option is configured for each server). In the future mup might setup a firewall to restrict access to the servers with nginx.
2. To avoid conflicts with other apps, it uses a random port between 10,000 and 20,000. The random number generator uses the app's name as a string.
3. When `mup setup` or `mup proxy setup` is run, a Nginx config is generated with a list of the server's private IP's, or, if that isn't available, their `host`.

Sticky sessions can be disabled for apps that do not need it.

**Private Docker Registry**

Mup can be configured to use a private docker registry, which allows it to deploy to multiple servers much faster. Instead of uploading the bundle and running Prepare Bundle task on every server, it can do that one a single server, store the image in the registry, and use that image on all of the other servers.

**Production Debugging of Meteor Server**

Run `mup meteor debug` to debug your Meteor app in production. It will enable debugging in your app and forward the port to your computer so you can use Chrome's DevTools for Node, Visual Studio Code, or another debugger for node. Requires Meteor 1.6 or newer.

**Swarm**

Meteor Up can now manage a docker swarm cluster. When swarm is enabled in the config, Meteor up sets up a swarm cluster on all of the servers listed in the config. During `mup setup`, it diffs the config given to it by plugins and the mup config with the current cluster state and carefully makes any needed adjustments to avoid unnecessarily disrupting running swarm services. Mup uses Docker Swarm instead of Kubernetes since it is simpler and uses fewer resources.

When using swarm, rolling deploys and load balancing are always enabled. This uses a different implementation than when load balancing without Docker Swarm without the downsides it has.

We have tried to make using swarm with Meteor Up as simple and reliable as possible. In the rare situation there is an error and you have to take manual action to resolve, in many cases mup gives a solution with the error.

- The app is deployed as a swarm service when swarm is enabled
- Reverse Proxy uses an overlay network when swarm is enabled for communication with the app instances
- The `proxy.servers` option has been added to list which servers to run the reverse proxy on. It is required when using docker swarm
- `mup docker status` shows a warning when the servers do not have the same docker version (@rolljee)
- When using swarm, the docker images created for the app use numerical tags (`1`, `2`, `3`) instead of `previous` and `current`. This is needed for swarm to correctly roll back failed deploys, but it will also give us more control over how many old versions to keep and allow manually rolling back

**Performance**
- Add `app.docker.useBuildKit` option. When enabled, it uses the new docker image builder which reduces time spent by Prepare Bundle by 60%
- When prepare bundle is enabled, mup waits 12 fewer seconds after starting the app and before verifying the deployment
- Tasks to configure the proxy are no longer run in serial, improving completion speed when there are many servers
- SSH sessions are reused between task lists to improve performance
- `mup mongo start` only starts/restarts the container if it isn't running or the start script has changed. This can greatly speed up `mup setup` since starting MongoDB was one of the slower tasks
- The update check no longer delays starting the cli and can be disabled by setting the environment variale `MUP_SKIP_UPDATE_CHECK=false`
- Replace `opencollective` with `opencollective-postinstall` for smaller message and fewer dependencies (@rolljee)

**Other Features**
- Add `--overview` option to `mup status`. It only shows the top-level status for each plugin and any problems
- Add an optional `mongo.dbName` option. Multiple apps can share a database by setting it to the same value in all of their configs
- Add `mup meteor destroy` command to stop and remove app from the servers
- Add optional `proxy.servers` option to specify which servers to run the reverse proxy on
- `mup ssh` now respects the `--servers` option

**Verifying Deployment**
- Fix Verifying Deployment taking longer than the value in `app.deployCheckWaitTime`
- Verifying Deployment now waits up to 25 seconds for each request to succeed, instead of 10
- Fix verifying deployment with non-root user

**Reduce common problems**

- Change `http` to `https` in the `ROOT_URL` environment variable when using the reverse proxy and SSL (@rolljee)
- `app.docker.imagePort` defaults to 3000 instead of 80. This change is backwards compatible with the common docker images, and simplifies using images that run the app with a non-root user
- Validation error shown when `app.servers` is empty

**Docs**
- Update docs and default config for Meteor 1.8 (@ninjaPixel)
- Add instructions for using Cloudflare with Let's Encrypt

**Bugs Fixed**
- The `NODE_VERSION` build arg is set when building the image during Prepare Bundle with the correct node version for the Meteor version the app is using. This fixes using the `zodern/meteor` image with newer versions of Meteor.
- Fix `mup reconfig` not able to remove environment variables that were set during the last deploy
- Fix using images that run the app on a port other than 80 with the reverse proxy
- When using the reverse proxy, the `VIRTUAL_PORT` environment variable is now set to the same value as `app.docker.imagePort`
- Prevent bash from modifying custom nginx configs (For example, strings prefixed with `$` were removed by bash)
- Show stderr from `remoteCommand` hooks
- Update Stop Mongo task name to use title case
- Fix some problems with stopping the proxy
- Fix `meteor status` when docker logs warnings
- Fix uploading custom certificates before app was set up

**Plugin API**
- `tasks` has functions that can add reusable tasks to task lists. The functions are:
- `addCreateService`
- `addUpdateService`
- `addCreateOrUpdateService`
- Yargs has been updated to 12.0.5. For backwards compatibility, commands with an empty description continue to be hidden. (rolljee)
- `runSSHCommand` can also accept a session instead of a server object. It is recommended to use sessions since mup now reuses them
- output from `runSSHCommand` will now also include stderr
- `validateConfig` has an additional parameter `logProblems` to enable showing validation errors
- `validationErrors` has errors even when `getConfig(false)` was used
- `VALIDATE_OPTIONS` has `noDefaults: true` set
- Add `StatusDisplay` class to help with printing the status and deciding what to show when `--overview` is used

## 1.4.6 - April 27, 2019
- Mongo and nginx logs are now rotated and limited to 700mb
- Fix error when running `mup setup` without a `servers` object in the config.
33 changes: 30 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -42,15 +42,42 @@ To run the test in parallel, add a matching regex to the `<meteor-up dir>/tests/

`--path <test files>` Defaults to `src/**/__tests__/**/*.js`

`--plugin <plugin name>` Runs tests for plugin. Overrides `--path`
`--plugins mocha,meter` Runs tests for the plugins, separated by commas. Overrides `--path`

`--skip-pull` To speedup running the tests, it creates a docker image before the first run that has docker installed and has pulled all of the images used during the tests. This option disables creating or using the image.
`--non-root` Uses a non-root user in the docker container it deploys to

For example:
```
npm test -- --watch
```

## Updating the Docs

The `/docs` directory contains the docs hosted at [meteor-up.com](http://meteor-up.com). To run the docs website locally:

##### 1 - Install NPM dependencies

```
npm install
```

##### 2 - Set-up Jekyll
Follow the [official docs](https://jekyllrb.com/docs/installation/) for instruction on how to set-up Jekyll on your system.


##### 3 - Install Gems
```
cd docs
bundle install
```

##### 4 - Build and serve the website
```
cd ..
npm run docs
```

The webiste will now be running at [http://localhost:8080/](http://localhost:8080/).

## Financial contributions

@@ -87,4 +114,4 @@ Thank you to all our sponsors! (please ask your company to also support this ope
<a href="https://opencollective.com/meteor-up/sponsor/6/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/7/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/8/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/9/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/meteor-up/sponsor/9/website" target="_blank"><img src="https://opencollective.com/meteor-up/sponsor/9/avatar.svg"></a>
3 changes: 1 addition & 2 deletions docs/.stylelintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "stylelint-config-standard",
"ignoreFiles": [
"css/bootstrap.min.css",
"css/tocbot.css",
"css/highlight.css"
]
}
}
1 change: 0 additions & 1 deletion docs/Gemfile
Original file line number Diff line number Diff line change
@@ -25,4 +25,3 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Loading