This repository was archived by the owner on May 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ name : Release
3+
4+ # This release workflow requires the following environment variables:
5+ # - galaxy_api_key (API key for Ansible Galaxy)
6+
7+ # disable GH action for template
8+ # remove and uncommment below "on" block when using in production
9+ on :
10+ push :
11+ branches-ignore :
12+ - ' **'
13+
14+ # on:
15+ # push:
16+ # branches:
17+ # - master
18+ # pull_request:
19+ # branches:
20+ # - master
21+
22+ jobs :
23+ # we recommend running a smoke test on template generation
24+ # please uncomment below test step and "needs" property in release step when you do
25+ # test:
26+ # name: Smoketest test-tf-generation
27+ # runs-on: ubuntu-latest
28+ # steps:
29+ # - uses: actions/checkout@v2
30+ # - run: ansible-playbook ./__tests__/test-tf-generation.yml
31+ release :
32+ # needs: test
33+ runs-on : ubuntu-latest
34+ env :
35+ GIT_AUTHOR_EMAIL : 64205253+stackhead-bot@users.noreply.github.com
36+ GIT_AUTHOR_NAME : stackhead-bot
37+ GIT_COMMITTER_EMAIL : 64205253+stackhead-bot@users.noreply.github.com
38+ GIT_COMMITTER_NAME : stackhead-bot
39+ steps :
40+ - uses : actions/checkout@v2
41+ with :
42+ submodules : true
43+ - name : Setup node
44+ uses : actions/setup-node@v1
45+ with :
46+ node-version : 12
47+ - name : PNPM install
48+ run : npm i -g pnpm && pnpm i -P
49+ - run : pnpm install
50+ - name : Semantic Release Action
51+ id : release
52+ uses : saitho/semantic-release-action-pnpm@master
53+ env :
54+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
55+ - name : Import repository into Ansible Galaxy
56+ uses : 0x022b/galaxy-role-import-action@v1
57+ with :
58+ galaxy_api_key : ${{ secrets.galaxy_api_key }}
59+ if : steps.release.outputs.new_release_published
Original file line number Diff line number Diff line change 1+ .idea
2+ * .iml
3+
4+ node_modules
Original file line number Diff line number Diff line change 1+ {
2+ "plugins" : [
3+ " @semantic-release/commit-analyzer" ,
4+ " @semantic-release/release-notes-generator" ,
5+ " @semantic-release/github"
6+ ],
7+ "branches" : [
8+ " master"
9+ ]
10+ }
Original file line number Diff line number Diff line change 1+ This is a template for a [ StackHead Module] ( https://docs.stackhead.io/technical-documentation/modules ) .
2+
3+ Make sure to adjust it to your needs.
4+
5+ ---
6+
7+ # StackHead: [ name] module
8+
9+ StackHead module for [ description] .
10+
11+ ## Installation
12+
13+ Install it via ` ansible-galaxy ` :
14+
15+ ```
16+ ansible-galaxy install [vendor].stackhead_[type]_[name]
17+ ```
18+
19+ In order to use Nginx with [ StackHead] ( https://get.stackhead.io ) , set ` stackhead__[type] ` it in your inventory file:
20+
21+ ``` yaml
22+ # inventory for integration test
23+ ---
24+ all :
25+ vars :
26+ # Use Nginx as webserver
27+ stackhead__[type] : [vendor].stackhead_[type]_[name]
28+ hosts :
29+ myserver :
30+ ansible_host : 123.456.789 # ...
31+ stackhead :
32+ applications :
33+ # ...
34+ ```
Original file line number Diff line number Diff line change 1+ * .tf
Original file line number Diff line number Diff line change 1+ # THIS FILE WAS COPIED FROM MAIN STACKHEAD PROJECT.
2+ # It is only required for running smoke tests.
3+ # Do not make changes to this file in any way!
4+ class FilterModule (object ):
5+ """
6+ Jinja2 filters for container related stuff
7+ """
8+
9+ def filters (self ):
10+ return {
11+ 'containerPorts' : self .container_ports
12+ }
13+
14+ def container_ports (self , containerapp__expose , project_name ):
15+ containerapp__expose .sort (key = lambda x : x ['service' ])
16+ output = []
17+
18+ processed = []
19+ previous_service = ""
20+ index = 0
21+ for nginx_expose in containerapp__expose :
22+ service_name = nginx_expose ['service' ]
23+ internal_port = nginx_expose ['internal_port' ]
24+ identifier = service_name + '-' + str (internal_port )
25+ if service_name is None or nginx_expose ['external_port' ] == 443 or identifier in processed :
26+ continue
27+ if previous_service != service_name :
28+ index = 0
29+ output .append ({
30+ 'index' : len (output ),
31+ 'service' : service_name ,
32+ 'internal_port' : internal_port ,
33+ 'tfstring' : "${docker_container.stackhead-" + project_name + "-" + service_name + ".ports[" + str (index ) + "].external}"
34+ })
35+ previous_service = service_name
36+ index += 1
37+ processed .append (identifier )
38+
39+ return output
Original file line number Diff line number Diff line change 1+ # THIS FILE WAS COPIED FROM MAIN STACKHEAD PROJECT.
2+ # It is only required for running smoke tests.
3+ # Do not make changes to this file in any way!
4+ import re
5+
6+
7+ class FilterModule (object ):
8+ """
9+ Jinja2 filters for replacing texts by Terraform variables
10+ """
11+
12+ def filters (self ):
13+ return {
14+ 'TFreplace' : self .tf_replace
15+ }
16+
17+ def tf_replace (self , text , project_name ):
18+ if not isinstance (text , str ):
19+ return text
20+ # Replace Docker service name variables
21+ docker_service = re .compile (r'\$DOCKER_SERVICE_NAME\[\'(.*)\'\]' )
22+ text = docker_service .sub ("${docker_container.stackhead-" + project_name + "-\\ 1.name}" , text )
23+
24+ return text
Original file line number Diff line number Diff line change 1+ ---
2+ - hosts : localhost
3+ connection : local
4+ vars :
5+ stackhead__tf_project_folder : " ."
6+ stackhead__certificates_project_folder : " .stackhead/certificates/{{ project_name }}"
7+ stackhead__snakeoil_fullchain : " .stackhead/global_certificates/fullchain_snakeoil.pem"
8+ stackhead__snakeoil_privkey : " .stackhead/global_certificates/privkey_snakeoil.pem"
9+ project_name : test
10+ app_config :
11+ domains :
12+ - domain : example.com
13+ expose :
14+ - service : php
15+ internal_port : 5000
16+ external_port : 5000
17+ - service : nginx
18+ internal_port : 80
19+ external_port : 80
20+ security :
21+ authentication :
22+ - type : basic
23+ username : user1
24+ password : pass1
25+ - domain : test.example.com
26+ expose :
27+ - service : php
28+ internal_port : 5000
29+ external_port : 80
30+ security :
31+ authentication :
32+ - type : basic
33+ username : user1
34+ password : pass1
35+ - type : basic
36+ username : user2
37+ password : pass2
38+ container :
39+ registries :
40+ - username : dockerhub-user
41+ password : dockerhub-pass
42+ - username : myregistry-user
43+ password : myregistry-pass
44+ url : myregistry.com
45+ services :
46+ - name : data
47+ image : mycontainer:latest
48+ - name : nginx
49+ image : getstackhead/nginx:php
50+ environment :
51+ NGINX_PUBLIC_DIRECTORY : public
52+ DOCKER_PROXY_SERVICE_NAME : " $DOCKER_SERVICE_NAME['php']"
53+ volumes :
54+ - type : global
55+ src : data
56+ dest : /var/www/public/data
57+ mode : ro
58+ - type : global
59+ src : uploads
60+ dest : /var/www/public/uploads
61+ mode : ro
62+ volumes_from :
63+ - data:ro
64+ - name : php
65+ image : getstackhead/php:7.2
66+ volumes_from :
67+ - data
68+ volumes :
69+ - type : global
70+ src : fileadmin
71+ dest : /var/www/public/fileadmin
72+ - type : global
73+ src : uploads
74+ dest : /var/www/public/uploads
75+ - type : global
76+ src : typo3temp
77+ dest : /var/www/public/typo3temp
78+ - type : global
79+ src : var
80+ dest : /var/www/var
81+ - name : db
82+ image : mariadb
83+ environment :
84+ MYSQL_ROOT_PASSWORD : db
85+ MYSQL_DATABASE : db
86+ MYSQL_USER : db
87+ MYSQL_PASSWORD : db
88+ volumes :
89+ - type : local
90+ src : data
91+ dest : /var/lib/mysql
92+ tasks :
93+ - block :
94+ - debug :
95+ msg : " Run your tests here by importing the respective tasks"
96+ # - name: Generate Server Block Terraform file
97+ # import_tasks: "../tasks/steps/generate-serverblock-tf.yml"
98+ vars :
99+ role_path : " .."
Original file line number Diff line number Diff line change 1+ galaxy_info :
2+ role_name : stackhead_[ŧype]_[name]]
3+ author : [Your name]
4+ description : A nice module for StackHead (add proper description)
5+ issue_tracker_url : [Your GitHub URL]
6+ license : GPLv3
7+
8+ min_ansible_version : 2.9
9+
10+ galaxy_tags :
11+ - stackhead
12+ - stackhead-module
13+
14+ # Place dependencies here
15+ # dependencies:
16+ # - role: nginxinc.nginx
Original file line number Diff line number Diff line change 1+ {
2+ "scripts" : {
3+ "semantic-release" : " semantic-release" ,
4+ "commit" : " git-cz"
5+ },
6+ "devDependencies" : {
7+ "@semantic-release/commit-analyzer" : " ^8.0.1" ,
8+ "@semantic-release/github" : " ^7.0.7" ,
9+ "@semantic-release/release-notes-generator" : " ^9.0.1" ,
10+ "commitizen" : " ^4.1.2" ,
11+ "cz-conventional-changelog" : " ^3.2.0" ,
12+ "semantic-release" : " ^17.1.1"
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments