1 line
5.7 KiB
JSON
1 line
5.7 KiB
JSON
[{"categories":["homelab","gitea"],"contents":"Since the reset of the website, I have been working on getting it to auto build and deploy using Gitea Actions. Which is similar and compatible to GitHub Actions\nBefore implementing the action it was a manual process which required using docker commands to login, build and push the image to the container registry.\nWhy use CI/CD? It takes the manual process steps away and does them for you, helping you to avoid missing any steps and avoiding errors. This also makes the interaction seamless and automated.\nSetting up the Aciton To setup the action we first needed to create some \u0026ldquo;secrets\u0026rdquo; in the repo. Secrets are secure variables that are requied to interact with systems. Such as passwords, usernames, SSH Keys etc.\nAfter populating our secrets file we can then create our .gitea/workflows/build.yml file. This file contains all the steps to build, test and deploy the container.\n{% raw %}\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 on: push jobs: build-node: runs-on: ubuntu-latest container: image: catthehacker/ubuntu:act-latest steps: - name: checkout repo uses: actions/checkout@v4 - name: Use Node.js uses: actions/setup-node@v4 - name: Install Node Dependencies run: npm ci - name: Build 11ty Site run: npm run build --if-present - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v3 with: registry: git.comprofix.com username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Build and push uses: docker/build-push-action@v6 with: context: ./ file: ./Dockerfile push: true tags: git.comprofix.com/mmckinnon/comprofix.com:latest publish: runs-on: ubuntu-latest steps: - name: checkout repo uses: actions/checkout@v4 - name: Publish Website run: | mkdir ~/.ssh echo \u0026#34;${{ secrets.SSH_KNOWN_HOSTS }}\u0026#34; \u0026gt;\u0026gt; ~/.ssh/known_hosts chmod 644 ~/.ssh/known_hosts eval $(ssh-agent -s) ssh-add \u0026lt;(echo \u0026#34;${{ secrets.SSH_PRIVATE_KEY }}\u0026#34;) ssh administrator@comprofix.com \u0026#34;cd /opt/comprofix; docker compose down\u0026#34; || true scp docker-compose.yml administrator@comprofix.com:/opt/comprofix ssh administrator@comprofix.com \u0026#34;cd /opt/comprofix; docker compose pull; docker compose up -d\u0026#34; {% endraw %}\nbuild.yml explained 1 on: push This tells the action to run when code is pushed to the repo. 1 2 3 runs-on: ubuntu-latest container: image: catthehacker/ubuntu:act-latest This specified the \u0026ldquo;container\u0026rdquo; to use to run all the steps on. This was crucial as running without a \u0026ldquo;conatiner\u0026rdquo; would fail as not all required dependencies where available 1 2 3 4 jobs: build-node: ... publish: These are the names of the separate jobs for the build action. The build node will build the site and create the new docker container and push to the registry. The publish will connect the host running the container and restart using the new container. 1 steps: Each job has a list of steps it performs on the code. Most of these a pretty self explaining on what they do. Everything from check out the code. Setup Node environment and build. Run the docker commands to login to the registry, build the container and push. Then the last job steps connect the host and pull the new container and start. Gitea Action Completes Once the new code was commited to the repo the Action was able to complete successfully.\n","permalink":"http://localhost:1313/post/2024-09-21-websitedeployment/","tags":["homelab","git","docker","ci","cd","continuous integration","continuous deployment"],"title":"Continuous Integration \u0026 Continuous Deployment"},{"categories":["homelab"],"contents":"It\u0026rsquo;s time to reset the website and start building my blog again. I have had this domain for a number of years and it has always been used for my E-Mail.\nBut the website has been more of a play ground for experimenting and testing.\nI am now hoping to get into the habit of writing more blog posts as I document my journey as I experiment with my HomeLab.\n","permalink":"http://localhost:1313/post/2024-09-05-resetrestart/","tags":["homelab"],"title":"Reset and Restart"},{"categories":null,"contents":"Chirpy is a blog theme originally based on Jekyll. Due to Jekyll\u0026rsquo;s design limitations, it does not natively support internationalization (i18n) and requires third-party plugins for i18n functionality. To enable i18n support for Chirpy without the hassle of relying on third-party plugins, the hugo-theme-chirpy project migrated the Chirpy theme to Hugo with minimal adaptations. All features of Chirpy are available in hugo-theme-chirpy (though some functionalities may operate differently within the Hugo framework).\nFollow the posts in the demo site to quickly set up a free personal blog!\nFeatures Dark Mode: Enhanced readability in low-light environments. Multilingual UI: Easily switch between different languages. Efficient Post Organization: Use hierarchical categories, trending tags, recommended reading, and search functionalities. Optimized Layout: Includes TOC, syntax highlighting, prompts, and more. Rich Writing Extensions: Support for mathematical formulas, charts, flowcharts, and embedded media. Multiple Comment Systems: Choose from various commenting options. Web Analysis Tools: Integrated with multiple analytics tools. Modern Web Technologies: Built for SEO and web performance. RSS Feed Support: Keep your readers updated with RSS feeds. ","permalink":"http://localhost:1313/about/","tags":null,"title":"About"},{"categories":null,"contents":"","permalink":"http://localhost:1313/archives/","tags":null,"title":"Archives"}] |