English
Get started

← All templates · Social and community

Deploy Pixelfed in one click

Photo sharing without ads or algorithms, an Instagram alternative that federates with Mastodon

A self-hosted alternative to Instagram.

What is Pixelfed?

Pixelfed is an open-source photo sharing platform, a decentralized alternative to Instagram. You post a single photo or an album, apply filters, write captions and reply in threaded comments. Collections gather posts into groups, a portfolio page shows your best work, and a post can be public, unlisted or for followers only. Pixelfed speaks ActivityPub, so you can follow and comment on people from Mastodon and other Pixelfed servers without a second account.

People self-host it to keep their photos and their community on a server they run. The admin sets the rules: whether sign-ups are open, the largest upload, how many fit in an album (four by default). One catch comes with federation: other servers know your accounts by your server's address, so choose the domain before you invite anyone.

Hosting Pixelfed on Pethost

  1. You sign in to Pethost with a passkey, GitHub or Google. No machine yet? You pick a plan, and the link waits until it is ready.
  2. New project opens at Pixelfed. You fill in what it asks for and click Create project: Username, Email, Admin password.
  3. In a minute or two Pixelfed is live at its own address with HTTPS. Its secrets are made at random, and its data is in the nightly backup.
  4. It is a project like any other: you or your agent can change it, roll it back or restore it.

Questions about Pixelfed

Is Pixelfed free and open source?

Yes. Pixelfed is free software under the GNU AGPL v3, and its code is on GitHub. Sponsors support its development through Patreon, Open Collective and Liberapay.

What is the difference between Pixelfed and Instagram?

Pixelfed has no ads, and its feeds are chronological, with no algorithm limiting who sees a post. It is not one company's site: many independent servers run it, and their accounts follow each other.

Can I import my Instagram photos into Pixelfed?

Yes. Download your information from Instagram's Accounts Center in JSON format, then follow the steps on the Import page of Pixelfed's settings. Photos, videos, captions and hashtags come across, up to 1,000 posts per account by default.

Is there a Pixelfed app for iPhone and Android?

Yes. Pixelfed has official apps for iOS and Android, and its site lists third-party clients such as Pixelix, Pixeldroid and Impressia. The web version also works in a phone's browser.

How do I add users to my Pixelfed server?

This template starts with sign-ups closed and you as the only admin. Open them in the admin dashboard's settings, or create invite links there for the people you choose.

How much memory and disk does Pixelfed need?

Pixelfed is moderate: about 1.5 GB across web, queue and database, and your photos and cached ones grow the disk. On Pethost the Grow plan is enough for it, with room for other apps beside it.

Pixelfed Docker Compose file

The template is this compose.yaml and the variables written into the project’s .env as it is created. Pethost runs the file as it is written.

Containers: pixelfed (ghcr.io/pixelfed/pixelfed:v0.14.4), horizon (ghcr.io/pixelfed/pixelfed:v0.14.4), scheduler (ghcr.io/pixelfed/pixelfed:v0.14.4), db (mariadb:11.8), redis (redis:8-alpine).

Volumes, in the nightly backup: storage, db, redis.

# 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:

More in Social and community