@automattic/vip 2.0.12 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +34 -1
- package/README.md +95 -0
- package/assets/{dev-environment.lando.template.yml.ejs → dev-env.lando.template.yml.ejs} +61 -50
- package/assets/dev-env.nginx.template.conf.ejs +13 -0
- package/dist/bin/vip-app.js +9 -9
- package/dist/bin/vip-config-envvar-delete.js +93 -0
- package/dist/bin/vip-config-envvar-get-all.js +94 -0
- package/dist/bin/vip-config-envvar-get.js +79 -0
- package/dist/bin/vip-config-envvar-list.js +91 -0
- package/dist/bin/vip-config-envvar-set.js +112 -0
- package/dist/bin/vip-config-envvar.js +23 -0
- package/dist/bin/vip-config.js +20 -0
- package/dist/bin/vip-dev-env-create.js +27 -12
- package/dist/bin/vip-dev-env-destroy.js +6 -7
- package/dist/bin/vip-dev-env-exec.js +9 -10
- package/dist/bin/vip-dev-env-import-media.js +45 -0
- package/dist/bin/vip-dev-env-import-sql.js +70 -0
- package/dist/bin/vip-dev-env-import.js +32 -0
- package/dist/bin/vip-dev-env-info.js +5 -6
- package/dist/bin/vip-dev-env-start.js +24 -4
- package/dist/bin/vip-dev-env-stop.js +4 -5
- package/dist/bin/vip-dev-env.js +2 -2
- package/dist/bin/vip-import-media-abort.js +4 -4
- package/dist/bin/vip-import-media.js +6 -6
- package/dist/bin/vip-import-sql.js +8 -3
- package/dist/bin/vip-search-replace.js +1 -1
- package/dist/bin/vip-sync.js +11 -11
- package/dist/bin/vip-wp.js +14 -14
- package/dist/bin/vip.js +15 -16
- package/dist/lib/api.js +3 -1
- package/dist/lib/cli/apiConfig.js +3 -17
- package/dist/lib/cli/command.js +45 -31
- package/dist/lib/cli/format.js +19 -15
- package/dist/lib/cli/prompt.js +2 -2
- package/dist/lib/client-file-uploader.js +7 -7
- package/dist/lib/constants/dev-environment.js +2 -1
- package/dist/lib/dev-environment/dev-environment-cli.js +57 -26
- package/dist/lib/dev-environment/dev-environment-core.js +113 -29
- package/dist/lib/dev-environment/dev-environment-lando.js +90 -15
- package/dist/lib/envvar/api-delete.js +56 -0
- package/dist/lib/envvar/api-get-all.js +59 -0
- package/dist/lib/envvar/api-get.js +24 -0
- package/dist/lib/envvar/api-list.js +60 -0
- package/dist/lib/envvar/api-set.js +58 -0
- package/dist/lib/envvar/api.js +104 -0
- package/dist/lib/envvar/input.js +55 -0
- package/dist/lib/envvar/logging.js +33 -0
- package/dist/lib/envvar/read-file.js +43 -0
- package/dist/lib/keychain/insecure.js +6 -6
- package/dist/lib/keychain.js +5 -5
- package/dist/lib/media-import/progress.js +0 -5
- package/dist/lib/media-import/status.js +8 -3
- package/dist/lib/search-and-replace.js +1 -1
- package/dist/lib/site-import/status.js +6 -5
- package/dist/lib/token.js +7 -7
- package/dist/lib/tracker.js +4 -4
- package/dist/lib/validations/is-multi-site-sql-dump.js +3 -3
- package/dist/lib/validations/line-by-line.js +1 -1
- package/dist/lib/validations/sql.js +0 -18
- package/helpers/check-version.js +5 -1
- package/jest.setupMocks.js +1 -0
- package/package.json +35 -25
- package/assets/dev-environment.wp-config-defaults.php +0 -109
- package/dist/bin/vip-dev-environment-create.js +0 -58
- package/dist/bin/vip-dev-environment-destroy.js +0 -48
- package/dist/bin/vip-dev-environment-info.js +0 -58
- package/dist/bin/vip-dev-environment-start.js +0 -54
- package/dist/bin/vip-dev-environment-stop.js +0 -56
- package/dist/bin/vip-dev-environment.js +0 -23
- package/dist/lib/dev-environment.js +0 -335
package/CONTRIBUTING.md
CHANGED
|
@@ -26,12 +26,38 @@ VIP_PROXY="" API_HOST=http://localhost:4000 node ./dist/bin/vip -- wp option get
|
|
|
26
26
|
|
|
27
27
|
### Adding commands
|
|
28
28
|
|
|
29
|
-
* New command names should use the singular
|
|
29
|
+
* New command names should use the singular form (e.g. site vs sites).
|
|
30
|
+
* Add new commands to `package.json#bin`.
|
|
31
|
+
* Run `npm link` so that `arg` knows how to spawn the command locally. (Skipping this step will result in `Error: spawn vip-command ENOENT`.)
|
|
30
32
|
|
|
31
33
|
### Adding libraries
|
|
32
34
|
|
|
33
35
|
New libraries should generally support both CLI and web contexts, though some cases that won't make sense (e.g. formatting for CLI output). Ensuring the libraries are useful everywhere will allow us to offer consistent experiences regardless of the interface.
|
|
34
36
|
|
|
37
|
+
## Release & Deployment Process
|
|
38
|
+
|
|
39
|
+
Our release flow for VIP CLI follows this pattern:
|
|
40
|
+
|
|
41
|
+
**_feature branch -> develop branch -> master branch -> NPM release_**
|
|
42
|
+
|
|
43
|
+
- For feature branches, please follow A8C branch naming conventions (e.g.- `add/data-sync-command`, `fix/subsite-launch-command`, etc.)
|
|
44
|
+
- Include a Changelog for all npm version releases, including any minor or major versions
|
|
45
|
+
- This is a public repository. Please do not include any internal links in PRs, changelogs, testing instructions, etc.
|
|
46
|
+
- Merge changes from your feature branch to the `develop` branch
|
|
47
|
+
- Please do not merge any changes into the `master` branch yet. All features/changes that are not ready to be public should stay in the `develop` branch to avoid conflicts when releasing urgent fixes.
|
|
48
|
+
- Changes from the `develop` branch are merged to `master` and released on NPM following our release schedule
|
|
49
|
+
- Any team member that is part of our NPM organization can release new minor or major versions, but please have a Customer Experience (Pâtisserie) team member look over the changes first.
|
|
50
|
+
|
|
51
|
+
### Changelogs
|
|
52
|
+
Changelogs allow customers to keep up with all the changes happening across our VIP Platform. Changelogs for VIP CLI are posted to the V[VIP Cloud Changelog P2](https://wpvipchangelog.wordpress.com/), along with the repository’s `README.md`.
|
|
53
|
+
|
|
54
|
+
### Release Schedule
|
|
55
|
+
We deploy changes from our `develop` branch to the `master` branch on Tuesdays from 4AM to 5PM Pacific Time.
|
|
56
|
+
|
|
57
|
+
Changes that are not ready to be publicly released should stay in the `develop` branch to avoid conflicts with any urgent fixes we may need to roll out. Fixes for urgent or breaking bugs may be merged straight to the `master` branch and released publicly via npm at any time outside of our release schedule.
|
|
58
|
+
|
|
59
|
+
All other changes should follow the schedule so that we can monitor the newly released changes.
|
|
60
|
+
|
|
35
61
|
## Releasing / Publishing
|
|
36
62
|
|
|
37
63
|
### Pre-publish Checks
|
|
@@ -58,6 +84,13 @@ Prepare the release by making sure that:
|
|
|
58
84
|
1. The [changelog](https://github.com/Automattic/vip/blob/master/README.md#changelog) has been updated on `master`.
|
|
59
85
|
1. All tests pass and your working directory is clean (we have pre-publish checks to catch this, just-in-case).
|
|
60
86
|
|
|
87
|
+
#### Changelog Generator Hint:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
export LAST_RELEASE_DATE=2021-08-25T13:40:00+02
|
|
91
|
+
gh pr list --search "is:merged sort:updated-desc closed:>$LAST_RELEASE_DATE" | sed -e 's/\s*\S\+\s*\S\+\s*$//' -e 's/^/- #/'
|
|
92
|
+
```
|
|
93
|
+
|
|
61
94
|
Then, let's publish:
|
|
62
95
|
|
|
63
96
|
1. Set the version (via `npm version minor` or `npm version major` or `npm version patch`)
|
package/README.md
CHANGED
|
@@ -17,12 +17,105 @@ vip
|
|
|
17
17
|
|
|
18
18
|
If you need more information, check out our [VIP CLI documentation](https://docs.wpvip.com/technical-references/vip-cli/).
|
|
19
19
|
|
|
20
|
+
## Contributing
|
|
21
|
+
|
|
22
|
+
For help with contributing to this project, including instructions for local development, please see [CONTRIBUTING](CONTRIBUTING.md) and [SECURITY](SECURITY.md).
|
|
23
|
+
|
|
20
24
|
## Analytics
|
|
21
25
|
|
|
22
26
|
By default, we record information about the usage of this tool using an in-house analytics sytem. If you would prefer to opt-out of this data collection, you can do so via the `DO_NOT_TRACK` environment variable. You may either export it in your shell configuration or specify it on the command line (e.g. `DO_NOT_TRACK=1 vip app list`).
|
|
23
27
|
|
|
24
28
|
## Changelog
|
|
25
29
|
|
|
30
|
+
### 2.2.0 (27 October 2021)
|
|
31
|
+
|
|
32
|
+
New: Environment variables command
|
|
33
|
+
- #896 Open config envvar command for all customers
|
|
34
|
+
- #876 Update envvar list command to only show names
|
|
35
|
+
- #879 Add config envvar get and get-all commands
|
|
36
|
+
- #875 Temporarily gate access to new config command to VIP staff
|
|
37
|
+
- #858 Environment variable CLI commands (list, set, delete)
|
|
38
|
+
|
|
39
|
+
Fixes:
|
|
40
|
+
- #901 Don't mark import as failed until restore has completed
|
|
41
|
+
- #899 Proxy fix + healthchecks
|
|
42
|
+
- #894 support windows db import
|
|
43
|
+
- #889 Proxy config change
|
|
44
|
+
- #888 mount wordpress code
|
|
45
|
+
- #872 Auto flush cache after import and add vipgo user
|
|
46
|
+
- #869 Media redirect to production site.
|
|
47
|
+
- #885 Make search data persistent between restarts
|
|
48
|
+
- #844 Expose DB and expose extra services in info table
|
|
49
|
+
- #865 spawn WP-CLI as root to allow for FS operations
|
|
50
|
+
- #895 Fix rmdir deprecation warning
|
|
51
|
+
- #870 Add the VIP CLI release process and release schedule
|
|
52
|
+
|
|
53
|
+
Dependencies updates:
|
|
54
|
+
- #778 Update dependency ini to v2
|
|
55
|
+
- #786 Update dependency keytar to v7
|
|
56
|
+
- #884 Update dependency cli-columns to v4
|
|
57
|
+
- #887 Update dependency lando to v3.4.3
|
|
58
|
+
- #874 Update dependency lando to v3.4.0
|
|
59
|
+
- #750 Bump hosted-git-info from 2.8.8 to 2.8.9
|
|
60
|
+
- #877 Bump tmpl from 1.0.4 to 1.0.5
|
|
61
|
+
|
|
62
|
+
https://github.com/Automattic/vip/releases/tag/v2.2.0
|
|
63
|
+
|
|
64
|
+
### 2.1.0 (16 September 2021)
|
|
65
|
+
|
|
66
|
+
- #857 Remove select DB checks
|
|
67
|
+
- #864 Adding WordPress versions to dev-env
|
|
68
|
+
- #868 persist database data in between container restarts
|
|
69
|
+
- #862 Fix lint warnings
|
|
70
|
+
- #867 Update dependency lando to v3.3.2
|
|
71
|
+
- #863 Add links to CONTRIBUTING and SECURITY
|
|
72
|
+
- #855 Add some helpful hints for new command scaffolding
|
|
73
|
+
- #856 Adding media import command on dev environment
|
|
74
|
+
- #849 Adding SQL import to dev environment
|
|
75
|
+
- #854 Updating command descriptions and arguments on dev-env
|
|
76
|
+
- #850 Use official memcached image on dev-env
|
|
77
|
+
- #853 Enable ssl forwarding on dev-env
|
|
78
|
+
- #851 Conditionally disabling statsd on mu-plugins
|
|
79
|
+
- #852 Fixing Prettier format annotation typo
|
|
80
|
+
- #843 Removing custom wp-config-defaults
|
|
81
|
+
- #848 Not using a prefix to all dev environments
|
|
82
|
+
- #847 Update dependency lando to v3.3.0
|
|
83
|
+
- #840 Use official Elasticsearch image on dev-env
|
|
84
|
+
- #845 Fix MariaDB healthcheck
|
|
85
|
+
- #846 dev-env: Update error message for directory prompt
|
|
86
|
+
- #842 Removing PHP parameter from dev environment
|
|
87
|
+
- #839 Use official MariaDB image and enable version selection on dev-env
|
|
88
|
+
|
|
89
|
+
https://github.com/Automattic/vip/releases/tag/v2.1.0
|
|
90
|
+
|
|
91
|
+
### 2.0.14 (26 August 2021)
|
|
92
|
+
|
|
93
|
+
- Update dependency graphql to v15.5.1 #796
|
|
94
|
+
- Update dependency graphql-tag to v2.12.5 #799
|
|
95
|
+
- Update dependency debug to v4.3.2 #806
|
|
96
|
+
- Remove fake data dev-env commands #830
|
|
97
|
+
- Disable statsd by default #831
|
|
98
|
+
- Support ES version option #832
|
|
99
|
+
- Removing mu-plugins test command #835
|
|
100
|
+
- Making PHPMyAdmin optional on dev-env #836
|
|
101
|
+
- Patching Docker for Windows in dev-env #837
|
|
102
|
+
- enable/disable xdebug #838
|
|
103
|
+
|
|
104
|
+
https://github.com/Automattic/vip/releases/tag/v2.0.14
|
|
105
|
+
|
|
106
|
+
### 2.0.13 (19 August 2021)
|
|
107
|
+
|
|
108
|
+
- Allow user to run multisite import even if wpSites.nodes doesn't exist. #815
|
|
109
|
+
- Bumping version number to 2.0.12 #827
|
|
110
|
+
- Path resolving fixes #829
|
|
111
|
+
- Send header each time #826
|
|
112
|
+
- Sets up a volume for media files #825
|
|
113
|
+
- Update dependency chalk to v4.1.2 #813
|
|
114
|
+
- Update dependency lando to v3.1.4 #797
|
|
115
|
+
- Upgrading statsd container to 0.9.0 #828
|
|
116
|
+
|
|
117
|
+
https://github.com/Automattic/vip/releases/tag/v2.0.13
|
|
118
|
+
|
|
26
119
|
### 2.0.12 (13 August 2021)
|
|
27
120
|
|
|
28
121
|
- Using new VIP Docker images for dev-env #818
|
|
@@ -30,6 +123,8 @@ By default, we record information about the usage of this tool using an in-house
|
|
|
30
123
|
- Increasing dev-env PMA upload limit to 4G #822
|
|
31
124
|
- PIE-2890 Fixes issue where user is unable to login after logout #823
|
|
32
125
|
|
|
126
|
+
https://github.com/Automattic/vip/releases/tag/v2.0.12
|
|
127
|
+
|
|
33
128
|
### 2.0.11 (5 August 2021)
|
|
34
129
|
- Handle parameter validation in a consistent way #795
|
|
35
130
|
- Fix error blocking data sync on CLI sites #810
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: <%= siteSlug %>
|
|
2
2
|
env_file:
|
|
3
3
|
- .env
|
|
4
4
|
proxy:
|
|
@@ -12,7 +12,7 @@ services:
|
|
|
12
12
|
devtools:
|
|
13
13
|
type: compose
|
|
14
14
|
services:
|
|
15
|
-
image: ghcr.io/automattic/vip-container-images/dev-tools:0.
|
|
15
|
+
image: ghcr.io/automattic/vip-container-images/dev-tools:0.7
|
|
16
16
|
command: sleep infinity
|
|
17
17
|
volumes:
|
|
18
18
|
- devtools:/dev-tools
|
|
@@ -21,18 +21,25 @@ services:
|
|
|
21
21
|
|
|
22
22
|
nginx:
|
|
23
23
|
type: compose
|
|
24
|
+
ssl: true
|
|
25
|
+
sslExpose: false
|
|
24
26
|
services:
|
|
25
|
-
image: ghcr.io/automattic/vip-container-images/nginx:1.21.
|
|
27
|
+
image: ghcr.io/automattic/vip-container-images/nginx:1.21.3
|
|
26
28
|
command: nginx -g "daemon off;"
|
|
27
29
|
volumes:
|
|
30
|
+
- ./nginx/extra.conf:/etc/nginx/conf.extra/extra.conf
|
|
28
31
|
<% wpVolumes() %>
|
|
29
32
|
|
|
30
33
|
php:
|
|
31
34
|
type: compose
|
|
32
35
|
services:
|
|
33
36
|
image: ghcr.io/automattic/vip-container-images/php-fpm:7.4
|
|
34
|
-
command:
|
|
37
|
+
command: run.sh
|
|
35
38
|
working_dir: /wp
|
|
39
|
+
environment:
|
|
40
|
+
XDEBUG: <%= xdebug ? 'enable' : 'disable' %>
|
|
41
|
+
STATSD: <%= statsd ? 'enable' : 'disable' %>
|
|
42
|
+
|
|
36
43
|
volumes:
|
|
37
44
|
- type: volume
|
|
38
45
|
source: devtools
|
|
@@ -40,17 +47,35 @@ services:
|
|
|
40
47
|
volume:
|
|
41
48
|
nocopy: true
|
|
42
49
|
<% wpVolumes() %>
|
|
43
|
-
|
|
44
|
-
run_as_root:
|
|
50
|
+
run:
|
|
45
51
|
- sh /dev-tools/setup.sh database root "http://<%= siteSlug %>.vipdev.lndo.site/" "<%= wpTitle %>" <% if ( multisite ) { %> <%= siteSlug %>.vipdev.lndo.site <% } %>
|
|
52
|
+
run_as_root:
|
|
53
|
+
- echo "Copying dev-env-plugin.php to mu-plugins"
|
|
54
|
+
- cp /dev-tools/dev-env-plugin.php /wp/wp-content/mu-plugins/
|
|
46
55
|
|
|
47
56
|
database:
|
|
48
|
-
type:
|
|
49
|
-
|
|
57
|
+
type: compose
|
|
58
|
+
services:
|
|
59
|
+
image: mariadb:<%= mariadb %>
|
|
60
|
+
command: docker-entrypoint.sh mysqld
|
|
61
|
+
ports:
|
|
62
|
+
- ":3306"
|
|
63
|
+
healthcheck:
|
|
64
|
+
test: 'mysql -uroot --silent --execute "SHOW DATABASES;"'
|
|
65
|
+
environment:
|
|
66
|
+
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 'true'
|
|
67
|
+
volumes:
|
|
68
|
+
- database_data:/var/lib/mysql
|
|
69
|
+
volumes:
|
|
70
|
+
database_data:
|
|
50
71
|
|
|
51
72
|
memcached:
|
|
52
|
-
type: memcached:
|
|
73
|
+
type: memcached:custom
|
|
74
|
+
overrides:
|
|
75
|
+
image: memcached:1.6-alpine3.14
|
|
76
|
+
command: docker-entrypoint.sh memcached
|
|
53
77
|
|
|
78
|
+
<% if ( phpmyadmin ) { %>
|
|
54
79
|
phpmyadmin:
|
|
55
80
|
type: phpmyadmin
|
|
56
81
|
hosts:
|
|
@@ -58,32 +83,43 @@ services:
|
|
|
58
83
|
overrides:
|
|
59
84
|
environment:
|
|
60
85
|
UPLOAD_LIMIT: 4G
|
|
86
|
+
<% } %>
|
|
61
87
|
|
|
62
88
|
vip-search:
|
|
63
|
-
type:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
type: compose
|
|
90
|
+
services:
|
|
91
|
+
image: elasticsearch:<%= elasticsearch %>
|
|
92
|
+
command: /usr/local/bin/docker-entrypoint.sh
|
|
93
|
+
environment:
|
|
94
|
+
ELASTICSEARCH_IS_DEDICATED_NODE: 'no'
|
|
95
|
+
ELASTICSEARCH_CLUSTER_NAME: 'bespin'
|
|
96
|
+
ELASTICSEARCH_NODE_NAME: 'lando'
|
|
97
|
+
ELASTICSEARCH_PORT_NUMBER: 9200
|
|
98
|
+
discovery.type: 'single-node'
|
|
99
|
+
ports:
|
|
100
|
+
- ":9200"
|
|
101
|
+
healthcheck:
|
|
102
|
+
test: "curl --noproxy '*' -XGET localhost:9200"
|
|
103
|
+
volumes:
|
|
104
|
+
- search_data:/usr/share/elasticsearch/data
|
|
105
|
+
volumes:
|
|
106
|
+
search_data:
|
|
67
107
|
|
|
108
|
+
<% if ( statsd ) { %>
|
|
68
109
|
statsd:
|
|
69
110
|
type: compose
|
|
70
111
|
services:
|
|
71
|
-
image: ghcr.io/automattic/vip-container-images/statsd:v0.
|
|
112
|
+
image: ghcr.io/automattic/vip-container-images/statsd:v0.9.0
|
|
72
113
|
command: node stats.js /config/statsd-config.js
|
|
114
|
+
<% } %>
|
|
73
115
|
|
|
74
|
-
# Code containers
|
|
75
|
-
|
|
76
|
-
<% if ( wordpress.mode == 'image' ) { %>
|
|
77
116
|
wordpress:
|
|
78
117
|
type: compose
|
|
79
118
|
services:
|
|
80
119
|
image: <%= wordpress.image %>:<%= wordpress.tag %>
|
|
81
120
|
command: sh -c "rsync -a /wp/ /shared/; sleep infinity"
|
|
82
121
|
volumes:
|
|
83
|
-
- wordpress:/shared
|
|
84
|
-
volumes:
|
|
85
|
-
wordpress: {}
|
|
86
|
-
<% } %>
|
|
122
|
+
- ./wordpress:/shared
|
|
87
123
|
|
|
88
124
|
<% if ( muPlugins.mode == 'image' ) { %>
|
|
89
125
|
mu-plugins:
|
|
@@ -125,26 +161,9 @@ tooling:
|
|
|
125
161
|
wp:
|
|
126
162
|
service: php
|
|
127
163
|
description: "Run WP-CLI command"
|
|
164
|
+
user: root
|
|
128
165
|
cmd:
|
|
129
|
-
- wp
|
|
130
|
-
|
|
131
|
-
test:
|
|
132
|
-
service: php
|
|
133
|
-
description: "Run all tests: lando test"
|
|
134
|
-
cmd:
|
|
135
|
-
- cd /wp/wp-content/mu-plugins && phpunit
|
|
136
|
-
|
|
137
|
-
add-fake-data:
|
|
138
|
-
service: php
|
|
139
|
-
description: "Add fake data described in '/configs/fixtures/test_fixtures.yml'. You can also use 'wp fixtures' directly to aim it at other files within lando."
|
|
140
|
-
cmd:
|
|
141
|
-
- wp fixtures load --file=/app/configs/fixtures/test_fixtures.yml
|
|
142
|
-
|
|
143
|
-
delete-fake-data:
|
|
144
|
-
service: php
|
|
145
|
-
description: "Delete all fake data generated by 'wp fixtures'"
|
|
146
|
-
cmd:
|
|
147
|
-
- wp fixtures delete
|
|
166
|
+
- wp --allow-root
|
|
148
167
|
|
|
149
168
|
add-site:
|
|
150
169
|
service: php
|
|
@@ -159,18 +178,10 @@ tooling:
|
|
|
159
178
|
- mysql -hdatabase -uwordpress -pwordpress wordpress
|
|
160
179
|
|
|
161
180
|
<% function wpVolumes() { %>
|
|
162
|
-
- ./config/wp-config-defaults.php:/wp/config/wp-config-defaults.php
|
|
163
181
|
- ./config:/wp/config
|
|
164
182
|
- ./log:/wp/log
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
source: wordpress
|
|
168
|
-
target: /wp
|
|
169
|
-
volume:
|
|
170
|
-
nocopy: true
|
|
171
|
-
<% } else { %>
|
|
172
|
-
- <%= wordpress.dir %>:/wp
|
|
173
|
-
<% } %>
|
|
183
|
+
- ./uploads:/wp/wp-content/uploads
|
|
184
|
+
- ./wordpress:/wp
|
|
174
185
|
<% if ( muPlugins.mode == 'image' ) { %>
|
|
175
186
|
- type: volume
|
|
176
187
|
source: mu-plugins
|
package/dist/bin/vip-app.js
CHANGED
|
@@ -31,7 +31,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
31
|
|
|
32
32
|
try {
|
|
33
33
|
res = await (0, _app.default)(arg[0], 'id,repo,name,environments{id,appId,name,type,branch,currentCommit,primaryDomain{name},launched}');
|
|
34
|
-
} catch (
|
|
34
|
+
} catch (err) {
|
|
35
35
|
await (0, _tracker.trackEvent)('app_command_fetch_error', {
|
|
36
36
|
error: `App ${arg[0]} does not exist`
|
|
37
37
|
});
|
|
@@ -49,7 +49,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
49
49
|
|
|
50
50
|
await (0, _tracker.trackEvent)('app_command_success'); // Clone the read-only response object so we can modify it
|
|
51
51
|
|
|
52
|
-
const
|
|
52
|
+
const clonedResponse = Object.assign({}, res);
|
|
53
53
|
const header = [{
|
|
54
54
|
key: 'id',
|
|
55
55
|
value: res.id
|
|
@@ -60,17 +60,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
60
60
|
key: 'repo',
|
|
61
61
|
value: res.repo
|
|
62
62
|
}];
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
63
|
+
clonedResponse.environments = clonedResponse.environments.map(env => {
|
|
64
|
+
const clonedEnv = Object.assign({}, env);
|
|
65
|
+
clonedEnv.name = (0, _command.getEnvIdentifier)(env); // Use the short version of git commit hash
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
clonedEnv.currentCommit = clonedEnv.currentCommit.substring(0, 7); // Flatten object
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
return
|
|
69
|
+
clonedEnv.primaryDomain = clonedEnv.primaryDomain.name;
|
|
70
|
+
return clonedEnv;
|
|
71
71
|
});
|
|
72
72
|
return {
|
|
73
73
|
header,
|
|
74
|
-
data:
|
|
74
|
+
data: clonedResponse.environments
|
|
75
75
|
};
|
|
76
76
|
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
exports.deleteEnvVarCommand = deleteEnvVarCommand;
|
|
17
|
+
|
|
18
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
19
|
+
|
|
20
|
+
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
21
|
+
|
|
22
|
+
var _api = require("../lib/envvar/api");
|
|
23
|
+
|
|
24
|
+
var _input = require("../lib/envvar/input");
|
|
25
|
+
|
|
26
|
+
var _logging = require("../lib/envvar/logging");
|
|
27
|
+
|
|
28
|
+
var _rollbar = require("../lib/rollbar");
|
|
29
|
+
|
|
30
|
+
var _tracker = require("../lib/tracker");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Internal dependencies
|
|
36
|
+
*/
|
|
37
|
+
const baseUsage = 'vip config envvar delete'; // Command examples
|
|
38
|
+
|
|
39
|
+
const examples = [{
|
|
40
|
+
usage: `${baseUsage} MY_VARIABLE`,
|
|
41
|
+
description: 'Permanently deletes the environment variable "MY_VARIABLE"'
|
|
42
|
+
}];
|
|
43
|
+
|
|
44
|
+
async function deleteEnvVarCommand(arg, opt) {
|
|
45
|
+
// Help the user by uppercasing input.
|
|
46
|
+
const name = arg[0].trim().toUpperCase();
|
|
47
|
+
const trackingParams = {
|
|
48
|
+
app_id: opt.app.id,
|
|
49
|
+
command: `${baseUsage} ${name}`,
|
|
50
|
+
env_id: opt.env.id,
|
|
51
|
+
org_id: opt.app.organization.id,
|
|
52
|
+
skip_confirm: !!opt.skipConfirmation,
|
|
53
|
+
variable_name: name
|
|
54
|
+
};
|
|
55
|
+
(0, _logging.debug)(`Request: Delete environment variable ${JSON.stringify(name)} for ${(0, _logging.getEnvContext)(opt.app, opt.env)}`);
|
|
56
|
+
await (0, _tracker.trackEvent)('envvar_delete_command_execute', trackingParams);
|
|
57
|
+
|
|
58
|
+
if (!(0, _api.validateNameWithMessage)(name)) {
|
|
59
|
+
await (0, _tracker.trackEvent)('envvar_delete_invalid_name', trackingParams);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!opt.skipConfirmation) {
|
|
64
|
+
await (0, _input.promptForValue)(`Type ${name} to confirm deletion:`, name).catch(async () => {
|
|
65
|
+
await (0, _tracker.trackEvent)('envvar_delete_user_cancelled_input', trackingParams);
|
|
66
|
+
(0, _input.cancel)();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (!(await (0, _input.confirm)(`Are you sure? ${_chalk.default.bold.red('Deletion is permanent')} (y/N)`))) {
|
|
70
|
+
await (0, _tracker.trackEvent)('envvar_delete_user_cancelled_confirmation', trackingParams);
|
|
71
|
+
(0, _input.cancel)();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await (0, _api.deleteEnvVar)(opt.app.id, opt.env.id, name).catch(async err => {
|
|
76
|
+
_rollbar.rollbar.error(err);
|
|
77
|
+
|
|
78
|
+
await (0, _tracker.trackEvent)('envvar_delete_mutation_error', { ...trackingParams,
|
|
79
|
+
error: err.message
|
|
80
|
+
});
|
|
81
|
+
throw err;
|
|
82
|
+
});
|
|
83
|
+
await (0, _tracker.trackEvent)('envvar_delete_command_success', trackingParams);
|
|
84
|
+
console.log(_chalk.default.green(`Successfully deleted environment variable ${JSON.stringify(name)}`));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
(0, _command.default)({
|
|
88
|
+
appContext: true,
|
|
89
|
+
appQuery: _api.appQuery,
|
|
90
|
+
envContext: true,
|
|
91
|
+
requiredArgs: 1,
|
|
92
|
+
usage: `${baseUsage} <VARIABLE_NAME>`
|
|
93
|
+
}).examples(examples).option('skip-confirmation', 'Skip manual confirmation of input (USE WITH CAUTION)', false).argv(process.argv, deleteEnvVarCommand);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
exports.getAllEnvVarsCommand = getAllEnvVarsCommand;
|
|
17
|
+
|
|
18
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
19
|
+
|
|
20
|
+
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
21
|
+
|
|
22
|
+
var _format = require("../lib/cli/format");
|
|
23
|
+
|
|
24
|
+
var _api = require("../lib/envvar/api");
|
|
25
|
+
|
|
26
|
+
var _logging = require("../lib/envvar/logging");
|
|
27
|
+
|
|
28
|
+
var _rollbar = require("../lib/rollbar");
|
|
29
|
+
|
|
30
|
+
var _tracker = require("../lib/tracker");
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Internal dependencies
|
|
36
|
+
*/
|
|
37
|
+
const usage = 'vip config envvar get-all'; // Command examples
|
|
38
|
+
|
|
39
|
+
const examples = [{
|
|
40
|
+
usage,
|
|
41
|
+
description: 'Get the values of all environment variables'
|
|
42
|
+
}];
|
|
43
|
+
|
|
44
|
+
async function getAllEnvVarsCommand(arg, opt) {
|
|
45
|
+
const trackingParams = {
|
|
46
|
+
app_id: opt.app.id,
|
|
47
|
+
command: usage,
|
|
48
|
+
env_id: opt.env.id,
|
|
49
|
+
format: opt.format,
|
|
50
|
+
org_id: opt.app.organization.id
|
|
51
|
+
};
|
|
52
|
+
(0, _logging.debug)(`Request: Get all environment variables for ${(0, _logging.getEnvContext)(opt.app, opt.env)}`);
|
|
53
|
+
await (0, _tracker.trackEvent)('envvar_get_all_command_execute', trackingParams);
|
|
54
|
+
const envvars = await (0, _api.getEnvVars)(opt.app.id, opt.env.id).catch(async err => {
|
|
55
|
+
_rollbar.rollbar.error(err);
|
|
56
|
+
|
|
57
|
+
await (0, _tracker.trackEvent)('envvar_get_all_query_error', { ...trackingParams,
|
|
58
|
+
error: err.message
|
|
59
|
+
});
|
|
60
|
+
throw err;
|
|
61
|
+
});
|
|
62
|
+
await (0, _tracker.trackEvent)('envvar_get_all_command_success', trackingParams);
|
|
63
|
+
|
|
64
|
+
if (0 === envvars.length) {
|
|
65
|
+
console.log(_chalk.default.yellow('There are no environment variables'));
|
|
66
|
+
process.exit();
|
|
67
|
+
} // Vary data by expected format.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
let key = 'name';
|
|
71
|
+
|
|
72
|
+
if ('keyValue' === opt.format) {
|
|
73
|
+
key = 'key';
|
|
74
|
+
} else if ('ids' === opt.format) {
|
|
75
|
+
key = 'id';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const envvarsObject = envvars.map(({
|
|
79
|
+
name: envvarName,
|
|
80
|
+
value
|
|
81
|
+
}) => ({
|
|
82
|
+
[key]: envvarName,
|
|
83
|
+
value
|
|
84
|
+
}));
|
|
85
|
+
console.log((0, _format.formatData)(envvarsObject, opt.format));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
(0, _command.default)({
|
|
89
|
+
appContext: true,
|
|
90
|
+
appQuery: _api.appQuery,
|
|
91
|
+
envContext: true,
|
|
92
|
+
format: true,
|
|
93
|
+
usage
|
|
94
|
+
}).examples(examples).argv(process.argv, getAllEnvVarsCommand);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* External dependencies
|
|
10
|
+
*/
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
16
|
+
exports.getEnvVarCommand = getEnvVarCommand;
|
|
17
|
+
|
|
18
|
+
var _chalk = _interopRequireDefault(require("chalk"));
|
|
19
|
+
|
|
20
|
+
var _command = _interopRequireDefault(require("../lib/cli/command"));
|
|
21
|
+
|
|
22
|
+
var _api = require("../lib/envvar/api");
|
|
23
|
+
|
|
24
|
+
var _logging = require("../lib/envvar/logging");
|
|
25
|
+
|
|
26
|
+
var _rollbar = require("../lib/rollbar");
|
|
27
|
+
|
|
28
|
+
var _tracker = require("../lib/tracker");
|
|
29
|
+
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Internal dependencies
|
|
34
|
+
*/
|
|
35
|
+
const baseUsage = 'vip config envvar get'; // Command examples
|
|
36
|
+
|
|
37
|
+
const examples = [{
|
|
38
|
+
usage: `${baseUsage} MY_VARIABLE`,
|
|
39
|
+
description: 'Get the value of the environment variable "MY_VARIABLE"'
|
|
40
|
+
}];
|
|
41
|
+
|
|
42
|
+
async function getEnvVarCommand(arg, opt) {
|
|
43
|
+
// Help the user by uppercasing input.
|
|
44
|
+
const name = arg[0].trim().toUpperCase();
|
|
45
|
+
const trackingParams = {
|
|
46
|
+
app_id: opt.app.id,
|
|
47
|
+
command: `${baseUsage} ${name}`,
|
|
48
|
+
env_id: opt.env.id,
|
|
49
|
+
org_id: opt.app.organization.id,
|
|
50
|
+
variable_name: name
|
|
51
|
+
};
|
|
52
|
+
(0, _logging.debug)(`Request: Get environment variable ${JSON.stringify(name)} for ${(0, _logging.getEnvContext)(opt.app, opt.env)}`);
|
|
53
|
+
await (0, _tracker.trackEvent)('envvar_get_command_execute', trackingParams);
|
|
54
|
+
const envvar = await (0, _api.getEnvVar)(opt.app.id, opt.env.id, name).catch(async err => {
|
|
55
|
+
_rollbar.rollbar.error(err);
|
|
56
|
+
|
|
57
|
+
await (0, _tracker.trackEvent)('envvar_get_query_error', { ...trackingParams,
|
|
58
|
+
error: err.message
|
|
59
|
+
});
|
|
60
|
+
throw err;
|
|
61
|
+
});
|
|
62
|
+
await (0, _tracker.trackEvent)('envvar_get_command_success', trackingParams);
|
|
63
|
+
|
|
64
|
+
if (!envvar) {
|
|
65
|
+
const message = `The environment variable ${JSON.stringify(name)} does not exist`;
|
|
66
|
+
console.log(_chalk.default.yellow(message));
|
|
67
|
+
process.exit();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log(envvar.value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
(0, _command.default)({
|
|
74
|
+
appContext: true,
|
|
75
|
+
appQuery: _api.appQuery,
|
|
76
|
+
envContext: true,
|
|
77
|
+
requiredArgs: 1,
|
|
78
|
+
usage: `${baseUsage} <VARIABLE_NAME>`
|
|
79
|
+
}).examples(examples).argv(process.argv, getEnvVarCommand);
|