Bug 1056865 - Add support for custom env file in Vagrant that is ignored by git (#4857)

This commit is contained in:
Cameron Dawson 2019-04-04 12:18:48 -07:00 коммит произвёл GitHub
Родитель 16b844079a
Коммит 3267f191bb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 26 добавлений и 0 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -5,6 +5,7 @@ node_modules/
.vscode/
yarn-error.log
npm-error.log
vagrant/env_local.sh
# vi
*.swp

Просмотреть файл

@ -127,6 +127,21 @@ To get started:
- If you just wish to [run the tests](common_tasks.md#running-the-tests),
you can stop now without performing the remaining steps.
### Customizing Vagrant
If you have some common settings you make in Vagrant (setting an alternate database, or your own
pulse credentials, etc) then you can create a file that contains `alias`es and `function`s
to setup those values in a file called `vagrant/env_local.sh`. Git will ignore this file and
not check it in with your changes.
<!-- prettier-ignore -->
!!! warning
We highly recommend you do NOT ``export`` any values in this file, as it is a foot-gun.
If This could lead to a situation where one forgets certain settings were made in that file, and
is getting unexpected results in Vagrant. These changes will persist, event after a
``vagrant destroy``. For this reason, only use ``alias`` and ``function`` entries, and execute
them when you need them.
### Starting a local Treeherder instance
- Start a Django runserver instance inside the Vagrant VM, to serve the static UI and API requests:

Просмотреть файл

@ -8,6 +8,11 @@
> vagrant provision
```
Check if you have a file `/vagrant/env_local.sh`. If this file has any errors or is explicitly
exporting any environment variables, we recommend updating it so it only has entries of `alias`
and `function`.
See [Customizing Vagrant](installation.md#customizing-vagrant)
If that is still unsuccessful, you should attempt a `vagrant destroy` followed by another `vagrant up --provision`.
- If you encounter an error saying _"mount.nfs: requested NFS version or transport protocol is not supported"_, you should restart the kernel server service using this sequence of commands:

Просмотреть файл

@ -40,6 +40,11 @@ ln -sf "$SRC_DIR/vagrant/.profile" "$HOME/.profile"
sudo ln -sf "$SRC_DIR/vagrant/env.sh" /etc/profile.d/treeherder.sh
. vagrant/env.sh
if [[ -f vagrant/env_local.sh ]]; then
echo '-----> Found custom local_env.sh'
sudo ln -sf "$SRC_DIR/vagrant/env_local.sh" /etc/profile.d/treeherder_local.sh
fi
if ! grep -qs 'node_11.x' /etc/apt/sources.list.d/nodesource.list; then
echo '-----> Adding APT repository for Node.js'
sudo curl -sSf https://deb.nodesource.com/gpgkey/nodesource.gpg.key -o /etc/apt/trusted.gpg.d/nodesource.asc