Skip to content

Commit

Permalink
tests dump 3
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Dec 12, 2023
1 parent dd2d5ef commit a45dd02
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 40 deletions.
19 changes: 19 additions & 0 deletions examples/backdrop-custom/.lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: backdrop-custom
recipe: backdrop
config:
php: '7.4'
composer_version: '2.0.7'
via: nginx:1.17
webroot: bob
database: mysql:5.7
bee: '1.x-1.x'
xdebug: true
config:
database: config/mysql.cnf
php: config/php.ini
vhosts: config/default.conf

# do not remove this
plugins:
"@lando/backdrop": ../..

61 changes: 24 additions & 37 deletions examples/backdrop-custom/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
# Backdrop Custom Example
# Backdrop Custom 8Example

This example exists primarily to test the following documentation:

* [Backdrop Recipe](https://docs.devwithlando.io/tutorials/backdrop.html)
* [Backdrop Recipe](https://docs.lando.dev/backdrop/config.html)

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should poweroff
lando poweroff

# Should initialize the latest Backdrop codebase
rm -rf mysql8 && mkdir -p mysql8 && cd mysql8
lando init --source remote --remote-url https://github.com/backdrop/backdrop/releases/download/1.20.3/backdrop.zip --recipe backdrop --webroot backdrop --name lando-backdrop-mysql8 --option database=mysql:8.0.22
cp -f ../../.lando.local.yml .lando.local.yml && cat .lando.local.yml


# Should start up successfully
cd mysql8
lando poweroff
lando start
```

Expand All @@ -30,38 +21,35 @@ Verification commands
Run the following commands to validate things are rolling as they should.

```bash
# Should return the Backdrop installation page by default
cd mysql8
lando ssh -s appserver -c "curl -L localhost" | grep "Backdrop CMS 1"
# Should serve from bob folder
lando ssh -s appserver -c "curl -L appserver_nginx" | grep "HI BOB"

# Should be serving from nginx 1.17
lando ssh -s appserver_nginx -c "nginx -v" 2>&1 | grep "nginx version" | grep "nginx/1.17"
lando ssh -s appserver -c "curl -IL appserver_nginx" | grep Server | grep nginx

# Should use 7.4 as the default php version
cd mysql8
# Should use php 7.4
lando php -v | grep "PHP 7.4"

# Should be running apache 2.4 by default
cd mysql8
lando ssh -s appserver -c "apachectl -V | grep 2.4"
lando ssh -s appserver -c "curl -IL localhost" | grep Server | grep 2.4
# Should use composer 2.0.7
lando ssh -s appserver -c "/bin/sh -c 'NO_COLOR=1 composer -V'" | grep "Composer version 2.0.7"

# Should be running mysql 8.0.x by default
cd mysql8
lando mysql -V | grep 8.0
# Should be running mysql 5.7
lando mysql -V | grep "mysql" | grep "Distrib 5.7."

# Should not enable xdebug by default
cd mysql8
lando php -m | grep xdebug || echo $? | grep 1
# Should be able to connect to the database with the default creds
lando mysql backdrop -e quit

# Should use the default database connection info
cd mysql8
lando mysql -ubackdrop -pbackdrop backdrop -e quit
# Should have xdebug enabled
lando php -m | grep Xdebug

# Should be able to install Backdrop
cd mysql8/backdrop
lando drush si --db-url=mysql://backdrop:backdrop@database/backdrop -y
# Should have bee 1.x-1.x
lando bee version | grep "Bee for Backdrop CMS" | grep "1.x-1.x"

# Should use drush 8.3.x by default
cd mysql8/backdrop
lando drush version | grep 8.3
# Should be using custom config files
lando ssh -s appserver -c "curl -L appserver_nginx/info.php" | grep memory_limit | grep 513M
lando ssh -s appserver_nginx -c "cat /opt/bitnami/nginx/conf/vhosts/lando.conf" | grep server_name | grep pirog
lando mysql -u root -e "show variables;" | grep thread_cache_size | grep 12
```

Destroy tests
Expand All @@ -71,7 +59,6 @@ Run the following commands to trash this app like nothing ever happened.

```bash
# Should be destroyed with success
cd mysql8
lando destroy -y
lando poweroff
```
1 change: 1 addition & 0 deletions examples/backdrop-custom/bob/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HI BOB
1 change: 1 addition & 0 deletions examples/backdrop-custom/bob/info.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php phpinfo(); ?>
41 changes: 41 additions & 0 deletions examples/backdrop-custom/config/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
server {
listen 80 default_server;
listen 443 ssl;

server_name pirog;

ssl_certificate /certs/cert.crt;
ssl_certificate_key /certs/cert.key;
ssl_verify_client off;

ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

root "{{LANDO_WEBROOT}}";

index index.html index.htm index.php;

port_in_redirect off;
client_max_body_size 100M;

location / {
error_page 404 = @backdrop;
}

location @backdrop {
rewrite ^(.*)$ /index.php?q=$1 last;
}

location ~ \.php$ {
fastcgi_pass fpm:9000;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
}

}
110 changes: 110 additions & 0 deletions examples/backdrop-custom/config/mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#
# The MySQL database server configuration file for Lando
#

[mysqld]
#
# * Basic Settings
#
# Data is stored in a volume on the db container /sql
default-storage-engine = innodb

#
# * Fine Tuning
#
key_buffer_size = 38M
max_allowed_packet = 32M
thread_stack = 400K
thread_cache_size = 12
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M

#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 64M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /src/.lando/log/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /src/.lando/log/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# Uncomment the following if you are using InnoDB tables
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = C:\mysql\data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 0
#innodb_lock_wait_timeout = 50
innodb_buffer_pool_size = 384M
innodb_log_buffer_size = 4M
innodb_file_per_table = 1
innodb_open_files = 256
innodb_io_capacity = 512
innodb_flush_method = O_DIRECT
innodb_thread_concurrency = 8
innodb_lock_wait_timeout = 120
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

[mysqldump]
quick
quote-names
max_allowed_packet = 32M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completion

[isamchk]
key_buffer_size = 384M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
49 changes: 49 additions & 0 deletions examples/backdrop-custom/config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[PHP]

;;;;;;;;;;;;;;;
; PHP Globals ;
;;;;;;;;;;;;;;;

short_open_tag = Off
output_buffering = 4096
allow_call_time_pass_reference = Off
request_order = "GP"
register_long_arrays = Off
register_argc_argv = Off
magic_quotes_gpc = Off
enable_dl = Off
allow_url_fopen = On
realpath_cache_size = "800K"
realpath_cache_ttl = "86400"
disable_functions =
sendmail_path=/bin/true
;include_path = ".:/usr/share/pear:/usr/share/php"

[Date]
date.timezone = "UTC"

;;;;;;;;;;;;;;;;;;;;;;
;; PACKAGE SETTINGS ;;
;;;;;;;;;;;;;;;;;;;;;;

; Xdebug
xdebug.max_nesting_level = 512
xdebug.show_exception_trace = 0
xdebug.collect_params = 0
xdebug.remote_autostart = 1
xdebug.start_with_request = trigger
xdebug.mode = ${XDEBUG_MODE}

; Globals
expose_php = on
max_execution_time = 90
max_input_time = 900
max_input_vars = 10000
memory_limit = 513M
upload_max_filesize = 100M
post_max_size = 100M
error_reporting = E_ALL & ~E_DEPRECATED
ignore_repeated_errors = on
html_errors = off
display_errors = on
log_errors = on
4 changes: 2 additions & 2 deletions examples/backdrop-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ lando db-import mysql-test.sql
lando mysql backdrop -e "show tables;" | grep users

# Should be able to import into user specified database
lando db-import -h backdrop mysql-test.sql
lando db-import -h database mysql-test.sql
lando mysql backdrop -e "show tables;" | grep users

# Should be able to export the contents of the dbs
lando db-export
lando db-export -h database
lando db-export -h database another-one.sql

# Should export to filename if specified
lando db-export database.dump.sql
Expand Down
2 changes: 1 addition & 1 deletion examples/backdrop-nginx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Run the following commands to validate things are rolling as they should.

```bash
# Should serve from web folder
lando ssh -s appserver_nginx -c "curl -L localhost" | grep "NGINX"
lando ssh -s appserver -c "curl -L appserver_nginx" | grep "NGINX"

# Should run using nginx if specified
lando ssh -s appserver -c "curl -IL appserver_nginx" | grep Server | grep nginx
Expand Down

0 comments on commit a45dd02

Please sign in to comment.