Skip to content

Commit

Permalink
Update gennerate static site command.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannguyen04 committed Nov 15, 2024
1 parent cba9c93 commit 723e499
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 15 deletions.
7 changes: 6 additions & 1 deletion .ddev/commands/web/generate-static-site
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

rm -rf /var/www/html/static-site

GENERATE_STATIC_SITE=1 drush tome:static -vv --uri=https://frees.au
if [ "$1" == "--production" ]; then
GENERATE_STATIC_SITE=1 drush tome:static -vv --uri=https://frees.au
else
GENERATE_STATIC_SITE=1 drush tome:static -vv --uri=fs-web-static-site.ddev.site:8080
fi

# Need this one to make search api lunr works.
# Make sure Drupal site is fully index first.
cp -R "/var/www/html/web/sites/default/files/search-api-js" "/var/www/html/static-site/sites/default/files"
cp -R "/var/www/html/web/themes/custom/fstheme/stockart" "/var/www/html/static-site/themes/custom/fstheme"
88 changes: 88 additions & 0 deletions .ddev/nginx_full/fs-web-static-site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Example configuration for a second docroot

#ddev-generated
# If you want to take over this file and customize it, rename it to <yourname>.conf,
# and remove the ddev-generated line above

server {
# Set the docroot to where it belongs in the codebase
root /var/www/html/static-site;
# Set the server_name so this config can be selected
# You'll need additional_hostnames["seconddocroot"] in config.yaml for this to work
server_name fs-web-static-site.ddev.site;

listen 80;
listen 443 ssl;

ssl_certificate /etc/ssl/certs/master.crt;
ssl_certificate_key /etc/ssl/certs/master.key;

include /etc/nginx/monitoring.conf;

index index.php index.htm index.html;

# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile off;
error_log /dev/stdout info;
access_log /var/log/nginx/access.log;

location / {
absolute_redirect off;
try_files $uri $uri/ /index.php?$query_string;
}

location @rewrite {
# For D7 and above:
# Clean URLs are handled in drupal_environment_initialize().
rewrite ^ /index.php;
}

# pass the PHP scripts to FastCGI server listening on socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_intercept_errors off;
# fastcgi_read_timeout should match max_execution_time in php.ini
fastcgi_read_timeout 10m;
fastcgi_param SERVER_NAME $host;
fastcgi_param HTTPS $fcgi_https;
# Pass the X-Accel-* headers to facilitate testing.
fastcgi_pass_header "X-Accel-Buffering";
fastcgi_pass_header "X-Accel-Charset";
fastcgi_pass_header "X-Accel-Expires";
fastcgi_pass_header "X-Accel-Limit-Rate";
fastcgi_pass_header "X-Accel-Redirect";
}

# Expire rules for static content
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|webp|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

# Prevent clients from accessing hidden files (starting with a dot)
# This is particularly important if you store .htpasswd files in the site hierarchy
# Access to `/.well-known/` is allowed.
# https://www.mnot.net/blog/2010/04/07/well-known
# https://tools.ietf.org/html/rfc5785
location ~* /\.(?!well-known\/) {
deny all;
}

# Prevent clients from accessing to backup/config/source files
location ~* (?:\.(?:bak|conf|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
deny all;
}

include /etc/nginx/common.d/*.conf;
include /mnt/ddev_config/nginx/*.conf;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
uuid: 6d33843f-9f10-45f5-8891-d3b1fb50484e
uuid: 40baf552-7482-4b4d-9d2e-9242beaf4dba
langcode: en
status: false
status: true
dependencies:
config:
- system.menu.main
module:
- system
theme:
- fstheme
id: fstheme_mainnav
id: fstheme_mainnavigation
theme: fstheme
region: sidebar
weight: -2
region: primary_menu
weight: 0
provider: null
plugin: 'system_menu_block:main'
settings:
Expand All @@ -20,6 +20,6 @@ settings:
label_display: '0'
provider: system
level: 1
depth: 0
depth: 1
expand_all_items: false
visibility: { }
32 changes: 24 additions & 8 deletions config/sync/core.entity_view_display.node.page.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,63 @@ dependencies:
- node.type.page
module:
- layout_builder
- layout_discovery
- text
- user
theme:
- fstheme
third_party_settings:
layout_builder:
enabled: true
allow_custom: true
sections:
-
layout_id: layout_onecol
layout_id: onecol_container_content
layout_settings:
label: ''
context_mapping: { }
components:
5f6607c6-f329-4e65-b23c-79b0ff8f8237:
uuid: 5f6607c6-f329-4e65-b23c-79b0ff8f8237
0626c0ae-afcc-4e75-9f95-dbdc61a483d5:
uuid: 0626c0ae-afcc-4e75-9f95-dbdc61a483d5
region: content
configuration:
id: 'field_block:node:page:lead'
label: 'Lead or summary'
label_display: '0'
provider: layout_builder
context_mapping:
entity: layout_builder.entity
view_mode: view_mode
formatter:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
third_party_settings:
field_label:
label_class: ''
label_value: ''
label_tag: ''
weight: 0
additional: { }
707a2ebc-4a32-400a-87a3-d45390b2b88a:
uuid: 707a2ebc-4a32-400a-87a3-d45390b2b88a
c0834258-bd3f-437b-b7f1-9f894fe52556:
uuid: c0834258-bd3f-437b-b7f1-9f894fe52556
region: content
configuration:
id: 'field_block:node:page:markup'
label: Content
label_display: '0'
provider: layout_builder
context_mapping:
entity: layout_builder.entity
view_mode: view_mode
formatter:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
third_party_settings:
field_label:
label_class: ''
label_value: ''
label_tag: ''
weight: 1
additional: { }
third_party_settings: { }
Expand Down

0 comments on commit 723e499

Please sign in to comment.