Posts

Tempor est exercitation ad qui pariatur quis adipisicing aliquip nisi ea consequat ipsum occaecat. Nostrud consequat ullamco laboris fugiat esse esse adipisicing velit laborum ipsum incididunt ut enim. Dolor pariatur nulla quis fugiat dolore excepteur. Aliquip ad quis aliqua enim do consequat.

UI Improvements and Site Refinements

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:

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.

Code Breakdown: Document Automation Script

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:

Progress on Automating Document Generation

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

  1. 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
  2. Filename Generation

    Local Firebase Emulator Integration and UI Improvements

    Completed focus on improving the local development workflow and enhancing the user experience in the app.

    Key Actions:

    1. Configured the Flutter/Dart app to connect seamlessly to local Firebase emulators, including Firestore.
    2. Cleaned up the repository by updating .gitignore and removing unnecessary files.
    3. Improved documentation, including a guide for reinitializing the Firebase emulator database.
    4. 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:

    Site Rebuild and Debugging

    Completed a full rebuild of the Hugo site with the PaperMod theme. Key actions included:

    1. Reinitializing the repository and linking it to GitHub.
    2. Setting up the PaperMod theme and ensuring compatibility with the latest Hugo version.
    3. Debugging configuration issues, including replacing deprecated keys.
    4. Testing the site locally and verifying content structure.
    5. Creating a professional and functional journal layout.

    The site is now fully operational and ready for future updates.

    Hardening and Automating Hugo & n8n Deployment

    Summary of Steps:

    1. Update and upgrade the system
    2. Install essential packages
    3. Harden SSH and user access
    4. Set up and enable the firewall
    5. Enable automatic security updates
    6. Install and configure Nginx
    7. Automate Hugo static site builds
    8. Set up n8n with Docker Compose
    9. Fix permissions and validate
    10. Ongoing maintenance

    System Preparation

    1. Update and upgrade the system:
      sudo apt update
      sudo apt upgrade
      
    2. 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

    1. Use a non-root user for all operations.
    2. Configure SSH for key authentication only and disable password login in /etc/ssh/sshd_config:
      PasswordAuthentication no
      PermitRootLogin no
      AllowUsers <user>
      
    3. Restart SSH:
      sudo systemctl restart ssh
      

    Firewall (UFW)

    1. 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

    1. Enable unattended-upgrades:
      sudo apt install unattended-upgrades
      sudo dpkg-reconfigure --priority=low unattended-upgrades
      

    Nginx Setup

    1. Install and enable Nginx:
      sudo apt install nginx
      sudo systemctl enable nginx
      sudo systemctl start nginx
      
    2. 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;
          }
      }
      
    3. 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

    1. 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
      
    2. Reload and enable the service:
      sudo systemctl daemon-reload
      sudo systemctl enable hugo-site
      sudo systemctl start hugo-site
      

    n8n Docker Compose Setup

    1. 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
      
    2. Start n8n:
      cd ~/n8n
      docker-compose up -d
      

    Permissions

    1. Ensure all files are owned by the deploy user:
      sudo chown -R <user>:<user> /home/<user>/my-progress-journal
      

    Testing and Validation

    1. 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.

    Setting up the Journal

    Completed the initial setup of this journal. The process involved:

    1. Configuring the static site generator (Hugo)
    2. Establishing secure SSH access
    3. Preparing the environment for future updates
    4. Setting up the web server (Nginx)
    5. Setting up a reverse proxy
    6. 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.

    Post 3

    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.

    Post 2

    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.