Install Pixelfed with docker

Pixelfed_logo

1. Clone pixelfed’s repository and enter its directory:

git clone https://github.com/pixelfed/pixelfed && cd pixelfed

2. View the current tags with:

git tag

You’ll get and output similar to this:

        v0.1.9
        v0.10.0
        v0.10.1
        v0.10.10
        v0.10.2
        v0.10.3
        v0.10.4
        v0.10.5
        v0.10.6
        v0.10.7
        v0.10.8
        v0.10.9
        v0.11.0
        v0.11.1
        v0.11.2
        v0.5.9
        v0.6.0
        v0.6.1
        v0.7.6
        v0.8.0
        v0.8.5
        v0.8.6
        v0.9.0
        v0.9.4
        v0.9.5
        v0.9.6

3. Download latest version

Currently in my case, it’s v.0.11.2.
Download it by running:

git checkout tags/v0.11.2

4. You can confirm the version you are using with this command:

    $ git branch
    * (HEAD detached at v0.11.2)
      dev

5. Edit your .env.docker file

Change your domain name and if you are using the website just for yourself you probably will want to disable open registration also. So change:

APPURL=https://pixel.criadoperez.com
APPDOMAIN=“pixel.criadoperez.com”
ADMINDOMAIN=“pixel.criadoperez.com”
SESSIONDOMAIN=“pixel.criadoperez.com”
OPEN_REGISTRATION=false
      - MYSQL_DATABASE=pixelfed
      - MYSQL_USER=pixelfed
      - MYSQL_PASSWORD=pixelfed
      - MYSQL_RANDOM_ROOT_PASSWORD=true

6. Confirm your port is ok

The docker-compose.yml file is configured to use port 8080. If that’s ok for you you can leave it as it is. In my case as I have several other containers, this port is already in use so I need to change it to 8085. To do this change line 31 of file docker-compose.yml from “8080:80” to “8085:80”.

7. Start your docker-compose file:

The first time you run this is will take some time.

docker-compose up -d

8. Set up your key:

$ docker-compose exec app php artisan key:generate
Application key set successfully.

9. You can verify it worked by seeing if you have a value:

$ cat .env.docker | grep APP_KEY
APP_KEY=base64:**************************************

I put asterisks instead of my real key, you should instead see a random bunch of numbers and letters

10. Run the following docker-compose commands to get things properly configured:

$ docker-compose exec app php artisan horizon
      Horizon started successfully.

$ docker-compose exec app php artisan package:discover
      Discovered Package: beyondcode/laravel-self-diagnosis
      Discovered Package: buzz/laravel-h-captcha
      Discovered Package: facade/ignition
      Discovered Package: fideloper/proxy
      Discovered Package: fruitcake/laravel-cors
      Discovered Package: intervention/image
      Discovered Package: jenssegers/agent
      Discovered Package: laravel/horizon
      Discovered Package: laravel/passport
      Discovered Package: laravel/tinker
      Discovered Package: laravel/ui
      Discovered Package: nesbot/carbon
      Discovered Package: nunomaduro/collision
      Discovered Package: pbmedia/laravel-ffmpeg
      Discovered Package: pixelfed/laravel-snowflake
      Discovered Package: spatie/laravel-backup
      Discovered Package: spatie/laravel-image-optimizer
      Discovered Package: stevebauman/purify
      Package manifest generated successfully.

$ docker-compose exec app php artisan horizon:install
      Publishing Horizon Service Provider...
      Publishing Horizon Assets...
      Publishing Horizon Configuration...
      Horizon scaffolding installed successfully.

$ docker-compose exec app php artisan route:cache
      Route cache cleared!
      Routes cached successfully!

11. Restart your docker app:

$ docker-compose restart app
Restarting pixelfed_app_1 ... done

12. Enjoy!! (very important never to forget this part)

You should now be able to load the page using the configured domain name.
If you try to connect to it with an local address like http://127.0.0.1:8080 then you will see the pixelfed logo but a message saying Sorry, this page isn't available. Use your domain name instead.