A Fresh Start: Moving to Drupal 11 and Ubuntu 24.04
The site has moved again. I can barely recall the last time this happened, let alone when the site truly began. The first entry mentions a previous move to Drupal 4.7. I suspect the very beginning was a simple web board or something similar. For context, my last two servers ran Ubuntu 18.04 (with Drupal 8) and before that, Ubuntu 16.04 (I believe with Drupal 6). My most recent post was in 2018.
Anyway, this latest move was prompted by an impending hardware failure: the HDD on the old Ubuntu 18.04 server is dying. So, here we are in 2025, and it's time to migrate the entire server to Drupal 11 on Ubuntu 24.04.
This content migration was a considerable effort. I chose a fresh install and migration over a standard upgrade because the old server had been compromised, and I couldn't risk carrying over any hidden malicious code.
Server Setup & Tooling
To manage the new environment, I've adopted DDEV. It's an excellent, convenient open-source wrapper and configuration tool that orchestrates Docker images for Drupal development, providing a clean, containerized setup.
- DDEV Configuration: I followed the standard instructions, which resulted in the project folder being inside my home directory. DDEV's Docker image then maps this directory to its internal filesystem path, typically
/var/www/html
. - Management: All command-line operations are now handled through DDEV's prefix, specifically using
ddev drush xxx
for alldrush
commands. - Multi-site Setup: Implementing a Drupal multi-site was straightforward. I simply created a new directory at
$DRUPAL_ROOT/web/sites/xxxx
(wherexxxx
is the site's hostname) and placed the requiredsettings.php
file inside it.
Migration
I made a deliberate choice to import only the title and body fields of all existing content, ignoring the previous site structure entirely. The process was roughly as follows:
- Database Dump: The old content was directly dumped from the MySQL database into a CSV file. I used the
SELECT ... INTO OUTFILE
command to ensure that all fields were properly enclosed by double quotes ("), which is crucial for handling complex, multi-line data. - CSV Character Fix: I ran into an issue where MySQL's dump process generated carriage return characters (
^M
) that the migrate_plus module couldn't handle, causing the import to fail. I had to use sed to remove them (the slurp command reads the whole file before substitution):sed ':a;N;$!ba;s/\r\\//g'
- Custom Migration Module: The corrected CSV was then imported using the migrate_plus module. All migration configuration details are contained within a simple custom module:
$DRUPAL_ROOT/web/modules/custom/xxx_content_migration
. - Configuration Workflow: Crucially, whenever I modify the configuration files inside the custom migration module, it must be purged and reloaded to take effect. This is the command sequence I use for a complete rollback, reload, and re-import:
ddev drush --uri=www.nattee.net pmu dae_content_migration
ddev drush --uri=www.nattee.net cr
ddev drush --uri=www.nattee.net en dae_content_migration
ddev drush --uri=www.nattee.net migrate:rollback --all
ddev drush --uri=www.nattee.net migrate:import --all
Important Migration Notes
- Required Fields: The CSV must include values for the content_type and body_format. If these values are missing, or if they reference a content type or text format that doesn't exist on the new Drupal 11 site, the migration will crash the site entirely.
- Recovery: If the site crashes, a simple rollback of the migration will usually bring the site back to life, allowing you to debug your CSV or migration configuration.
- Log in to post comments
Grad Seminar
apache mod evasive
My server has been attacked for weeks. They were brute force trying to login to MoinMoin. MoinMoin is still fine, but the server load is too high and there are too many traffic.
mod_evasive and mod-security are life savers
mod-status and awstats are also helpful in debugging and detecting the problem.
- Log in to post comments
Moving to FreeBSD desktop
Again, my desktop somehow stop working, so I reinstall with FreeBSD and kde4.
This is what I have to do
Ports
x system
after that edit rc.conf and add dbus_enable="YES" hald_enable="YES" kdm4_enable="YES" linux_enable="YES"
reboot to kde4 and install these ports
Fix Firefox
Firefox is ugly in the Default FreeBSD ports. This is what I have to do.
ports
after that, go to start menu --> system setting --> gtk style and fonts --> choose qtcurve as widget
I got these from http://forum.kde.org/viewtopic.php?t=17786
Flash Plugins
http://www.freebsd.org/doc/handbook/desktop-browsers.html
Vim
Initially, I cannot get gvim to work. See these
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/180417 http://forums.freebsd.org/showthread.php?t=40610
It works when I compiled the port with "make -DWITH_OPTIONS install clean"
KeePass
Have to install mono and /usr/ports/x11-toolkits/libgdiplus
- Log in to post comments
new OpenVPN
มีเพิ่มเติม 2 บรรทัด ให้ push routing ไปยัง client บรรทัดแรกบอกว่าทั้งหมดในจุฬาให้ใช้ผ่าน vpn บรรทัดที่สองบอกว่าต่อเข้า server ovpn ผ่านทาง network ปรกติ
push route 161.200.0.0 255.255.0.0
push route remote_host 255.255.255.255 net_gateway 1
- Log in to post comments
Desktop linux again
openSUSE 12.3 and openSUSE 13.1
ปุ่มปรับ backlight ไม่ work
เครื่อง asus zenbook ให้แก้โดยเพิ่ม kernel option
acpi_backlight=none acpi_osi=
ทำโดย
sudo vi /etc/default/grub
แล้วแก้โดยเปลี่ยน
GRUB_CMDLINE_LINUX_DEFAULT=\"resume=/dev/system/swap splash=silent quiet showopts\"
เป็น
GRUB_CMDLINE_LINUX_DEFAULT=\"resume=/dev/system/swap splash=silent quiet showopts acpi_backlight=none acpi_osi=\"
แล้วสั่ง sudo update-grub
Fix YaST2 and rvm
YaST is ported to ruby and out-of-the-box DOES NOT work with rvm. I have to
gem install fast_gettext
to fix this.
network not working
check this http://forums.opensuse.org/english/get-technical-help-here/network-internet/485115-12-3-internet-connection-confusion.html Stop the service first
systemctl is-active network.service && \\
systemctl stop network.service
Enable NetworkManager
systemctl --force enable NetworkManager.service
Enable the service again
systemctl start network.service
repositories
- add packman repositories
package
- via communities repositories (PackMan, etc.)
sudo zypper install git subversion mercurial gcc-c++ kate emacs gvim gnucash filezilla krusader texlive gimp inkscape wine smb4k artha vlc comix keepass dropbox wine wine-mp3 virtualbox sysstat lsb htop iotop
We also needs other lib for development libxslt-devel libxml2-devel libmysqlclient-devel python-devel
- Other packages
- codeblock
- steam
- synergy
VirtualBox
- I use the default package from openSUSE
- for USB problem, check http://forums.opensuse.org/showthread.php/493771-Can-t-attach-USB-device-to-VirtualBox
- VirtualBox package from oracle https://www.virtualbox.org/wiki/Linux_Downloads
LibreOffice 4
my widget looks ugly, have to install package libreoffice-gnome
Codec
http://opensuse-guide.org/codecs.php
Font Config
ต้องใช้ไฟล์ ~/.fonts.conf (มีอยู่ใน hg linux-file แล้ว) อย่าลืม ln -s linux-file/.fonts.conf
อย่าลืมติดตั้ง font ต่าง ๆ อ่าน http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/
Mouse Problem
- vi /etc/X11/xorg.conf.d/50-synaptics.conf
- add
to the InputClass of synaptics, making the section become Section "InputClass" Identifier "touchpad catchall" Driver "synaptics" MatchIsTouchpad "on"
This option is recommend on all Linux systems using evdev, but cannot be enabled by default. See the following link for details: who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html MatchDevicePath \"/dev/input/event*\"
Option \"HorizScrollDelta\" \"0\"
enable tap-to-click as default (bnc#722457)
Option \"TapButton1\" \"1\"
Option \"TapButton3\" \"2\"
Option \"TapButton2\" \"3\"
Option \"VertResolution\" \"100\"
Option \"HorizResolution\" \"65\"
# disable synaptics driver pointer acceleration
Option \"MinSpeed\" \"3\"
Option \"MaxSpeed\" \"20\"
# tweak the X-server pointer acceleration
#Option \"AccelerationProfile\" \"2\"
Option \"AdaptiveDeceleration\" \"1\"
Option \"ConstantDeceleration\" \"16\"
Option \"VelocityScale\" \"32\"
EndSection
Samba
- enable firewall for netbios server, smbclient http://opensuse-guide.org/windows.php
Set the Promp
use http://www.kirsle.net/wizards/ps1.html read this as well http://www.fvue.nl/wiki/Bash:_How_to_change_tab_and_window_title_of_console check this two for 256 colors as well
- http://www.askapache.com/linux/bash-power-prompt.html#256_Color_Prompt_Command
- http://www.logilab.org/blogentry/20255
- http://misc.flogisoft.com/bash/tip_colors_and_formatting
the current prompt is
mount ntfs
Pimp my Firefox
on HiDPI display, the ui element is very small. Fix by following option in about:config
[code] layout.css.devPixelsPerPx=2 [/code]
also we need to add font size to ~/.mozilla/firefox/XXXX.default/chrome/userContent.css [code lang='css'] @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
- {font-size: 14px !important; } [/code]
I love my KDE in black but firefox won't agree with this. Create this file ~/.mozilla/firefox/XXXX.default/chrome/userContent.css
[code lang="css"]
input {
border: 2px inset white ;
background-color: white ;
color: black ;
}
textarea {
border: 2px inset white ;
background-color: white ;
color: black ;
}
select {
border: 2px inset white;
background-color: white;
color: black;
}
input[type="radio"], input[type="checkbox"] { border: 2px inset white ; background-color: white; color: ThreeDFace l }
|::-moz-radio { background-color: white; }
button, input[type="reset"], input[type="button"], input[type="submit"] { border: 2px outset white; background-color: #eeeeee; color: black; }
body { background-color: white; color: black; display: block; margin: 8px; } [/code]
Misc.
HG repo
- https://isl2-dev.cp.eng.chula.ac.th/hg/vim_config สำหรับ .vimrc และ folder .vim (อย่าลืม ln เอง)
- https://isl2-dev.cp.eng.chula.ca.th/hg/linux-file สำหรับ .hgrc และ .bashrc และ font ต่าง ๆ (อย่าลืม ln)
.hgrc เริ่มต้น [code] [ui] username=Nattee Niparnan [email protected]
[hostfingerprints] isl2-dev.cp.eng.chula.ac.th=26:7f:97:cc:de:4c:fa:b8:60:3b:31:96:62:3a:5d:02:00:7f:ce:ed
[auth] isl2-dev.prefix=https://isl2-dev.cp.eng.chula.ac.th/hg isl2-dev.username=ไม่บอก isl2-dev.password=ไม่บอก [/code]
- Log in to post comments
Person name around the world
This is very interesting. See also Arabic name
- Log in to post comments
RDC 2013
Programming iRobot Create
-
EXAMPLE --> RDC2013_v1_main.cpp
-
download MS Visual Studio 2008 Express ให้เลือก Visual C++ 2008 Express Edition with SP1 และเลือกภาษา English แล้วกด Download (ต้องใช้ version 2008 เท่านั้น)
-
download iRobot Create package v1
-
download State Machine Demo v2
-
download Timing Demo v3
-
Slide สำหรับ state machine (http://www.nattee.net/files-dae/State_Machine.pptx)
-
Slide สำหรับเนื้อหาในวันที่ 25 download ที่นี่<
-
Driver ของ USB to Serial อันที่แจกให้
[code lang="c++"]
#include <stdio.h> #include
#include "RobotConnector.h"
#include "cv.h" #include "highgui.h"
using namespace std;
#define Create_Comport "COM4"
bool isRecord = false;
int main() { CreateData robotData; RobotConnector robot;
ofstream record;
record.open(\"../data/robot.txt\");
if( !robot.Connect(Create_Comport) )
{
cout << \"Error : Can't connect to robot @\" << Create_Comport << endl;
return -1;
}
robot.DriveDirect(0, 0);
cvNamedWindow(\"Robot\");
while(true)
{
cvWaitKey(30);
double vx, vz;
vx = vz = 0;
if (robotData.bumper[0]) {
cout << \"bump left\" << endl;
}
if (robotData.bumper[1]) {
cout << \"bump right\" << endl;
}
double vl = vx - vz;
double vr = vx + vz;
int velL = (int)(vl*Create_MaxVel);
int velR = (int)(vr*Create_MaxVel);
int color = (abs(velL)+abs(velR))/4;
color = (color < 0) ? 0 : (color > 255) ? 255 : color;
int inten = (robotData.cliffSignal[1] + robotData.cliffSignal[2])/8 - 63;
inten = (inten < 0) ? 0 : (inten > 255) ? 255 : inten;
//cout << color << \" \" << inten << \" \" << robotData.cliffSignal[1] << \" \" << robotData.cliffSignal[2] << endl;
robot.LEDs(velL > 0, velR > 0, color, inten);
if( !robot.DriveDirect(velL, velR) )
cout << \"SetControl Fail\" << endl;
if( !robot.ReadData(robotData) ) {
//cout << \"ReadData Fail\" << endl;
}
if( isRecord )
record << robotData.cliffSignal[0] << \"\\t\" << robotData.cliffSignal[1] << \"\\t\" << robotData.cliffSignal[2] << \"\\t\" << robotData.cliffSignal[3] << endl;
cout << \"Robot \" << robotData.cliffSignal[0] << endl;
}
robot.Disconnect();
return 0;
} [/code]
- Log in to post comments
Drupal feed importer
Recently, I have a chance to use drupal commerce with feed importer. Feed importer is very good because I can easily transfer data from MySQL to the website.
However, sometime the import process crash and I am stuck with importing page with xx% status and nothing can be done via UI.
To fix this, I have to manually edit the status of the import. Basically, all I have to do is to
update feeds_source set state = 'b:0;'; update feeds_source set fetcher_result='b:0;';
Check this .
- Log in to post comments