Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
puppet-comptoir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Comptoir
puppet-comptoir
Commits
d8c2092f
Commit
d8c2092f
authored
5 years ago
by
Matthieu FAURE
Browse files
Options
Downloads
Patches
Plain Diff
REFACTOR parameter names
parent
22e1c280
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
manifests/init.pp
+36
-29
36 additions, 29 deletions
manifests/init.pp
with
36 additions
and
29 deletions
manifests/init.pp
+
36
−
29
View file @
d8c2092f
...
...
@@ -2,36 +2,43 @@
#
# @summary Install and configure Comptoir Du Libre
#
# @param comptoir_
user Username of Unix account holding Comptoir du Libre application
# @param
comptoir_repos_url URL of Comptoir repos in HTTPS mode (not in git mode)
# @param
comptoir_revision
Revision of Comptoir repos as understood by module VCSRepos, may be a branch, a tag, a SHA-1
# @param comptoir_
db_password Password for the database user
# @param
system_user Username of Unix account holding Comptoir du Libre application
# @param
refspec
Revision of Comptoir repos as understood by module VCSRepos, may be a branch, a tag, a SHA-1
# @param comptoir_db_user Database username owning the database for the application
# @param comptoir_db_user Database username owning
# @param comptoir_db_password PAssword for the user of the database
# @param comptoir_db_name Database name to be used for the application
# @param comptoir_db_host Name of the database host, must an FQDN or an IP address
# @param comptoir_db_port Port of the database host, must an integer
# @param
apache_user System user running Apache, typically www-data
# @param
debug Install Comptoir in dev mode with debug activated
#
# @example
# include comptoir
class
comptoir
(
String
$comptoir_user
=
'comptoir'
,
Stdlib
::
Httpsurl
$comptoir_repos_url
=
'https://gitlab.adullact.net/Comptoir/Comptoir-srv.git'
,
String
$comptoir_revision
=
'master'
,
String
$comptoir_db_user
=
'comptoir'
,
String
$comptoir_db_name
=
'comptoir'
,
String
$comptoir_db_password
=
'comptoir'
,
String
$comptoir_db_host
=
'localhost'
,
String
$comptoir_db_port
=
'5432'
,
String
$apache_user
=
'www-data'
,
Boolean
$debug
=
false
,
# Mandatory parameter: DB password
String
$comptoir_db_password
,
# Comptoir app parameters
String
$system_user
=
'comptoir'
,
String
$refspec
=
'master'
,
Boolean
$debug
=
false
,
# DB parameters
String
$comptoir_db_host
=
'localhost'
,
String
$comptoir_db_port
=
'5432'
,
String
$comptoir_db_username
=
'comptoir'
,
String
$comptoir_db_name
=
'comptoir'
,
)
{
# #############################################################################
# Variables
$comptoir_repos_url
=
'https://gitlab.adullact.net/Comptoir/Comptoir-srv.git'
# Inner variables
$_comptoir_dir
=
join
(
[
'/home/'
,
$comptoir_user
,
'/'
,
basename
(
$comptoir_repos_url
,
'.git'
)
])
$_comptoir_dir
=
join
([
'/home/'
,
$system_user
,
'/'
,
basename
(
$comptoir_repos_url
,
'.git'
)
])
$_sql_create_tables_and_procedure
=
'config/SQL/COMPTOIR_DB_create_tables_and_procedures.sql'
$_file_app_php
=
"
${_comptoir_dir}
/config/app.php"
$_file_comptoir_php
=
"
${_comptoir_dir}
/config/comptoir.php"
$_psql_create_table_cmd
=
"
\\
i
${_comptoir_dir}
/
${_sql_create_tables_and_procedure}
"
$_my_sed
=
'/bin/sed -i -e'
$_sed_barman_dev
=
...
...
@@ -42,8 +49,8 @@ class comptoir (
ensure
=>
present
,
provider
=>
git
,
source
=>
$comptoir_repos_url
,
revision
=>
$
comptoir_revision
,
user
=>
$
comptoir
_user
,
revision
=>
$
refspec
,
user
=>
$
system
_user
,
force
=>
true
,
# See https://forge.puppet.com/puppetlabs/vcsrepo#force
}
...
...
@@ -56,14 +63,14 @@ class comptoir (
postgresql_psql
{
'Create SQL tables & procedures'
:
command
=>
$_psql_create_table_cmd
,
db
=>
$comptoir_db_name
,
psql_user
=>
$comptoir_db_user
,
psql_user
=>
$comptoir_db_user
name
,
}
# Install app with Composer
->
exec
{
'composer install'
:
command
=>
'/usr/local/bin/composer --no-progress install'
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
environment
=>
[
'HOME=/home/comptoir'
],
timeout
=>
1200
,
# default value (300s) * 4
}
...
...
@@ -73,7 +80,7 @@ class comptoir (
exec
{
'Comptoir APP.PHP enable debug'
:
command
=>
"
${_my_sed}
's!//COMPTOIR-DEBUG!!'
${_file_app_php}
"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
environment
=>
[
'HOME=/home/comptoir'
],
onlyif
=>
"/bin/grep '//COMPTOIR-DEBUG'
${_file_app_php}
"
,
require
=>
Exec
[
'composer install'
],
...
...
@@ -81,7 +88,7 @@ class comptoir (
->
exec
{
'Comptoir APP.PHP barman-DEV'
:
command
=>
"
${_my_sed}
${_sed_barman_dev}
${_file_app_php}
"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
environment
=>
[
'HOME=/home/comptoir'
],
unless
=>
"/bin/grep 'barman-DEV'
${_file_app_php}
"
,
}
...
...
@@ -91,7 +98,7 @@ class comptoir (
exec
{
'Comptoir APP.PHP salt'
:
command
=>
"
${_my_sed}
's/__SALT__/somerandomsalt/'
${_file_app_php}
"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
environment
=>
[
'HOME=/home/comptoir'
],
onlyif
=>
"/bin/grep '__SALT__'
${_file_app_php}
"
,
require
=>
Exec
[
'composer install'
],
...
...
@@ -99,7 +106,7 @@ class comptoir (
->
exec
{
'Comptoir APP.PHP Session default'
:
command
=>
"
${_my_sed}
\"
s!'php',!env('SESSION_DEFAULTS', 'php'), !
\"
${_file_app_php}
"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
unless
=>
"/bin/grep 'SESSION_DEFAULTS'
${_file_app_php}
"
,
}
...
...
@@ -108,7 +115,7 @@ class comptoir (
ensure
=>
present
,
path
=>
$_file_comptoir_php
,
content
=>
template
(
'comptoir/comptoir.php.epp'
),
owner
=>
$
comptoir
_user
,
owner
=>
$
system
_user
,
require
=>
Exec
[
'composer install'
],
}
...
...
@@ -116,14 +123,14 @@ class comptoir (
exec
{
'chmod -R o-w Comptoir-srv/tmp'
:
command
=>
"/bin/chmod -R o-w
${_comptoir_dir}
/tmp"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
onlyif
=>
"/usr/bin/find
${_comptoir_dir}
/tmp/ -maxdepth 0 -perm -o=w"
,
require
=>
Exec
[
'composer install'
],
}
exec
{
'chmod -R o-w Comptoir-srv/logs'
:
command
=>
"/bin/chmod -R o-w
${_comptoir_dir}
/logs"
,
cwd
=>
$_comptoir_dir
,
user
=>
$
comptoir
_user
,
user
=>
$
system
_user
,
onlyif
=>
"/usr/bin/find
${_comptoir_dir}
/logs/ -maxdepth 0 -perm -o=w"
,
require
=>
Exec
[
'composer install'
],
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment