Home

Awesome

<div style="text-align:center"><img width="100" src ="/screenshots/logo.png"/></div>

Ownphotos

What is it?

Currently the project is in very early stages, so run it only for the sake of checking it out.

Features

- Currently implemented:

- Upcoming

What does it use?

How do I run it?

Docker

Ownphotos comes with separate backend and frontend servers. The backend serves the restful API, and the frontend serves, well, the frontend. The easiest way to do it is using Docker.

Let's say you want the backend server to be reachable by ownphotos-api.example.com and the frontend by ownphotos.example.com from outside. On your browser, you will want to connect to the frontend, so ownphotos.example.com will be the one you will point your browser to.

First, run cache (redis) and database (postgresql) containers. Please be mindful of the POSTGRES_PASSWORD environment variable being passed into the db container and change it.

docker run \ 
    --restart always \
    --name ownphotos-db \
    -e POSTGRES_PASSWORD=CHANGE_ME_DB_PASS \
    -e POSTGRES_DB=ownphotos \
    -d postgres

docker run \
    --restart always \
    --name ownphotos-redis \
    -d redis

Now we can run the ownphotos container image. There are several options you need to specify.

docker run \
    -v /where/your/photos/live/on/host:/data \
    -v /place/to/store/thumbnails/and/faces/and/fullsize/copy/on/host:/code/media \
    --link ownphotos-db:ownphotos-db \
    --link ownphotos-redis:ownphotos-redis \
    -e SECRET_KEY=CHANGE_ME \
    -e ADMIN_EMAIL=CHANGE_ME \
    -e ADMIN_USERNAME=CHANGE_ME \
    -e ADMIN_PASSWORD=CHANGE_ME \
    -e DEBUG=false \
    -e DB_BACKEND=postgresql \
    -e DB_NAME=ownphotos \
    -e DB_USER=postgres \
    -e DB_PASS=CHANGE_ME_DB_PASS \
    -e DB_HOST=ownphotos-db \
    -e DB_PORT=5432 \
    -e REDIS_HOST=ownphotos-redis \
    -e REDIS_PORT=6379 \
    -e MAPBOX_API_KEY=CHANGE_ME \
    -e BACKEND_HOST=CHANGE_ME \
    -p 8000:80 \
    -p 8001:3000 \
    --name ownphotos \
    nhooram/ownphotos:0.1

Wait a bit until everything warms up (migrations, and buildling frontend).

Next, you need to configure the webserver on your host machine for proxy. If you're using nginx,

Add the following to your nginx configurations. Make sure to change the server_name parameters for both the backend and frontend to suit your needs! If you want to use https, you probably know what you need to do. If you do though, make sure http requests get redirected to https. It's important!

server {
    # the port your site will be served on
    listen      80;
    server_name ownphotos-api.example.com;
    charset     utf-8;

    #Max upload size
    client_max_body_size 75M;   # adjust to taste

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}


server {
    # the port your site will be served on
    listen      80;
    server_name ownphotos.example.com;
    charset     utf-8;

    #Max upload size
    client_max_body_size 75M;   # adjust to taste

    location / {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Restart nginx

sudo service nginx restart

Point your browser to the frontend domain name!