A scalable blog application built with Go, MinIO for storage, Docker for containerization, and Cloudflare for secure HTTPS and DNS management.
- Go: Backend server using the Go programming language.
- MinIO: Object storage for storing blog posts.
- Docker: Containerization of the application.
- Cloudflare: Secure HTTPS and DNS management.
- Caddy: Automatic HTTPS configuration.
- Go
- Docker
- MinIO
- Caddy
- Cloudflare account
blog.cdaprod/
├── main.go
├── database.go
├── templates/
│ ├── index.html
│ ├── post.html
│ └── create.html
├── Dockerfile
├── go.mod
├── go.sum
└── README.md
git clone https://github.com/Cdaprod/blog.cdaprod.git
cd blog.cdaprodEnsure you have MinIO running and create a bucket named blog-posts. Update your MinIO credentials in main.go.
Build the Docker image:
docker build -t blog.cdaprod .Run the Docker container:
docker run -p 8080:8080 blog.cdaprod- Create an
Arecord forblog.cdaprodpointing to your server’s IP address in Cloudflare. - Enable SSL/TLS in "Full (strict)" mode in Cloudflare.
Create a Caddyfile:
blog.cdaprod {
reverse_proxy localhost:8080
}Start Caddy:
caddy start --config CaddyfileVisit https://blog.cdaprod in your web browser.
- Navigate to
/create. - Fill in the form with your post details.
- Submit the form to create a new post.
- Navigate to the home page to see a list of posts.
- Click on a post title to view the full post.
- Sets up the HTTP server and routes.
- Handles requests to create, view, and list blog posts.
- Interacts with MinIO to store and retrieve blog content.
- Initializes the SQLite database.
- Sets up the
poststable for storing post metadata.
Contains HTML templates for the application:
index.html: Home page.post.html: Post detail page.create.html: Create post form.
- Defines the Docker image for the application.
- Specifies environment variables for MinIO credentials.
Ensure the following environment variables are set for MinIO:
MINIO_ENDPOINT=play.min.io
MINIO_ACCESS_KEY=YOUR-ACCESS-KEY
MINIO_SECRET_KEY=YOUR-SECRET-KEYThis project is licensed under the MIT License. See the LICENSE file for details.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
David Cannan - LinkedIn - Twitter
Feel free to reach out for any questions or collaboration opportunities!
This `README.md` covers the project overview, installation steps, usage instructions, code structure, environment variables, and contribution guidelines. Make sure to replace placeholders like `YOUR-ACCESS-KEY` and `YOUR-SECRET-KEY` with your actual credentials before running the application.