Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Takoudjou
slapos
Commits
a790d6c5
Commit
a790d6c5
authored
Jan 26, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Plain Diff
stack/lamp: Generate random password for mariadb
See merge request
nexedi/slapos!1331
parents
e3b355ab
457905fe
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
39 additions
and
26 deletions
+39
-26
software/matomo/software.cfg
software/matomo/software.cfg
+0
-1
software/matomo/test/test.py
software/matomo/test/test.py
+6
-2
software/nextcloud/software.cfg
software/nextcloud/software.cfg
+0
-1
software/nextcloud/test/test.py
software/nextcloud/test/test.py
+7
-1
stack/lamp/buildout.cfg
stack/lamp/buildout.cfg
+0
-2
stack/lamp/buildout.hash.cfg
stack/lamp/buildout.hash.cfg
+3
-3
stack/lamp/instance-apache-php.cfg.in
stack/lamp/instance-apache-php.cfg.in
+8
-0
stack/lamp/instance-lamp.cfg.jinja2.in
stack/lamp/instance-lamp.cfg.jinja2.in
+10
-14
stack/lamp/instance.cfg.in
stack/lamp/instance.cfg.in
+5
-2
No files found.
software/matomo/software.cfg
View file @
a790d6c5
...
...
@@ -35,7 +35,6 @@ path = ${template-matomo-instance:output}
part-list = matomo-backup.sh matomo-backup-cron
db-name = matomo
db-user = matomo
db-password = 12345678
[template-matomo-instance]
recipe = slapos.recipe.template:jinja2
...
...
software/matomo/test/test.py
View file @
a790d6c5
...
...
@@ -52,6 +52,9 @@ class MatomoTestCase(SlapOSInstanceTestCase):
break
self
.
assertTrue
(
self
.
matomo_path
,
"matomo path not found in %r"
%
(
partition_path_list
,))
self
.
connection_parameters
=
self
.
computer_partition
.
getConnectionParameterDict
()
# parse <url> out of ['<url>']
url
=
self
.
connection_parameters
[
'mariadb-url-list'
][
2
:
-
2
]
self
.
db_info
=
urllib
.
parse
.
urlparse
(
url
)
#Check if matomo root directory is empty
def
test_matomo_dir
(
self
):
...
...
@@ -83,8 +86,9 @@ class MatomoTestCase(SlapOSInstanceTestCase):
self
.
assertEqual
(
tree
.
xpath
(
'//input[@name="dbname"]/@value'
),
[
'matomo'
])
self
.
assertTrue
(
tree
.
xpath
(
'//input[@name="password"]/@value'
)[
0
])
self
.
assertEqual
(
tree
.
xpath
(
'//input[@name="password"]/@value'
),
[
self
.
db_info
.
password
])
self
.
assertEqual
(
tree
.
xpath
(
'//input[@name="host"]/@value'
),
[
f'
{
self
.
_ipv4_address
}
:2099'
]
...
...
software/nextcloud/software.cfg
View file @
a790d6c5
...
...
@@ -39,7 +39,6 @@ path = ${template-nextcloud-instance:output}
part-list = nextcloud-install.sh
db-name = nextcloud
db-user = nextcloud
db-password = insecure
[nc-download-unpacked]
recipe = slapos.recipe.build:download-unpacked
...
...
software/nextcloud/test/test.py
View file @
a790d6c5
...
...
@@ -31,6 +31,8 @@ import json
import
glob
import
re
from
six.moves.urllib.parse
import
urlparse
from
slapos.recipe.librecipe
import
generateHashFromFiles
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
...
...
@@ -63,13 +65,17 @@ class NextCloudTestCase(InstanceTestCase):
self
.
nextcloud_path
,
"Nextcloud path not found in %r"
%
(
partition_path_list
,))
# parse database info from mariadb url
d
=
self
.
computer_partition
.
getConnectionParameterDict
()
db_url
=
d
[
'mariadb-url-list'
][
2
:
-
2
]
# parse <url> out of "['<url>']"
self
.
_db_info
=
urlparse
(
db_url
)
def
getNextcloudConfig
(
self
,
config_dict
=
{}):
data_dict
=
dict
(
datadirectory
=
self
.
partition_dir
+
"/srv/data"
,
dbhost
=
"%s:2099"
%
self
.
_ipv4_address
,
dbname
=
"nextcloud"
,
dbpassword
=
"insecure"
,
dbpassword
=
self
.
_db_info
.
password
,
dbport
=
""
,
dbuser
=
"nextcloud"
,
mail_domain
=
"nextcloud@example.com"
,
...
...
stack/lamp/buildout.cfg
View file @
a790d6c5
...
...
@@ -63,7 +63,6 @@ part-list =
# database information
db-name = lamp
db-user = lamp
db-password = insecure
#----------------
#-- Instance-level buildout profiles.
...
...
@@ -114,7 +113,6 @@ context =
key custom_application_template custom-application-deployment:path
key db_name custom-application-deployment:db-name
key db_user custom-application-deployment:db-user
key db_password custom-application-deployment:db-password
key lamp_apache_httpd template-apache-httpd:target
[instance-apache-php]
...
...
stack/lamp/buildout.hash.cfg
View file @
a790d6c5
...
...
@@ -14,15 +14,15 @@
# not need these here).
[lamp-instance]
filename = instance.cfg.in
md5sum =
603d03f43ea04e95237c80d3b9e72ba7
md5sum =
7854dd0edd48f2d91c16412c4a875ca4
[instance-apache-php]
filename = instance-apache-php.cfg.in
md5sum =
8506f245087dfdc02561e8739a567bd6
md5sum =
9ab14922535d4d85e0db8602c47a707d
[instance-lamp]
filename = instance-lamp.cfg.jinja2.in
md5sum = 3
ff36cb2d10f53f932ba9ee99b5fe9e1
md5sum = 3
47ddf1516bf2ddb5f6fb23539382847
[template-apache.conf]
filename = apache.conf.in
...
...
stack/lamp/instance-apache-php.cfg.in
View file @
a790d6c5
...
...
@@ -22,6 +22,14 @@ develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
#----------------
#--
#-- Monitor password aggregation.
[monitor-instance-parameter]
password = {{ slapparameter_dict['monitor-passwd'] }}
#----------------
#--
#-- Creation of all needed directories.
...
...
stack/lamp/instance-lamp.cfg.jinja2.in
View file @
a790d6c5
...
...
@@ -2,7 +2,6 @@
{% set part_list = [] -%}
{% set ipv6 = (ipv6 | list)[0] -%}
{% set monitor_base_url_dict = {} -%}
{% set mariadb_dict = {} -%}
[directory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -28,6 +27,7 @@ sla-computer_guid = {{ dumps(slapparameter_dict.get('apache-computer-guid', ''))
config-{{ key }} = {{ dumps(value) }}
{% endif -%}
{% endfor -%}
config-monitor-passwd = ${monitor-instance-parameter:password}
config-database-list = ${request-mariadb:connection-database-list}
return =
backend-url
...
...
@@ -37,24 +37,20 @@ return =
{% do publish_dict.__setitem__('backend-url', '${request-apache:connection-backend-url}') -%}
{% do monitor_base_url_dict.__setitem__('apache', '${request-apache:connection-monitor-base-url}') -%}
{% do mariadb_dict.__setitem__('database-list', [{'name': db_name, 'user': db_user, 'password': db_password }]) -%}
{% do mariadb_dict.__setitem__('test-database-amount', 0) -%}
{% do mariadb_dict.__setitem__('tcpv4-port', 2099) -%}
{% do mariadb_dict.__setitem__('max-slowqueries-threshold', 1000) -%}
{% do mariadb_dict.__setitem__('slowest-query-threshold', '') -%}
{% do mariadb_dict.__setitem__('computer-memory-percent-threshold', 80) -%}
{% do mariadb_dict.__setitem__('monitor-passwd', '${monitor-htpasswd:passwd}') -%}
{% do mariadb_dict.__setitem__('name', 'Mariadb') -%}
{% do mariadb_dict.__setitem__('innodb-file-per-table', slapparameter_dict.get('innodb-file-per-table', 1)) -%}
[request-mariadb]
<= request-common
software-type = mariadb
name = Mariadb
sla-computer_guid = {{ dumps(slapparameter_dict.get('mariadb-computer-guid', '')) }}
{% for key, value in mariadb_dict.items() -%}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-database-list = {{ dumps([{'name': db_name, 'user': db_user, 'password': db_password }]) }}
config-test-database-amount = {{ dumps(0) }}
config-tcpv4-port = {{ dumps(2099) }}
config-max-slowqueries-threshold = {{ dumps(1000) }}
config-slowest-query-threshold =
config-computer-memory-percent-threshold = {{ dumps(80) }}
config-monitor-passwd = ${monitor-instance-parameter:password}
config-name = ${:name}
config-innodb-file-per-table = {{ dumps(slapparameter_dict.get('innodb-file-per-table', 1)) }}
return =
database-list
monitor-base-url
...
...
stack/lamp/instance.cfg.in
View file @
a790d6c5
...
...
@@ -40,8 +40,11 @@ context =
${:extra-context}
[dynamic-template-lamp-parameters]
[mariadb-password]
recipe = slapos.cookbook:generate.password
[dynamic-template-lamp-parameters]
[dynamic-template-lamp]
<= jinja2-template-base
...
...
@@ -51,7 +54,7 @@ extra-context =
section parameter_dict dynamic-template-lamp-parameters
raw db_name {{ db_name }}
raw db_user {{ db_user }}
raw db_password {{ db_password }}
key db_password mariadb-password:passwd
[dynamic-template-apache-php-parameters]
{% if application_archive_root %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment