Recent Posts
I made several important refinements to the Track[keep] journal site, focusing on improving user experience and preparing the site for production. Here’s a summary of the changes:
Social Links and Site Header
I improved the header layout to integrate both the site title “Track[keep]” and social media links in the top padding area alongside the dark mode toggle button. This creates a more cohesive and accessible navigation experience while freeing up space in the footer.
Document Automation Code
As part of the document automation project, I developed the following VBScript code to handle the automatic generation and saving of agenda documents. Below is the sanitized version of the script with explanatory comments:
Sub SaveReportAsDocx()
Dim mondayDate As Date
Dim formattedDate As String
Dim cc As ContentControl
Dim docName As String, savePath As String
Dim currentYear As String
Dim basePath As String
' Get the Monday of the current week
mondayDate = Date - Weekday(Date, vbMonday) + 1
formattedDate = Format(mondayDate, "MM_DD_YYYY")
' Extract the current year from the Monday date
currentYear = Year(mondayDate)
' Set base directory for agendas, adjusting for year
basePath = "C:\Users\Username\Documents\Reports\" & currentYear & "\"
' Ensure the directory exists (prevents errors if folder isn't made yet)
If Dir(basePath, vbDirectory) = "" Then MkDir basePath
' Update the content control for the date inside the document
For Each cc In ActiveDocument.ContentControls
If cc.Tag = "ReportDate" Then
cc.Range.Text = formattedDate
End If
Next cc
' Define the filename dynamically
docName = "USER " & formattedDate & " Report - Agenda - Department.docx"
' Set full save path
savePath = basePath & docName
' Save the document as .docx (without macros)
ActiveDocument.SaveAs2 savePath, wdFormatXMLDocument
' Notify user of save completion
MsgBox "Report saved as: " & savePath, vbInformation, "Save Confirmation"
End Sub
Private Sub CommandButton1_Click()
SaveReportAsDocx
End Sub
Key Code Elements
Date Calculation
The script automatically calculates the Monday of the current week using:
Overview
I made significant progress in developing a macro to automate the generation of agenda documents in Microsoft Word. This automation tool streamlines the process by dynamically inserting dates, creating filenames, and saving documents in the correct format.
Key Features Implemented
-
Dynamic Date Insertion
- The macro calculates the Monday of the current week and formats the date for both document content and filename
- Example: Document content date as
XX/XY/YEAR
and filename date as XX_YY_YEAR
-
Filename Generation
Completed focus on improving the local development workflow and enhancing the user experience in the app.
Key Actions:
- Configured the Flutter/Dart app to connect seamlessly to local Firebase emulators, including Firestore.
- Cleaned up the repository by updating
.gitignore
and removing unnecessary files.
- Improved documentation, including a guide for reinitializing the Firebase emulator database.
- Outlined next steps for meal-building features and UI polish.
Features Added:
- Firestore emulator integration for local development and easy switching between environments.
- Ingredient management: fetch and display ingredients from the database with simplified debug logging.
- Meal building: users can build meals using database ingredients, with nutritional value calculations.
- UI improvements for a more intuitive and polished experience.
Performance:
Completed a full rebuild of the Hugo site with the PaperMod theme. Key actions included:
- Reinitializing the repository and linking it to GitHub.
- Setting up the PaperMod theme and ensuring compatibility with the latest Hugo version.
- Debugging configuration issues, including replacing deprecated keys.
- Testing the site locally and verifying content structure.
- Creating a professional and functional journal layout.
The site is now fully operational and ready for future updates.
Summary of Steps:
- Update and upgrade the system
- Install essential packages
- Harden SSH and user access
- Set up and enable the firewall
- Enable automatic security updates
- Install and configure Nginx
- Automate Hugo static site builds
- Set up n8n with Docker Compose
- Fix permissions and validate
- Ongoing maintenance
System Preparation
- Update and upgrade the system:
sudo apt update
sudo apt upgrade
- Install essential packages:
sudo apt install ufw
sudo apt install unattended-upgrades
sudo apt install docker.io
sudo apt install docker-compose
sudo apt install nginx
sudo apt install python3-pip
User and SSH Security
- Use a non-root user for all operations.
- Configure SSH for key authentication only and disable password login in
/etc/ssh/sshd_config
:
PasswordAuthentication no
PermitRootLogin no
AllowUsers <user>
- Restart SSH:
sudo systemctl restart ssh
Firewall (UFW)
- Allow only necessary services:
sudo ufw allow OpenSSH
sudo ufw allow <web-service>
sudo ufw allow <secure-web-service>
sudo ufw enable
Automatic Security Updates
- Enable unattended-upgrades:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
Nginx Setup
- Install and enable Nginx:
sudo apt install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
- Configure Nginx as a static file server for Hugo:
server {
listen <web-service>;
server_name <your-domain>;
root /home/<user>/my-progress-journal/public;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
- Enable the site and reload Nginx:
sudo ln -s /etc/nginx/sites-available/<your-site> /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Hugo Static Site Automation
- Create a systemd service
/etc/systemd/system/hugo-site.service
:
[Unit]
Description=Hugo Static Site Builder
After=network.target
[Service]
Type=oneshot
User=<user>
WorkingDirectory=/home/<user>/my-progress-journal
ExecStartPre=/usr/bin/sudo /usr/bin/chown -R <user>:<user> /home/<user>/my-progress-journal/public
ExecStart=/usr/local/bin/hugo --baseURL https://<your-domain>
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
- Reload and enable the service:
sudo systemctl daemon-reload
sudo systemctl enable hugo-site
sudo systemctl start hugo-site
n8n Docker Compose Setup
- Example
docker-compose.yml
in ~/n8n
:
version: "3"
services:
n8n:
container_name: n8n
image: n8nio/n8n
restart: always
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=<user>
- N8N_BASIC_AUTH_PASSWORD=<password>
- N8N_HOST=<n8n-domain>
- N8N_PORT=<port>
- N8N_PROTOCOL=http
volumes:
- /home/<user>/.n8n:/home/node/.n8n
ports:
- "<port>:<port>"
networks:
- n8n_internal
networks:
n8n_internal:
external: true
- Start n8n:
cd ~/n8n
docker-compose up -d
Permissions
- Ensure all files are owned by the deploy user:
sudo chown -R <user>:<user> /home/<user>/my-progress-journal
Testing and Validation
- Reboot the server and confirm:
- Nginx, Hugo, and n8n all start automatically.
- The site is served correctly via Nginx.
- n8n is accessible via its domain (if proxied).
Ongoing Maintenance
- Use only the deploy user for builds and deploys.
- Monitor logs and security updates.
- Remove any unnecessary scripts or services.
Completed the initial setup of this journal. The process involved:
- Configuring the static site generator (Hugo)
- Establishing secure SSH access
- Preparing the environment for future updates
- Setting up the web server (Nginx)
- Setting up a reverse proxy
- Deploying the workflow automation platform (n8n, managed with Docker Compose)
All steps were completed with best practices in mind, ensuring a solid foundation for ongoing progress tracking.
Occaecat aliqua consequat laborum ut ex aute aliqua culpa quis irure esse magna dolore quis. Proident fugiat labore eu laboris officia Lorem enim. Ipsum occaecat cillum ut tempor id sint aliqua incididunt nisi incididunt reprehenderit. Voluptate ad minim sint est aute aliquip esse occaecat tempor officia qui sunt. Aute ex ipsum id ut in est velit est laborum incididunt. Aliqua qui id do esse sunt eiusmod id deserunt eu nostrud aute sit ipsum. Deserunt esse cillum Lorem non magna adipisicing mollit amet consequat.
Anim eiusmod irure incididunt sint cupidatat. Incididunt irure irure irure nisi ipsum do ut quis fugiat consectetur proident cupidatat incididunt cillum. Dolore voluptate occaecat qui mollit laborum ullamco et. Ipsum laboris officia anim laboris culpa eiusmod ex magna ex cupidatat anim ipsum aute. Mollit aliquip occaecat qui sunt velit ut cupidatat reprehenderit enim sunt laborum. Velit veniam in officia nulla adipisicing ut duis officia.
Exercitation voluptate irure in irure tempor mollit Lorem nostrud ad officia. Velit id fugiat occaecat do tempor. Sit officia Lorem aliquip eu deserunt consectetur. Aute proident deserunt in nulla aliquip dolore ipsum Lorem ut cupidatat consectetur sit sint laborum. Esse cupidatat sit sint sunt tempor exercitation deserunt. Labore dolor duis laborum est do nisi ut veniam dolor et nostrud nostrud.