Pike13Sync is a Go application that synchronizes class schedules from the Pike13 studio management system to Google Calendar. This tool helps fitness studio owners and administrators keep their Google Calendar up-to-date with class schedules automatically.
- Overview
- Features
- Prerequisites
- Setup Options
- Configuration
- Automation
- Log Management
- Usage
- Monitoring and Notifications
- Troubleshooting
- Uninstalling
- Contributing
- License
Pike13Sync connects to your Pike13 account API, fetches upcoming class schedule data, and synchronizes it to a specified Google Calendar. It can be run manually or automatically via GitHub Actions.
- Synchronize Pike13 class schedules to Google Calendar
- Support for class details including instructors, capacity, and waitlist status
- Color-coding for class status (active vs. canceled)
- Dry run mode for testing without making changes
- GitHub Actions integration for serverless operation
- Detailed logging for troubleshooting
- Customizable schedules for automatic synchronization
- GitHub account (for GitHub Actions deployment)
- Pike13 account with API access
- Google Cloud account with Calendar API enabled
- Service account credentials for Google Calendar API
The recommended deployment method is using GitHub Actions:
-
Fork or clone this repository to your GitHub account
-
Set up required secrets in your repository:
GOOGLE_CREDENTIALS: Your Google Calendar service account credentials JSONPIKE13_CLIENT_ID: Your Pike13 API client IDCALENDAR_ID: Your Google Calendar ID
-
Enable workflows in the Actions tab of your repository
-
Run the preflight test workflow to verify connectivity
-
Schedule automatic syncs or run them manually as needed
See deployment/README.md for detailed GitHub Actions setup instructions.
For local development or manual operation:
-
Clone the repository
-
Set up Google Calendar API:
- Create a service account with Calendar API access
- Download credentials JSON to
./credentials/credentials.json - Share your Google Calendar with the service account
-
Create a
.envfile with your configuration:CALENDAR_ID=your_calendar_id@group.calendar.google.com PIKE13_CLIENT_ID=your_pike13_client_id GOOGLE_CREDENTIALS_FILE=./credentials/credentials.json TZ=America/Los_Angeles -
Run with:
./run.sh
Pike13Sync can be configured in several ways, in order of precedence:
- Command-line flags (highest priority)
- Environment variables (via
.envfile or set directly) - Default values (lowest priority)
| Variable | Description | Default Value |
|---|---|---|
CALENDAR_ID |
Google Calendar ID | "primary" |
GOOGLE_CREDENTIALS_FILE |
Path to Google API credentials | "./credentials/credentials.json" |
PIKE13_CLIENT_ID |
Pike13 API client ID | (required, no default) |
PIKE13_URL |
Pike13 API endpoint URL | "https://herosjourneyfitness.pike13.com/api/v2/front/event_occurrences.json" |
TZ |
Time zone for calendar events | "America/Los_Angeles" |
LOG_PATH |
Path to log file | "./logs/pike13sync.log" |
DRY_RUN |
Whether to run without making changes | "false" |
GitHub Actions provides built-in scheduling through the workflow file:
on:
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
# Alternative: Run every 6 hours
# - cron: '0 */6 * * *'
# Alternative: Run at 8 AM and 8 PM UTC
# - cron: '0 8,20 * * *'You can modify the schedule in the .github/workflows/sync.yml file.
For local deployment, you can set up a cron job:
# Edit your crontab
crontab -e
# Add a job to run Pike13Sync every hour
0 * * * * cd /path/to/pike13sync && ./run.sh >> ./logs/cron.log 2>&1When running on GitHub Actions, logs are automatically captured and available in the Actions tab:
- Go to your repository's Actions tab
- Click on the specific workflow run
- View logs for each step
Logs are also saved as artifacts for 14 days and can be downloaded for detailed analysis.
Pike13Sync creates logs in the ./logs directory:
pike13sync.log: Main application logpike13_response.json: Raw response from Pike13 API (for debugging)cron_run.log: Output from scheduled runs
To increase logging verbosity, use the --debug flag:
./run.sh --debugPike13Sync offers several command-line options:
--dry-run Dry run mode - don't actually modify Google Calendar
--from Test from date (format: 2025-01-01)
--to Test to date (format: 2025-01-07)
--debug Enable debug mode with extra logging
--sample Only fetch and display sample events without syncing
--config Path to config file
--show-env Show environment information and exit
# Run in dry run mode
./run.sh --dry-run
# Sync events for a specific date range
./run.sh --from 2025-05-20 --to 2025-05-27
# Show sample events without syncing
./run.sh --sample
# Debug mode
./run.sh --debugTo enable email notifications, add these secrets to your repository:
MAIL_SERVER: SMTP server addressMAIL_PORT: SMTP server portMAIL_USERNAME: SMTP usernameMAIL_PASSWORD: SMTP passwordNOTIFICATION_EMAIL: Recipient email address
Then uncomment the email notification section in your workflow file.
For Slack notifications, add the SLACK_WEBHOOK secret and uncomment the Slack notification section in your workflow file.
-
Authentication Errors:
- Verify your Google credentials JSON file is correct
- Check that the service account has proper permissions on the calendar
-
Pike13 API Errors:
- Verify your Pike13 client ID is correct
- Check internet connectivity
- Review the Pike13 API status
-
Calendar Not Updating:
- Check that the specified calendar ID is correct
- Verify the service account has write permissions
- Check for error messages in the logs
-
GitHub Actions Issues:
- Verify secrets are correctly set up
- Check workflow logs for errors
- Make sure Go version is compatible (1.20 or newer)
Test Google Calendar API connectivity:
go run tests/test_calendar.go --check-write- Go to the repository settings
- Delete the GitHub repository secrets
- Delete or disable the workflow files in
.github/workflows/
-
Remove the Pike13 events from Google Calendar:
- You can use the Google Calendar web interface to select and delete events
- All events created by Pike13Sync have a custom property
pike13_sync: true
-
Delete the application directory and all its contents.
Contributions to Pike13Sync are welcome! Please feel free to submit a Pull Request.