Skip to content

Latest commit

 

History

History
243 lines (176 loc) · 9.98 KB

CONTRIBUTING.md

File metadata and controls

243 lines (176 loc) · 9.98 KB

Contributing to Hostly

"First, thanks for considering contributing to my project. It really means a lot!" - @andrasbacsai

You can ask for guidance anytime on our Discord server in the #contribute channel.

Table of Contents

  1. Setup Development Environment
  2. Verify Installation
  3. Fork and Setup Local Repository
  4. Set up Environment Variables
  5. Start Hostly
  6. Start Development
  7. Create a Pull Request
  8. Development Notes
  9. Resetting Development Environment
  10. Additional Contribution Guidelines

1. Setup Development Environment

Follow the steps below for your operating system:

Windows
  1. Install docker-ce, Docker Desktop (or similar):

    • Docker CE (recommended):
      • Install Windows Subsystem for Linux v2 (WSL2) by following this guide: Install WSL
      • After installing WSL2, install Docker CE for your Linux distribution by following this guide: Install Docker Engine
      • Make sure to choose the appropriate Linux distribution (e.g., Ubuntu) when following the Docker installation guide
    • Install Docker Desktop (easier):
  2. Install Spin:

MacOS
  1. Install Orbstack, Docker Desktop (or similar):

    • Orbstack (recommended, as it is a faster and lighter alternative to Docker Desktop):
    • Docker Desktop:
  2. Install Spin:

Linux
  1. Install Docker Engine, Docker Desktop (or similar):

  2. Install Spin:

2. Verify Installation (Optional)

After installing Docker (or Orbstack) and Spin, verify the installation:

  1. Open a terminal or command prompt
  2. Run the following commands:
    docker --version
    spin --version
    You should see version information for both Docker and Spin.

3. Fork and Setup Local Repository

  1. Fork the Hostly repository to your GitHub account.

  2. Install a code editor on your machine (choose one):

    Editor Platform Download Link
    Visual Studio Code (recommended free) Windows/macOS/Linux Download
    Cursor (recommended but paid) Windows/macOS/Linux Download
    Zed (very fast) macOS/Linux Download
  3. Clone the Hostly Repository from your fork to your local machine

    • Use git clone in the command line, or
    • Use GitHub Desktop (recommended):
      • Download and install from https://desktop.github.com/
      • Open GitHub Desktop and login with your GitHub account
      • Click on File -> Clone Repository select github.com as the repository location, then select your forked Hostly repository, choose the local path and then click Clone
  4. Open the cloned Hostly Repository in your chosen code editor.

4. Set up Environment Variables

  1. In the Code Editor, locate the .env.development.example file in the root directory of your local Hostly repository.
  2. Duplicate the .env.development.example file and rename the copy to .env.
  3. Open the new .env file and review its contents. Adjust any environment variables as needed for your development setup.
  4. If you encounter errors during database migrations, update the database connection settings in your .env file. Use the IP address or hostname of your PostgreSQL database container. You can find this information by running docker ps after executing spin up.
  5. Save the changes to your .env file.

5. Start Hostly

  1. Open a terminal in the local Hostly directory.
  2. Run the following command in the terminal (leave that terminal open):
    spin up

Note

You may see some errors, but don't worry; this is expected.

  1. If you encounter permission errors, especially on macOS, use:
    sudo spin up

Note

If you change environment variables afterwards or anything seems broken, press Ctrl + C to stop the process and run spin up again.

6. Start Development

  1. Access your Hostly instance:

    • URL: http://localhost:8000
    • Login: test@example.com
    • Password: password
  2. Additional development tools:

    Tool URL Note
    Laravel Horizon (scheduler) http://localhost:8000/horizon Only accessible when logged in as root user
    Mailpit (email catcher) http://localhost:8025
    Telescope (debugging tool) http://localhost:8000/telescope Disabled by default

Note

To enable Telescope, add the following to your .env file:

TELESCOPE_ENABLED=true

7. Create a Pull Request

  1. After making changes or adding a new service:

    • Commit your changes to your forked repository.
    • Push the changes to your GitHub account.
  2. Creating the Pull Request (PR):

    • Navigate to the main Hostly repository on GitHub.
    • Click the "Pull requests" tab.
    • Click the green "New pull request" button.
    • Choose your fork and branch as the compare branch.
    • Click "Create pull request".
  3. Filling out the PR details:

    • Give your PR a descriptive title.
    • Use the Pull Request Template provided and fill in the details.

Important

Always set the base branch for your PR to the next branch of the Hostly repository, not the main branch.

  1. Submit your PR:
    • Review your changes one last time.
    • Click "Create pull request" to submit.

Note

Make sure your PR is out of draft mode as soon as it's ready for review. PRs that are in draft mode for a long time may be closed by maintainers.

After submission, maintainers will review your PR and may request changes or provide feedback.

Development Notes

When working on Hostly, keep the following in mind:

  1. Database Migrations: After switching branches or making changes to the database structure, always run migrations:

    docker exec -it hostly php artisan migrate
  2. Resetting Development Setup: To reset your development setup to a clean database with default values:

    docker exec -it hostly php artisan migrate:fresh --seed
  3. Troubleshooting: If you encounter unexpected behavior, ensure your database is up-to-date with the latest migrations and if possible reset the development setup to eliminate any environment-specific issues.

Important

Forgetting to migrate the database can cause problems, so make it a habit to run migrations after pulling changes or switching branches.

Resetting Development Environment

If you encounter issues or break your database or something else, follow these steps to start from a clean slate (works since v4.0.0-beta.342):

  1. Stop all running containers ctrl + c.

  2. Remove all Hostly containers:

    docker rm hostly hostly-db hostly-redis hostly-realtime hostly-testing-host hostly-minio hostly-vite-1 hostly-mail
  3. Remove Hostly volumes (it is possible that the volumes have no hostly prefix on your machine, in that case remove the prefix from the command):

    docker volume rm hostly_dev_backups_data hostly_dev_postgres_data hostly_dev_redis_data hostly_dev_hostly_data hostly_dev_minio_data
  4. Remove unused images:

    docker image prune -a
  5. Start Hostly again:

    spin up
  6. Run database migrations and seeders:

    docker exec -it hostly php artisan migrate:fresh --seed

After completing these steps, you'll have a fresh development setup.

Important

Always run database migrations and seeders after switching branches or pulling updates to ensure your local database structure matches the current codebase and includes necessary seed data.

Additional Contribution Guidelines

Contributing a New Service

To add a new service to Hostly, please refer to our documentation: Adding a New Service

Contributing to Documentation

To contribute to the Hostly documentation, please refer to this guide: Contributing to the Hostly Documentation