Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions manifests/wordpress/content-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: content
namespace: wordpress
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 32Gi
storageClassName: cephfs-nvme
5 changes: 5 additions & 0 deletions wordpress/bin/startup-wp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh
set -e
#cp -rnT /share/wordpress/themes /content/themes
ln -snf /share/wordpress/themes /content/themes
ln -snf /share/wordpress/plugins /content/plugins
ln -snf /uploads /content/uploads
ln -snf /content /share/wordpress/wp-content
if ! wp core is-installed 2>/dev/null; then
wp core install --url="$PRIMARY_URL" --title="OCF WordPress Template" --admin_user=admin --admin_password="$(tr -dc '[:alnum:]' < /dev/urandom | head -c256)" --admin_email="wp-admin@ocf.berkeley.edu" --allow-root
fi
Expand Down
2 changes: 2 additions & 0 deletions wordpress/config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ http {

index index.php index.html index.htm;

client_max_body_size 100M;

upstream php {
server 127.0.0.1:9000;
}
Expand Down
7 changes: 5 additions & 2 deletions wordpress/config/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
define( 'WP_DEBUG_DISPLAY', false );

# Must be set, otherwise Wordpress tries to find it in the nix store
define( 'WP_CONTENT_DIR', '/share/wordpress/wp-content' );
define( 'WP_CONTENT_DIR', '/content' );
define( 'WP_PLUGIN_DIR', '/share/wordpress/plugins' );

# The install/themes/plugins are constant and cannot be updated by the user
define( 'AUTOMATIC_UPDATER_DISABLED', true );
define( 'WP_AUTO_UPDATE_CORE', false );
define( 'DISALLOW_FILE_MODS', true );

define( 'FS_METHOD', 'direct' );

# Requests to wordpress.org will fail and cause slowdowns otherwise
define( 'WP_HTTP_BLOCK_EXTERNAL', true );
#define( 'WP_HTTP_BLOCK_EXTERNAL', true );

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion wordpress/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
DB_HOST: mariadb
PRIMARY_URL: http://localhost:8080
ports:
- 8080:8080
- 8080:443
volumes:
- wp-uploads:/share/wordpress/wp-content/uploads
tmpfs:
Expand Down
12 changes: 6 additions & 6 deletions wordpress/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 35 additions & 6 deletions wordpress/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
inputs = {
nixpkgs = {
type = "github";
owner = "nixos";
owner = "sophiebsw";
repo = "nixpkgs";
ref = "nixos-25.11";
ref = "fix-wordpress-overriding-26.05";
};

systems = {
Expand All @@ -25,18 +25,37 @@
...
}:
let
pkgsFor = system: import nixpkgs { inherit system; };
extraPlugins = builtins.fromJSON (builtins.readFile ./pkgs/extraPlugins.json);
extraPluginLicenses = nixpkgs.lib.genAttrs (nixpkgs.lib.attrNames extraPlugins) (name: "free");
extraThemes = builtins.fromJSON (builtins.readFile ./pkgs/extraThemes.json);
extraThemeLicenses = nixpkgs.lib.genAttrs (nixpkgs.lib.attrNames extraThemes) (name: "free");

overlays = nixpkgs.lib.singleton (
final: prev: {
wordpressPackages = prev.wordpressPackages.override (prev: {
plugins = prev.plugins // extraPlugins;
pluginLicenses = prev.pluginLicenses // extraPluginLicenses;
themes = prev.themes // extraThemes;
themeLicenses = prev.themeLicenses // extraThemeLicenses;
});
}
);

pkgsFor = system: import nixpkgs { inherit system overlays; };
forAllSystems = fn: nixpkgs.lib.genAttrs (import systems) (system: fn (pkgsFor system));

in
{
inherit extraPluginLicenses;
formatter = forAllSystems (pkgs: pkgs.nixfmt-tree);
wordpress = forAllSystems (pkgs: pkgs.wordpressPackages);

packages = forAllSystems (
pkgs:
let
timestamp = builtins.readFile (
pkgs.runCommand "timestamp" { } ''
date --date='@${builtins.toString self.lastModified}' --iso-8601=minutes > $out
date --date='@${toString self.lastModified}' --iso-8601=minutes > $out
''
);
mkShAppInputs =
Expand All @@ -56,7 +75,7 @@
mkWpContent =
name: pkgsToLink:
let
path = "share/wordpress/wp-content/${name}";
path = "share/wordpress/${name}";
in
pkgs.runCommand name { } ''
mkdir -p $out/${path}
Expand All @@ -74,6 +93,7 @@
wpWithConfig = pkgs.wordpress.overrideAttrs (old: {
postInstall = ''
cp ${wpConfig}/share/wordpress/wp-config.php $out/share/wordpress/wp-config.php
rm -r $out/share/wordpress/wp-content
'';
});

Expand All @@ -86,12 +106,21 @@
[
twentytwentyfive
twentytwentyfour
hestia
]
);
plugins = mkWpContent "plugins" (
with pkgs.wordpressPackages.plugins;
[
hello-dolly
duplicate-page
elementor
gtranslate
themeisle-companion
updraftplus
wordpress-importer
wpforms-lite
wp-migrate-db
wpvivid-backuprestore
]
);
in
Expand Down
50 changes: 50 additions & 0 deletions wordpress/pkgs/extraPlugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"duplicate-page": {
"path": "duplicate-page/trunk",
"rev": "3526446",
"sha256": "1nan631k8qbps5fkxlcr933zkccpn8brb6x0w77w0fzw75way60f",
"version": "4.5.9"
},
"elementor": {
"path": "elementor/tags/4.1.5",
"rev": "3607642",
"sha256": "068lhbjaj0qglv0jrmsyv4f52nl89wn3d6hjipgbbjy2i27pd4v5",
"version": "4.1.5"
},
"gtranslate": {
"path": "gtranslate/tags/3.1.1",
"rev": "3562536",
"sha256": "1nzw8971g50qkg88jl908i3mbp3ql4ia6fchv8l6aqjl43hqiff0",
"version": "3.1.1"
},
"themeisle-companion": {
"path": "themeisle-companion/tags/3.0.7",
"rev": "3574306",
"sha256": "1ygpy6xn21fkb85pmya5qpbkcjyh0kp44dplj9iyg1cksa1nwb72",
"version": "3.0.7"
},
"updraftplus": {
"path": "updraftplus/tags/1.26.5",
"rev": "3561938",
"sha256": "04pggb1fy41js01b8fwfx7d15jbb1gj14grx16rx6bq2h24wixd4",
"version": "1.26.5"
},
"wordpress-importer": {
"path": "wordpress-importer/tags/0.9.5",
"rev": "3390741",
"sha256": "05j6jbjs0yhg4im5z65r6960waxydgcd1vxpaq17sr2l6zlc3y2z",
"version": "0.9.5"
},
"wp-migrate-db": {
"path": "wp-migrate-db/tags/2.7.10",
"rev": "3591679",
"sha256": "19fxfqxx91fmscvakvvpjg2x8jf8fjcp884c9yygdra0224rsdky",
"version": "2.7.10"
},
"wpvivid-backuprestore": {
"path": "wpvivid-backuprestore/tags/0.9.130",
"rev": "3600930",
"sha256": "1p7qm1wqy6zdh7rnkrbzwk03ylj1mv96dg0286ligy0rf9pmr0k6",
"version": "0.9.130"
}
}
8 changes: 8 additions & 0 deletions wordpress/pkgs/extraThemes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"hestia": {
"path": "hestia/3.3.4",
"rev": "329715",
"sha256": "1cfcghavqaxl5b2dl5i5mn7ibfg1k91hddpkar1abchjscaq43qj",
"version": "3.3.4"
}
}
Loading