---
title: "Faça o deploy de Pixelfed no Pethost com um clique"
description: "Compartilhamento de fotos sem anúncios nem algoritmos, uma alternativa ao Instagram que federa com o Mastodon. Um template para o Pethost: em um ou dois minutos o app está no ar na sua máquina, com HTTPS no próprio endereço e backups noturnos."
---

[← Todos os templates](https://pethost.dev/pt/templates/)

# Faça o deploy de Pixelfed no Pethost com um clique

Compartilhamento de fotos sem anúncios nem algoritmos, uma alternativa ao Instagram que federa com o Mastodon

[Fazer deploy no Pethost](https://console.pethost.dev/?template=pixelfed)

## O que acontece

1. Você entra no Pethost ou cria uma conta, com uma passkey, GitHub ou Google.
2. Ainda não tem máquina? Você escolhe um plano, e nós preparamos uma para você. O link espera no seu navegador até ela ficar pronta.
3. Novo projeto abre no app. Você preenche o que ele pede e clica em Criar projeto: **Usuário**, **E-mail**, **Senha do administrador**.
4. Em um ou dois minutos o app está no ar no próprio endereço com HTTPS. Os segredos dele são gerados ao acaso, e os dados vão para o backup noturno.
5. É um projeto como qualquer outro: o compose.yaml, o .env, os logs e um terminal ficam no painel, e seu agente pode alterá-lo, fazer rollback ou restaurá-lo.

## Primeiros passos

Entre com o e-mail e a senha de administrador que você informou. Os cadastros estão fechados: abra-os no painel de administração ou crie as contas lá. O endereço não pode mudar depois, pois os outros servidores conhecem as contas por ele.

## O que roda

O template é este compose.yaml e as variáveis que ele grava no .env do projeto. O Pethost roda o arquivo exatamente como está escrito.

```
# What the app, its queue worker and its scheduler all read.
x-pixelfed: &pixelfed
  image: ghcr.io/pixelfed/pixelfed:v0.14.4
  restart: unless-stopped
  environment: &env
    APP_NAME: Pixelfed
    APP_ENV: production
    APP_DEBUG: "false"
    APP_KEY: ${APP_KEY}
    APP_URL: ${URL}
    APP_DOMAIN: ${HOST}
    ADMIN_DOMAIN: ${HOST}
    TRUST_PROXIES: "*"
    # Accounts are made by the admin; ENFORCE_EMAIL_VERIFICATION would need mail.
    OPEN_REGISTRATION: "false"
    ENFORCE_EMAIL_VERIFICATION: "false"
    OAUTH_ENABLED: "true"
    IMAGE_DRIVER: vips
    ACTIVITY_PUB: "true"
    AP_REMOTE_FOLLOW: "true"
    AP_INBOX: "true"
    AP_OUTBOX: "true"
    AP_SHAREDINBOX: "true"
    DB_CONNECTION: mysql
    DB_HOST: db
    DB_PORT: 3306
    DB_DATABASE: pixelfed
    DB_USERNAME: pixelfed
    DB_PASSWORD: ${DB_PASSWORD}
    REDIS_CLIENT: phpredis
    REDIS_HOST: redis
    REDIS_PASSWORD: "null"
    REDIS_PORT: 6379
    SESSION_DRIVER: database
    CACHE_STORE: redis
    QUEUE_DRIVER: redis
    BROADCAST_DRIVER: log
    MAIL_MAILER: log
    PHP_POST_MAX_SIZE: 100M
    PHP_UPLOAD_MAX_FILE_SIZE: 100M
    PHP_OPCACHE_ENABLE: "1"
    AUTORUN_ENABLED: "false"
    AUTORUN_LARAVEL_STORAGE_LINK: "true"
    AUTORUN_LARAVEL_CONFIG_CACHE: "true"
  # Media, the OAuth keys and the logs, shared by the three.
  volumes:
    - storage:/var/www/html/storage
  depends_on:
    db:
      condition: service_healthy
    redis:
      condition: service_healthy

services:
  pixelfed:
    <<: *pixelfed
    environment:
      <<: *env
      AUTORUN_ENABLED: "true"
      AUTORUN_LARAVEL_MIGRATION: "true"
      AUTORUN_LARAVEL_MIGRATION_ISOLATION: "true"
      AUTORUN_LARAVEL_EVENT_CACHE: "true"
      AUTORUN_LARAVEL_ROUTE_CACHE: "true"
      AUTORUN_LARAVEL_VIEW_CACHE: "true"
      ADMIN_USERNAME: ${ADMIN_USERNAME}
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
    # After the migrations: the OAuth keys and the instance's actor once, and the admin
    # from the fields while the instance has none.
    command:
      - sh
      - -c
      - |
        [ -f storage/oauth-private.key ] || php artisan passport:keys
        php artisan instance:actor
        php -r '
          require "vendor/autoload.php";
          $$app = require "bootstrap/app.php";
          $$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
          exit(App\Models\User::where("is_admin", true)->exists() ? 1 : 0);
        ' && php artisan user:create --name="$$ADMIN_USERNAME" --username="$$ADMIN_USERNAME" \
          --email="$$ADMIN_EMAIL" --password="$$ADMIN_PASSWORD" --is_admin=true --confirm_email=1
        exec frankenphp run --config /etc/frankenphp/Caddyfile --adapter caddyfile

  horizon:
    <<: *pixelfed
    environment:
      <<: *env
      # One worker per supervisor for all its queues, not one per queue: a quarter of the memory.
      HORIZON_BALANCE_STRATEGY: "false"
    command: [php, artisan, horizon]
    # The image's own healthcheck asks the web server, which runs in pixelfed only.
    healthcheck:
      test: [CMD, php, artisan, horizon:status]
      interval: 10s
      timeout: 5s
      retries: 3

  scheduler:
    <<: *pixelfed
    command: [php, artisan, schedule:work]
    stop_signal: SIGTERM
    healthcheck:
      test: [CMD, healthcheck-schedule]
      start_period: 10s

  db:
    image: mariadb:11.8
    restart: unless-stopped
    environment:
      MARIADB_DATABASE: pixelfed
      MARIADB_USER: pixelfed
      MARIADB_PASSWORD: ${DB_PASSWORD}
      MARIADB_RANDOM_ROOT_PASSWORD: "1"
    volumes:
      - db:/var/lib/mysql
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
      interval: 5s
      timeout: 5s
      retries: 30

  redis:
    image: redis:8-alpine
    restart: unless-stopped
    command: [redis-server, --appendonly, "yes"]
    volumes:
      - redis:/data
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 20

volumes:
  storage:
  db:
  redis:
```

[compose.yaml](https://pethost.dev/templates/pixelfed/compose.yaml)[Ver no GitHub](https://github.com/pethost-dev/templates/tree/main/pixelfed)

Pethost · Stephan Gomer · NIP 1133096755

[Templates](https://pethost.dev/pt/templates/) [Sobre nós](https://pethost.dev/about/) [Blog](https://pethost.dev/blog/) [Termos](https://pethost.dev/terms/) [Privacidade](https://pethost.dev/privacy/) [Reembolsos](https://pethost.dev/refunds/) [API](https://pethost.dev/docs/api/) [CLI](https://pethost.dev/docs/cli/) [Plugin](https://github.com/pethost-dev/plugin) [support@pethost.dev](mailto:support@pethost.dev)
