Giter VIP home page Giter VIP logo

docker-diaspora's Introduction

Diaspora*

pipeline status https://hub.docker.com/r/angristan/diaspora/ https://hub.docker.com/r/angristan/diaspora/ https://hub.docker.com/r/angristan/diaspora/ https://hub.docker.com/r/angristan/diaspora/

Diaspora Logo

Diaspora is a nonprofit, user-owned, distributed social network that is based upon the free Diaspora software. Diaspora consists of a group of independently owned nodes (called pods) which interoperate to form the network.

This image is automatically built by GitLab CI and pushed to the Docker Hub.

I won't update this image anymore. Feel free to open PRs or to fork the repo.

Features

Build-time variables

  • DIASPORA_VER: Diaspora version (0.7.9.0)
  • GID: group id (default: 942)
  • UID: user id (default: 942)

Volumes

  • /diaspora/public: location of the assets and user uploads

Usage

The image will not work as-is, it requires a command to start and other services.

Configuration files

Before doing anything, copy the database.yml.exemple to your current folder and add the correct values (which should be the postgres ENVIRONMENT viariables below).

Do the same with diaspora.yml.example and read it completely. Diaspora won't work with the defaults.

FYI you will need to modify these at least:

  • environment.url
  • environment.certificate_authorities: /etc/ssl/certs/ca-certificates.crt
  • environment.redis: redis://redis (if you follow the docker-compose below)
  • server.listen: 0.0.0.0:3000
  • server.rails_environment: production

Docker Compose

Here is an exemple docker-compose.yml:

version: '2.3'

services:
  postgres:
    container_name: diaspora_postgres
    image: postgres:9.6-alpine
    restart: always
    volumes:
      - ./postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=diaspora
      - POSTGRES_PASSWORD=diaspora
      - POSTGRES_DB=diaspora_production

  redis:
    container_name: diaspora_redis
    image: redis:4.0-alpine
    restart: always
    volumes:
      - ./redis:/data

  unicorn:
    container_name: diaspora_unicorn
    image: angristan/diaspora:0.7.9
    restart: always
    command: bin/bundle exec unicorn -c config/unicorn.rb -E production
    volumes:
      - ./data:/diaspora/public/
      - ./diaspora.yml:/diaspora/config/diaspora.yml
      - ./database.yml:/diaspora/config/database.yml
    depends_on:
      - postgres
      - redis

  sidekiq:
    container_name: diaspora_sidekiq
    image: angristan/diaspora:0.7.9
    restart: always
    command: bin/bundle exec sidekiq
    volumes:
      - ./data:/diaspora/public/
      - ./diaspora.yml:/diaspora/config/diaspora.yml
      - ./database.yml:/diaspora/config/database.yml
    depends_on:
      - postgres
      - redis

  nginx:
    container_name: diaspora_nginx
    image: nginx:stable
    restart: always
    volumes:
      - ./nginx-vhost.conf:/etc/nginx/conf.d/default.conf:ro
      - ./data:/var/www/html
    ports:
      - 127.0.0.1:80:80

We need a Nginx container to server the uploads and assets, as Unicorn doesn't do it.

Here is an example Nginx vhost:

server {
    listen 80;

    root /var/www/html;

    client_max_body_size 5M;
    client_body_buffer_size 256K;

    try_files $uri @diaspora;

    location /assets/ {
        expires max;
        add_header Cache-Control public;
    }

    location @diaspora {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://unicorn:3000;
    }
}

I assume you're using another container for HTTPS, but feel free to use this as a base if it's not the case.

Installation

When running the instance for the first time, run this command to setup the database:

docker-compose run --rm unicorn bin/rake db:create db:migrate

Then compile the assets:

docker-compose run --rm unicorn bin/rake assets:precompile

You can now lauch your pod!

docker-compose up -d

Update

Modify the versions in your docker-compose.yml, then pull the new images:

docker-compose pull

Update the database:

docker-compose run --rm unicorn bin/rake db:migrate

Then compile the assets:

docker-compose run --rm unicorn bin/rake assets:precompile

Recreate containers with new images:

docker-compose up -d

docker-diaspora's People

Contributors

angristan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.