README.md 6.29 KB
Newer Older
mbajur's avatar
fiox  
mbajur committed
1
# ▵ Prismo  [![pipeline status](https://gitlab.com/mbajur/prismo/badges/master/pipeline.svg)](https://gitlab.com/mbajur/prismo/commits/master) [![coverage report](https://gitlab.com/mbajur/prismo/badges/master/coverage.svg)](https://gitlab.com/mbajur/prismo/commits/master)
Michal Bajur's avatar
Michal Bajur committed
2

mbajur's avatar
mbajur committed
3
Federated link aggregation powered by ActivityPub.
Michal Bajur's avatar
Michal Bajur committed
4

Tim Stahel's avatar
Tim Stahel committed
5
![Screenshot](screenshot.png)
mbajur's avatar
mbajur committed
6

mbajur's avatar
mbajur committed
7
***
Michal Bajur's avatar
Michal Bajur committed
8

mbajur's avatar
mbajur committed
9 10
# Important notice 🚨🚨🚨

11
**Prismo is not yet production ready so please don't try to host an instance yet!
mbajur's avatar
mbajur committed
12
I will not be able to provide you any support when 1.0.0 is out as the changes
mbajur's avatar
mbajur committed
13 14 15 16
will not be backward-compatible.**

***

io_mihai's avatar
io_mihai committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
## Table Of Contents

<!-- MarkdownTOC -->

- [Getting started](#getting-started)
    - [Prerequisites](#prerequisites)
    - [Installing](#installing)
        - [Setup / first run](#setup--first-run)
        - [Development](#development)
- [Running the tests](#running-the-tests)
- [Deployment](#deployment)
    - [Prerequisites](#prerequisites-1)
    - [Setting up](#setting-up)
    - [Getting the Prismo image](#getting-the-prismo-image)
        - [Using a prebuilt image](#using-a-prebuilt-image)
        - [Building your own image](#building-your-own-image)
    - [Building the app](#building-the-app)
- [Versioning](#versioning)
- [Thanks](#thanks)
- [License](#license)

<!-- /MarkdownTOC -->


mbajur's avatar
mbajur committed
41
## Getting started
Michal Bajur's avatar
Michal Bajur committed
42

mbajur's avatar
mbajur committed
43
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Michal Bajur's avatar
Michal Bajur committed
44

mbajur's avatar
mbajur committed
45
### Prerequisites
Michal Bajur's avatar
Michal Bajur committed
46

mbajur's avatar
mbajur committed
47 48 49 50
- ruby 2.5.1
- node.js 10.6.0
- yarn 1.7.0
- postgresql 10
Michal Bajur's avatar
Michal Bajur committed
51

mbajur's avatar
mbajur committed
52
### Installing
Michal Bajur's avatar
Michal Bajur committed
53

54
A step by step series of examples that help you get a development env running.
Michal Bajur's avatar
Michal Bajur committed
55

mbajur's avatar
mbajur committed
56
#### Setup / first run
Michal Bajur's avatar
Michal Bajur committed
57

58
If this is the first time that you are installing the app, start with installing dependencies:
mbajur's avatar
mbajur committed
59 60 61 62 63 64 65 66 67 68

    $ bundle install
    $ yarn install

Setup database

    $ bundle exec rails db:setup

#### Development

69
If the app has been set up already and you want to continue working on it:
mbajur's avatar
mbajur committed
70 71 72 73 74 75

    $ bundle exec rails db:migrate
    $ foreman start

## Running the tests

76 77 78 79 80 81
Make sure [geckodriver](https://github.com/mozilla/geckodriver) is installed or the browser specs will fail.

If you have a mac with homebrew, you can do this by running:

    $ brew install geckodriver

mbajur's avatar
mbajur committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
Running unit specs:

    $ bundle exec rspec

## Deployment

### Prerequisites

- Working basic (Linux) server with Nginx (or Apache2; not officially supported).
- Recent stable version of Docker.
- Recent stable version of Docker-compose.

### Setting up

Clone Prismo repository

    git clone https://gitlab.com/mbajur/prismo.git
    cd prismo

Review the settings in `docker-compose.yml`. Note that it is *not default* to store the postgresql database and redis databases in a persistent storage location. If you plan on running your instance in production, you must uncomment the volumes directive in `docker-compose.yml`.

mbajur's avatar
mbajur committed
103
### Getting the Prismo image
mbajur's avatar
mbajur committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131

#### Using a prebuilt image

If you're not making any local code changes or customizations on your instance, you can use a prebuilt Docker image to avoid the time and resource consumption of a build. Images are available from gitlab registry: https://gitlab.com/mbajur/prismo/container_registry

To use the prebuilt images:

1. Open `docker-compose.yml`
    1. Comment out the `build: .` lines for all images (web, sidekiq).
    2. Edit the `image: registry.gitlab.com/mbajur/prismo` lines for all images to include the release you want. The default is `latest` which is the most recent stable version, however it is recommended to explicitly pin a version: If you wanted to use v2.2.0 for example, you would edit the lines to say: `image: registry.gitlab.com/mbajur/prismo:v2.2.0`
   3. Save the file and exit the text editor.
2. Run `cp .env.production.sample .env.production` to bootstrap the configuration. You will need to edit this file later.
3. Run `docker-compose build`. It will now pull the correct image from Docker Hub.
4. Set correct file-owner with `chown -R 991:991 public`

#### Building your own image

You must build your own image if you've made any code modifications. To build your own image:

1. Open `docker-compose.yml` in your favorite text editor.
    1. Uncomment the `build: .` lines for all images (web, sidekiq) if needed.
    2. Save the file and exit the text editor.
2. Run `cp .env.production.sample .env.production` to bootstrap the configuration. You will need to edit this file later.
3. Run `docker-compose build`.
4. Set correct file-owner with `chown -R 991:991 public`

### Building the app

mbajur's avatar
mbajur committed
132 133
Open `.env.production` file and edit the configs. Next, run the following commands:

mbajur's avatar
mbajur committed
134 135 136 137
    docker-compose run --rm web bundle exec rails db:create
    docker-compose run --rm web bundle exec rails db:migrate
    docker-compose run --rm web bundle exec rails webpacker:compile

mbajur's avatar
mbajur committed
138
These commands will setup the database schema and precompile assets. Now is the time to setup Prismo base database records:
139

mbajur's avatar
mbajur committed
140
    docker-compose run --rm web bundle exec rake prismo:setup
141 142

After it's done, you can launch Prismo with:
mbajur's avatar
mbajur committed
143 144 145 146 147 148 149 150

    docker-compose up -d

Following that, you have a Prismo instance running on 127.0.0.1:3000. **It's highly recommended to serve it using a http proxy like nginx or apache.**

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.com/mbajur/prismo/tags).
Michal Bajur's avatar
Michal Bajur committed
151

mbajur's avatar
mbajur committed
152 153 154 155 156 157
## Thanks

Prismo Team is extremely grateful to all the contributors and donors from Patreon and LiberaPay. Apart from that, it's fair to mention that
huge amount of Prismo code base is heavily based on Mastodon code and it would be impossible to implement this project without Mastodon source guidance. 

Thank you ❤️
TrashMacNugget's avatar
TrashMacNugget committed
158 159 160

## License

mbajur's avatar
mbajur committed
161
Prismo
162
Copyright (C) 2019 mbajur
TrashMacNugget's avatar
TrashMacNugget committed
163 164 165 166 167 168 169 170 171 172 173 174

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
mbajur's avatar
mbajur committed
175
along with this program.  If not, see <http://www.gnu.org/licenses/>.