Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10588394
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Subscribers
None
View Options
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish-dev.yml
similarity index 59%
copy from .github/workflows/docker-publish.yml
copy to .github/workflows/docker-publish-dev.yml
index ad645ca..02ba44f 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish-dev.yml
@@ -1,70 +1,75 @@
-name: Build container image, publish as GitHub-package
+name: Build container image, publish as GitHub-package (Dev)
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
+ # Trigger the workflow on pushes to 'main' and 'develop' branches for development builds
push:
branches: [ main, develop ]
- # Publish semver tags as releases.
- tags:
- - 'v*.*.*'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
- # github.repository as <account>/<repo>
- IMAGE_NAME: ${{ github.repository }}
+ # Define image name based on the repository and suffix for development
+ IMAGE_NAME: ${{ github.repository }}-dev
jobs:
build:
-
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
+ # Step 1: Checkout the code from the repository
- name: Checkout repository
uses: actions/checkout@v4
- # Set up QEMU for cross-building
+ # Step 2: Set up QEMU for cross-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
- # Set up Docker Buildx
+ # Step 3: Set up Docker Buildx, required for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- # Login against a Docker registry except on PR
+ # Step 4: Log into the container registry unless it's a pull request
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- # Extract metadata (tags, labels) for Docker
+ # Step 5: Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.6.0
with:
+ # Image name will have a -dev suffix for development builds
images: |
- ghcr.io/${{ github.repository }}
+ ghcr.io/${{ env.IMAGE_NAME }}
+ # Set 'latest' tag for the current build
flavor: latest=true
- # Build and push Docker image with Buildx (don't push on PR)
+ # Step 6: Build and push Docker development image
# https://github.com/docker/build-push-action
- name: Build and push Docker images
uses: docker/build-push-action@v5.0.0
with:
+ # Context is the root directory
context: .
+ # Set platforms for multi-architecture builds
platforms: linux/amd64,linux/arm64
- push: ${{ github.event_name != 'pull_request' }}
+ # Push the image unless it's a pull request
+ push: true
+ # Apply tags from metadata
tags: ${{ steps.meta.outputs.tags }}
+ # Apply labels from metadata
labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish-pro.yml
similarity index 56%
rename from .github/workflows/docker-publish.yml
rename to .github/workflows/docker-publish-pro.yml
index ad645ca..d3bde58 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish-pro.yml
@@ -1,70 +1,78 @@
-name: Build container image, publish as GitHub-package
+name: Build container image, publish as GitHub-package (Pro)
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
+# Trigger the workflow on version tags (v*.*.*) for production builds
on:
push:
- branches: [ main, develop ]
- # Publish semver tags as releases.
tags:
- 'v*.*.*'
env:
- # Use docker.io for Docker Hub if empty
+ # Use GitHub Container Registry for publishing
REGISTRY: ghcr.io
- # github.repository as <account>/<repo>
+ # Define image name based on the repository without any suffix for production
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
-
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
+ # Step 1: Checkout the code from the repository
- name: Checkout repository
uses: actions/checkout@v4
- # Set up QEMU for cross-building
+ # Step 2: Set up QEMU for cross-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
- # Set up Docker Buildx
+ # Step 3: Set up Docker Buildx, required for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.0.0
- # Login against a Docker registry except on PR
+ # Step 4: Log into the container registry unless it's a pull request
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- # Extract metadata (tags, labels) for Docker
+ # Step 5: Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4.6.0
with:
+ # Production image name without the -dev suffix
images: |
- ghcr.io/${{ github.repository }}
+ ghcr.io/${{ env.IMAGE_NAME }}
+ # Set 'latest' tag for the current production build
flavor: latest=true
- # Build and push Docker image with Buildx (don't push on PR)
+ # Step 6: Build and push Docker production image
# https://github.com/docker/build-push-action
- name: Build and push Docker images
uses: docker/build-push-action@v5.0.0
with:
+ # Context is the root directory
context: .
+ # Use the production Dockerfile
+ file: Dockerfile.prod
+ # Set platforms for multi-architecture builds
platforms: linux/amd64,linux/arm64
- push: ${{ github.event_name != 'pull_request' }}
+ # Push the image unless it's a pull request
+ push: true
+ # Apply tags from metadata, including 'latest' and version tag
tags: ${{ steps.meta.outputs.tags }}
+ # Apply labels from metadata
labels: ${{ steps.meta.outputs.labels }}
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index ef85671..c78af02 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -1,25 +1,26 @@
+version: '3'
services:
app:
- image: writefreely
+ image: ghcr.io/writefreely/writefreely:latest
container_name: writefreely
volumes:
- ./data:/data
ports:
- 127.0.0.1:8080:8080
depends_on:
- db
restart: unless-stopped
db:
image: lscr.io/linuxserver/mariadb
container_name: writefreely-mariadb
volumes:
- ./db:/config
environment:
- PUID=65534
- PGID=65534
- TZ=Etc/UTC
- MYSQL_DATABASE=writefreely
- MYSQL_USER=writefreely
- MYSQL_PASSWORD=P@ssw0rd
restart: unless-stopped
diff --git a/docker-compose.yml b/docker-compose.yml
index 652ce57..c4ea9f7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,47 +1,47 @@
version: "3"
volumes:
web-keys:
db-data:
networks:
external_writefreely:
internal_writefreely:
internal: true
services:
writefreely-web:
container_name: "writefreely-web"
- image: "writeas/writefreely:latest"
+ image: ghcr.io/writefreely/writefreely-dev:latest
volumes:
- "web-keys:/go/keys"
- "./config.ini:/go/config.ini"
networks:
- "internal_writefreely"
- "external_writefreely"
ports:
- "8080:8080"
depends_on:
- "writefreely-db"
restart: unless-stopped
writefreely-db:
container_name: "writefreely-db"
image: "mariadb:latest"
volumes:
- "db-data:/var/lib/mysql/data"
networks:
- "internal_writefreely"
environment:
- MYSQL_DATABASE=writefreely
- MYSQL_ROOT_PASSWORD=changeme
restart: unless-stopped
diff --git a/docker_setup_prod.sh b/docker_setup_prod.sh
new file mode 100644
index 0000000..384811c
--- /dev/null
+++ b/docker_setup_prod.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+# This script sets up the WriteFreely application using Docker by creating a local directory
+# in the current working directory (PWD) to store Docker-related files, initializing the database,
+# and performing the initial configuration.
+
+# Installation directory in the same location as the script
+INSTALL_DIR="$(pwd)/writefreely"
+
+# Create the installation directory if it doesn't exist
+if [ ! -d "$INSTALL_DIR" ]; then
+ echo "Creating directory at $INSTALL_DIR..."
+ mkdir -p "$INSTALL_DIR"
+fi
+
+# Change to the installation directory
+cd "$INSTALL_DIR" || exit
+
+# URL for the docker-compose file
+COMPOSE_URL="https://raw.githubusercontent.com/writefreely/writefreely/refs/heads/develop/docker-compose.prod.yml"
+
+# Check if docker-compose.yml already exists
+if [ ! -f "docker-compose.yml" ]; then
+ echo "docker-compose.yml not found. Downloading from $COMPOSE_URL..."
+
+ # Check if curl or wget is available and download the file
+ if command -v curl &> /dev/null; then
+ curl -o docker-compose.yml "$COMPOSE_URL"
+ elif command -v wget &> /dev/null; then
+ wget -O docker-compose.yml "$COMPOSE_URL"
+ else
+ echo "Error: Neither curl nor wget is installed. Please install one of them to proceed."
+ exit 1
+ fi
+else
+ echo "docker-compose.yml already exists. Skipping download."
+fi
+
+# Prompt the user to edit the docker-compose.yml file
+echo "Before continuing, you must edit the docker-compose.yml file to configure the database connection details."
+read -p "Press Enter when you have finished editing the file."
+
+# Run the initial command for interactive configuration
+echo "Starting WriteFreely configuration..."
+docker compose run -it --rm app writefreely config start
+
+echo "Configuration completed. Now generating keys..."
+
+# Generate the required keys
+docker compose run -it --rm app writefreely keys generate
+
+# Completion message with update instructions
+echo "Setup complete! You can now start WriteFreely with 'docker compose up -d'"
+echo "To update WriteFreely in the future, run: 'docker-compose down', 'docker-compose pull', and 'docker-compose up -d'"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Apr 25, 6:20 AM (1 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3199494
Attached To
rWF WriteFreely
Event Timeline
Log In to Comment