Skip to content

Commit 47bf5bf

Browse files
committed
Add official Friendica image docs
1 parent 68188b3 commit 47bf5bf

File tree

6 files changed

+592
-0
lines changed

6 files changed

+592
-0
lines changed

friendica/README-short.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Welcome to the free social web.

friendica/content.md

Lines changed: 348 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,348 @@
1+
# What is Friendica?
2+
3+
Friendica is a decentralised communications platform that integrates social communication. Our platform links to independent social projects and corporate services.
4+
5+
![logo](https://cdn.rawgit.com/friendica/docker/9c954f4d/friendica.svg)
6+
7+
# How to use this image
8+
9+
The images are designed to be used in a micro-service environment. There are two types of the image you can choose from.
10+
11+
The `apache` tag contains a full Friendica installation including an apache web server. It is designed to be easy to use and gets you running pretty fast. This is also the default for the `latest` tag and version tags that are not further specified.
12+
13+
The second option is a `fpm` container. It is based on the [php-fpm](https://hub.docker.com/_/php/) image and runs a fastCGI-Process that serves your Friendica server. To use this image it must be combined with any Webserver that can proxy the http requests to the FastCGI-port of the container.
14+
15+
[![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/nupplaphil/friendica-docker/fec33c98be957436279b7074ca08068b18622627/stack.yml) (Admin-E-Mail: `root@friendica.local`)
16+
17+
## Using the apache image
18+
19+
You need at least one other mariadb/mysql-container to link it to Friendica.
20+
21+
The apache image contains a webserver and exposes port 80. To start the container type:
22+
23+
```console
24+
$ docker run -d -p 8080:80 --link some-mysql:mysql friendica/server
25+
```
26+
27+
Now you can access the Friendica installation wizard at http://localhost:8080/ from your host system.
28+
29+
## Using the fpm image
30+
31+
To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container. For fpm connection this container exposes port 9000. In most cases you might want use another container or your host as proxy. If you use your host you can address your Friendica container directly on port 9000. If you use another container, make sure that you add them to the same docker network (via `docker run --network <NAME> ...` or a `docker-compose` file). In both cases you don't want to map the fpm port to you host.
32+
33+
```console
34+
$ docker run -d friendica/server:fpm
35+
```
36+
37+
As the fastCGI-Process is not capable of serving static files (style sheets, images, ...) the webserver needs access to these files. This can be achieved with the `volumes-from` option. You can find more information in the docker-compose section.
38+
39+
## Using the cron job
40+
41+
There are three options to enable the cron-job for Friendica:
42+
43+
- Using the default Image and activate the cron-job (see [Installation](https://friendi.ca/resources/installation/), sector `Activating scheduled tasks`)
44+
- Using the default image (apache, fpm, fpm-alpine) and creating **two** container (one for cron and one for the main app)
45+
- Using one of the additional, prepared [`cron dockerfiles`](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/cron)
46+
47+
## Possible Environment Variables
48+
49+
**Friendica Settings**
50+
51+
- `FRIENDICA_ADMIN_MAIL` E-Mail address of the administrator.
52+
- `FRIENDICA_TZ` The default localization of the Friendica server.
53+
- `FRIENDICA_LANG` The default language of the Friendica server.
54+
- `FRIENDICA_PHP_PATH` The path of the PHP binary.
55+
- `FRIENDICA_SITENAME` The Sitename of the Friendica server.
56+
- `FRIENDICA_NO_VALIDATION` If set to `true`, the URL and E-Mail validation will be disabled.
57+
- `FRIENDICA_DATA` If set to `true`, the fileystem will be used instead of the DB backend.
58+
- `FRIENDICA_DATA_DIR` The data directory of the Friendica server (Default: /var/www/data).
59+
60+
**Friendica Logging**
61+
62+
- `FRIENDICA_DEBUGGING` If set to `true`, the logging of Friendica is enabled.
63+
- `FRIENDICA_LOGFILE` (optional) The path to the logfile (Default: /var/www/friendica.log).
64+
- `FRIENDICA_LOGLEVEL` (optional) The loglevel to log (Default: notice).
65+
66+
**Database** (**required at installation**)
67+
68+
- `MYSQL_USERNAME` Username for the database user using mysql.
69+
- `MYSQL_USER` Username for the database user using mariadb.
70+
- `MYSQL_PASSWORD` Password for the database user using mysql / mariadb.
71+
- `MYSQL_DATABASE` Name of the database using mysql / mariadb.
72+
- `MYSQL_HOST` Hostname of the database server using mysql / mariadb.
73+
- `MYSQL_PORT` Port of the database server using mysql / mariadb (Default: `3306`)
74+
75+
**Lock Driver (Redis)**
76+
77+
- `REDIS_HOST` The hostname of the redis instance (in case of locking).
78+
- `REDIS_PORT` (optional) The port of the redis instance (in case of locking).
79+
- `REDIS_PW` (optional) The password for the redis instance (in case of locking).
80+
- `REDIS_DB` (optional) The database instance of the redis instance (in case of locking).
81+
82+
**Develop/Release Candidat Settings**
83+
84+
- `FRIENDICA_UPGRADE` If set to `true`, a develop or release candidat node will get updated at startup.
85+
- `FRIENDICA_REPOSITORY` If set, a custom repository will be chosen (Default: `friendica`)
86+
- `FRIENDICA_ADDONS_REPO` If set, a custom repository for the addons will be chosen (Default: `friendica`)
87+
- `FRIENDICA_VERSION` If set, a custom branch will be chosen (Default is based on the chosen image version)
88+
- `FRIENDICA_ADDONS` If set, a custom branch for the addons will be chosen (Default is based on the chosen image version)
89+
90+
## Administrator account
91+
92+
Because Friendica links the administrator account to a specific mail address, you **have** to set a valid address for `MAILNAME`.
93+
94+
## Mail settings
95+
96+
The binary `ssmtp` is used for the `mail()` support of Friendica.
97+
98+
You have to set the `--hostname/-h` parameter correctly to use the right domainname for the `mail()` command.
99+
100+
You have to set a valid SMTP-MTA for the `SMTP` environment variable to enable mail support in Friendica. A valid SMTP-MTA would be, for example, `mx.example.org`.
101+
102+
The following environment variables are possible for the SMTP examples.
103+
104+
- `SITENAME` The name of the Friendica node. (**required**)
105+
- `SMTP` Address of the SMTP Mail-Gateway. (**required**)
106+
- `SMTP_FROM` Sender user-part of the address. (Default: `no-reply` - e.g. no-reply@friendica.local)
107+
- `SMTP_TLS` Use TLS for connecting the SMTP Mail-Gateway. (Default: empty)
108+
- `SMTP_STARTTLS` Use STARTTLS for connecting the SMTP Mail-Gateway. (Default: empty)
109+
- `SMTP_AUTH_USER` Username for the SMTP Mail-Gateway. (Default: empty)
110+
- `SMTP_AUTH_PASS` Password for the SMTP Mail-Gateway. (Default: empty)
111+
- `SMTP_AUTH_METHOD` Authentication method for the SMTP Mail-Gateway. (Default: empty/plain text)
112+
113+
## Database settings
114+
115+
You have to link a running database container, e. g. `--link my-mysql:mysql`, and then use `mysql` as the database host on setup.
116+
117+
## Persistent data
118+
119+
The Friendica installation and all data beyond what lives in the database (file uploads, etc) is stored in the [unnamed docker volume](https://docs.docker.com/engine/tutorials/dockervolumes/#adding-a-data-volume) volume `/var/www/html`. The docker daemon will store that data within the docker directory `/var/lib/docker/volumes/...`. That means your data is saved even if the container crashes, is stopped or deleted.
120+
121+
To make your data persistent to upgrading and get access for backups is using named docker volume or mount a host folder. To achieve this you need one volume for your database container and Friendica.
122+
123+
Friendica:
124+
125+
- `/var/www/html/` folder where all Friendica data lives
126+
127+
```console
128+
$ docker run -d \
129+
-v friendica-vol-1:/var/www/html \
130+
friendica/server
131+
```
132+
133+
Database:
134+
135+
- `/var/lib/mysql` MySQL / MariaDB Data
136+
137+
```console
138+
$ docker run -d \
139+
-v mysql-vol-1:/var/lib/mysql \
140+
mariadb
141+
```
142+
143+
## Automatic installation
144+
145+
The Friendica image supports auto configuration via environment variables. You can preconfigure everything that is asked on the install page on first run. To enable the automatic installation, there are two possibilities:
146+
147+
### Environment Variables
148+
149+
You have to set at least the following environment variables (others are optional).
150+
151+
- `FRIENDICA_ADMIN_MAIL` E-Mail address of the administrator.
152+
- `MYSQL_USERNAME` or `MYSQL_USER` Username for the database user using mysql/mariadb.
153+
- `MYSQL_PASSWORD` Password for the database user using mysql / mariadb.
154+
- `MYSQL_DATABASE` Name of the database using mysql / mariadb.
155+
- `MYSQL_HOST` Hostname of the database server using mysql / mariadb.
156+
157+
### Using a predefined config file
158+
159+
You can create a `local.config.php` and `COPY` it to `/usr/src/config`. If no other environment variable is set, this `local.config.php` will get copied to the config path.
160+
161+
# Docker Secrets
162+
163+
More information can be found here https://docs.docker.com/engine/swarm/secrets/.
164+
165+
As an alternative to passing sensitive information via environment variables, _FILE may be appended to the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/<secret_name> files. For example:
166+
167+
```yaml
168+
version: '3.2'
169+
services:
170+
db:
171+
image: mariadb
172+
restart: always
173+
volumes:
174+
- db:/var/lib/mysql/
175+
environment:
176+
- MYSQL_DATABASE=friendica
177+
- MYSQL_USERNAME=friendica
178+
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
179+
- MYSQL_RANDOM_ROOT_PASSWORD=yes
180+
secrets:
181+
- mysql_password
182+
app:
183+
image: friendica
184+
restart: always
185+
ports:
186+
- 8080:80
187+
volumes:
188+
- friendica:/var/www/html
189+
environment:
190+
- MYSQL_HOST=db
191+
- MYSQL_USER=friendica
192+
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
193+
- MYSQL_DATABASE=friendica
194+
- FRIENDICA_ADMIN_MAIL=root@friendica.local
195+
- SITENAME=Friendica PWD Test Node
196+
- FRIENDICA_NO_VALIDATION=true
197+
hostname: friendica.local
198+
depends_on:
199+
- db
200+
secrets:
201+
- mysql_password
202+
volumes:
203+
db:
204+
friendica:
205+
206+
secrets:
207+
mysql_password:
208+
file: ./mysql_password.txt # put mysql password to this file using docker-secrets to manage it
209+
```
210+
211+
Currently, this is only supported for `MYSQL_PASSWORD`.
212+
213+
# Maintenance of the image
214+
215+
## Updating to a newer version
216+
217+
There are differences between the develop (everything which ends with `-rc` or `-dev`) and the stable (the rest) branches.
218+
219+
### Updating stable
220+
221+
You have to pull the latest image from the hub (`docker pull friendica`). The stable branch gets checked at every startup and will get updated if no installation was found or a new image is used.
222+
223+
### Updating develop
224+
225+
You don't need to pull the image for each commit in [friendica](https://github.com/friendica/friendica/). Instead, the develop branch will get updated if no installation was found or the environment variable `FRIENDICA_UPGRADE` is set to `true`.
226+
227+
It will clone the latest Friendica version and copy it to your working directory.
228+
229+
# Running this image with docker-compose
230+
231+
The easiest way to get a fully featured and functional setup is using a `docker-compose` file. There are too many different possibilities to setup your system, so here are only some examples what you have to look for.
232+
233+
At first make sure you have chosen the right base image (fpm or apache) and added the features you wanted (see below). In every case you want to add a database container and docker volumes to get easy access to your persistent data. When you want your server reachable from the internet adding HTTPS-encryption is mandatory! See below for more information.
234+
235+
## Base version - apache
236+
237+
This version will use the apache image and add a mariaDB container. The volumes are set to keep your data persistent. This setup provides **no ssl encryption** and is intended to run behind a proxy.
238+
239+
Make sure to set the variable `MYSQL_PASSWORD` before run this setup.
240+
241+
```yaml
242+
version: '2'
243+
244+
services:
245+
db:
246+
image: mariadb
247+
restart: always
248+
volumes:
249+
- db:/var/lib/mysql
250+
environment:
251+
- MYSQL_USER=friendica
252+
- MYSQL_PASSWORD=
253+
- MYSQL_DATABASE=friendica
254+
- MYSQL_RANDOM_ROOT_PASSWORD=yes
255+
256+
app:
257+
image: friendica/server
258+
restart: always
259+
volumes:
260+
- friendica:/var/www/html
261+
ports:
262+
- "8080:80"
263+
environment:
264+
- MYSQL_HOST=db
265+
- MYSQL_USER=friendica
266+
- MYSQL_PASSWORD=
267+
- MYSQL_DATABASE=friendica
268+
- FRIENDICA_ADMIN_MAIL=root@friendica.local
269+
hostname: friendica.local
270+
depends_on:
271+
- db
272+
273+
volumes:
274+
db:
275+
friendica:
276+
```
277+
278+
Then run `docker-compose up -d`, now you can access Friendica at http://localhost:8080/ from your system.
279+
280+
## Base version - FPM
281+
282+
When using the FPM image you need another container that acts as web server on port 80 and proxies requests to the Friendica container. In this example a simple nginx container is combined with the Friendica-fpm image and a MariaDB database container. The data is stored in docker volumes. The nginx container also need access to static files from your Friendica installation. It gets access to all the volumes mounted to Friendica via the `volumes_from` option. The configuration for nginx is stored in the configuration file `nginx.conf` that is mounted into the container.
283+
284+
An example can be found in the [examples section](https://github.com/friendica/docker/tree/master/.examples).
285+
286+
As this setup does **not include encryption** it should to be run behind a proxy.
287+
288+
Prerequisites for this example:
289+
290+
- Make sure to set the variable `MYSQL_PASSWORD` before you run the setup.
291+
- Create a `nginx.conf` in the same directory as the docker-compose.yml file (take it from [example](https://github.com/friendica/docker/tree/master/.examples/docker-compose/with-traefik-proxy/mariadb-cron-smtp/fpm/web/nginx.conf))
292+
293+
```yaml
294+
version: '2'
295+
296+
services:
297+
db:
298+
image: mariadb
299+
restart: always
300+
volumes:
301+
- db:/var/lib/mysql
302+
environment:
303+
- MYSQL_USER=friendica
304+
- MYSQL_PASSWORD=
305+
- MYSQL_DATABASE=friendica
306+
- MYSQL_RANDOM_ROOT_PASSWORD=yes
307+
308+
app:
309+
image: friendica/server:fpm
310+
restart: always
311+
volumes:
312+
- friendica:/var/www/html
313+
environment:
314+
- MYSQL_HOST=db
315+
- MYSQL_USER=friendica
316+
- MYSQL_PASSWORD=
317+
- MYSQL_DATABASE=friendica
318+
- FRIENDICA_ADMIN_MAIL=root@friendica.local
319+
hostname: friendica.local
320+
networks:
321+
- proxy-tier
322+
- default
323+
324+
web:
325+
image: nginx
326+
ports:
327+
- 8080:80
328+
links:
329+
- app
330+
volumes:
331+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
332+
restart: always
333+
networks:
334+
- proxy-tier
335+
336+
volumes:
337+
db:
338+
friendica:
339+
340+
networks:
341+
proxy-tier:
342+
```
343+
344+
Then run `docker-compose up -d`, now you can access Friendica at http://localhost:8080/ from your system.
345+
346+
# Questions / Issues
347+
348+
If you got any questions or problems using the image, please visit our [Github Repository](https://github.com/friendica/docker) and write an issue.

friendica/github-repo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/friendica/docker

friendica/license.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
View [license information](https://github.com/friendica/server/blob/master/LICENSE) for the software contained in this image.

0 commit comments

Comments
 (0)