forked from Controls/gitea-pages
update development documentation
This commit is contained in:
@@ -1,56 +1,31 @@
|
||||
# Development Environments
|
||||
|
||||
The puppet server gives access to a limited set of users to the
|
||||
environment area, where prod and preprod environments are already
|
||||
present, to create environments that can be used for new puppet code
|
||||
development.
|
||||
Beside the __prod__ and __preprod__ environments also development environments can be deployed on the puppet server. To create a new test environment simply:
|
||||
|
||||
This area is accessible via sftp and can be mounted on users'
|
||||
workstations via sshfs.
|
||||
1. Clone the puppet repository https://git.psi.ch/linux-infra/puppet
|
||||
2. Create a new branch with a name that matches following regex: `^[a-z]+[a-z,0-9,_]+$` (e.g. my_test_branch)
|
||||
3. Do and commit your changes
|
||||
4. Push the new branch / changes to the git server
|
||||
|
||||
The typical workflow would be:
|
||||
Whenever the git server receives a push a gitlab-runner gets triggered on the puppet server that does the automatic checkout of the branch and registers this as a new development environment.
|
||||
|
||||
#. user mounts the environment area (``puppet01:/envs/`` on the puppet master - this is the directory /srv/puppet/code/dev/envs on puppet01!) via sshfs on ``~/puppetenv``;
|
||||
#. user create a directory for the new environent (``mkdir ~/puppetenv/issue_x``);
|
||||
#. after a few seconds ``issue_x`` will be populated with a copy of the content of the the ``preprod`` environment with a proper git branch named ``issue_x``;
|
||||
#. user edits files in that directory;
|
||||
#. user run on some testing node the command ``puppet agent -t --environment=issue_x``;
|
||||
#. user iterates on steps number 4 and 5 until the code is ready;
|
||||
#. users makes the proper add/commit into the directory and finally pushes the code;
|
||||
#. from the git server web interface user triggers a merge request of the ``issue_x`` into the ``preprod`` branch.
|
||||
Note: If branches are deleted on the git server the corresponding checkouts/environments on the puppet server will also be removed.
|
||||
|
||||
Please note that ssh to the puppet server has to be done via ``wmgt`` nodes, e.g by using the option ``-oProxyJump=wmgt01.psi.ch``.
|
||||
To use/test the code changes via the puppet test environment use
|
||||
```
|
||||
puppet agent -t --environment=issue_x
|
||||
```
|
||||
|
||||
Environment names
|
||||
-----------------
|
||||
Continue the commit / push / test cycle until your changes are working. Afterwards create a merge request for the branch to the __preprod__ branch.
|
||||
|
||||
The name of the environment:
|
||||
## Development Environment Names
|
||||
|
||||
- must be at least 4 characters long;
|
||||
- can include lower case letters, digits and the underscore character;
|
||||
- must start with a letter.
|
||||
The name of an branch/environment must match the following regex expression: `^[a-z]+[a-z,0-9,_]+$`
|
||||
|
||||
If the name is not compliant with these rules, the directory will be automatically removed.
|
||||
|
||||
SSHFS mount
|
||||
-----------
|
||||
|
||||
Generally refer to your operating system instructions on how to
|
||||
properly configure sshfs.
|
||||
|
||||
One caveat is that your local user can be different from the remote (puppet master)
|
||||
user. In this case a file mapping your local username to the remote user id should be passed to the sshfs client.
|
||||
The file should be in the form of::
|
||||
|
||||
<local username>:<remote uid>
|
||||
|
||||
And should then be passed in the command like::
|
||||
|
||||
sshfs -o idmap=file,uidfile=/Users/talamoig/uidmap,nomap=ignore,ProxyJump=wmgt01.psi.ch talamo_i@puppet01:/ ~/puppetenvs
|
||||
If the name is not compliant with this rule, a push of the branch to the git server will not be possible.
|
||||
|
||||
|
||||
Attach Node to Different Puppet Server
|
||||
--------------------------------------
|
||||
# Attach Node to Different Puppet Server
|
||||
|
||||
For testing purpose you might change the Puppet server to which a test node is attached to. To do so do, change the ``server`` in the ``[main]`` section of ``/etc/puppetlabs/puppet/puppet.conf`` accordingly.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user