mirror of
https://github.com/friendica/docker
synced 2025-01-19 17:37:00 +01:00
Merge pull request #1 from nupplaphil/repo-init
Docker Repository initialization
This commit is contained in:
commit
9c954f4d6b
46 changed files with 3330 additions and 3 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
@ -0,0 +1,10 @@
|
|||
# editorconfig tool configuration
|
||||
# see http://editorconfig.org for docs
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespaces = true
|
||||
indent_style = tab
|
17
.examples/dockerfiles/cron/apache/Dockerfile
Normal file
17
.examples/dockerfiles/cron/apache/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM friendica:apache
|
||||
|
||||
ENV AUTOINSTALL true
|
||||
ENV MARIADB_VERSION 10.3
|
||||
|
||||
RUN set -ex; \
|
||||
; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
supervisor \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
mkdir /var/log/supervisord /var/run/supervisord
|
||||
|
||||
COPY ./supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
CMD ["/usr/bin/supervisord"]
|
22
.examples/dockerfiles/cron/apache/supervisord.conf
Normal file
22
.examples/dockerfiles/cron/apache/supervisord.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisord/supervisord.log
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
childlogdir=/var/log/supervisord/
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=error
|
||||
|
||||
[program:apache2]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=apache2-foreground
|
||||
|
||||
[program:cron]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=/cron.sh
|
17
.examples/dockerfiles/cron/fpm/Dockerfile
Normal file
17
.examples/dockerfiles/cron/fpm/Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
|||
FROM friendica:fpm
|
||||
|
||||
ENV AUTOINSTALL true
|
||||
ENV MARIADB_VERSION 10.3
|
||||
|
||||
RUN set -ex; \
|
||||
; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
supervisor \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*; \
|
||||
mkdir /var/log/supervisord /var/run/supervisord
|
||||
|
||||
COPY ./supervisord.conf /etc/supervisor/supervisord.conf
|
||||
|
||||
CMD ["/usr/bin/supervisord"]
|
22
.examples/dockerfiles/cron/fpm/supervisord.conf
Normal file
22
.examples/dockerfiles/cron/fpm/supervisord.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/var/log/supervisord/supervisord.log
|
||||
pidfile=/var/run/supervisord/supervisord.pid
|
||||
childlogdir=/var/log/supervisord/
|
||||
logfile_maxbytes=50MB ; maximum size of logfile before rotation
|
||||
logfile_backups=10 ; number of backed up logfiles
|
||||
loglevel=error
|
||||
|
||||
[program:apache2]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=apache2-foreground
|
||||
|
||||
[program:cron]
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=/cron.sh
|
24
.examples/dockerfiles/smtp/README.md
Normal file
24
.examples/dockerfiles/smtp/README.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
# SMTP section
|
||||
|
||||
In this subfolder are examples how to add SMTP support to the Friendica docker images.
|
||||
|
||||
Each directory represents the image-version of the Dockerfile.
|
||||
It uses the stable-branches of the Friendica Dockerfiles out-of-the-box.
|
||||
So if you want to use the develop-branch, you have to add the prefix `develop-` at the `FROM`clause (e.g. `FROM friendica:apache` -> `FROM friendica:develop-apache`)
|
||||
|
||||
- `SMTP_HOST` The host/IP of the SMTP-MTA
|
||||
|
||||
## Custom SMTP Settings
|
||||
|
||||
Currently, only `apache` and `fpm` supports custom SMTP settings.
|
||||
You **have** to set `SMTP_TYPE` to `custom` for other settings than `SMTP_HOST` (default: `simple`)
|
||||
|
||||
### SMTP Authentication
|
||||
- `SMTP_USERNAME` Username for the SMTP-MTA user to authenticate.
|
||||
- `SMTP_PASSWORD` Password for the SMTP-MTA user to authenticate.
|
||||
|
||||
### Additional settings
|
||||
- `SMTP_PORT` The port of the SMTP-MTA (default: `25`)
|
||||
- `SMTP_AUTH` The authentication string for the SMTP-MTA (default: `A p`)
|
||||
- `SMTP_TRUST_AUTH_MECH` The trusted authentication mechanism for the SMTP-MTA (default: `EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN`)
|
||||
- `SMTP_AUTH_MECH` The authentication mechanism for the SMTP-MTA (default: `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN`)
|
9
.examples/dockerfiles/smtp/apache/Dockerfile
Normal file
9
.examples/dockerfiles/smtp/apache/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM friendica:apache
|
||||
|
||||
# simple = using an smtp without any credentials (mostly in local networks)
|
||||
# custom = you need to set host, port, auth_options, authinfo (e.g. for GMX support)
|
||||
ENV SMTP_TYPE simple
|
||||
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN /smtp-config.sh
|
45
.examples/dockerfiles/smtp/apache/smtp-config.sh
Normal file
45
.examples/dockerfiles/smtp/apache/smtp-config.sh
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
IFS=\n
|
||||
|
||||
SMTP_TYPE=${SMTP_TYPE:-simple}
|
||||
|
||||
# config options
|
||||
SMTP_HOST=${SMTP_HOST:-'localhost'}
|
||||
SMTP_PORT=${SMTP_PORT:-'25'}
|
||||
SMTP_AUTH=${SMTP_AUTH:-'A p'}
|
||||
SMTP_TRUST_AUTH_MECH=${SMTP_TRUST_AUTH_MECH:-'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
|
||||
SMTP_AUTH_MECH=${SMTP_AUTH_MECH:-'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
|
||||
|
||||
SMTP_USERNAME=${SMTP_USERNAME:-''}
|
||||
SMTP_PASSWORD=${SMTP_PASSWORD:-''}
|
||||
|
||||
smtp_simple() {
|
||||
sed -i '/MAILER_DEFINITIONS/i define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl/' /etc/mail/sendmail.mc
|
||||
}
|
||||
|
||||
smtp_custom() {
|
||||
cd /etc/mail
|
||||
mkdir -m 700 authinfo
|
||||
cd authinfo/
|
||||
echo 'Authinfo: "U:www-data" "I:'$SMTP_USERNAME'" "P:'$SMTP_PASSWORD'"' > auth_file
|
||||
makemap hash auth < auth_file
|
||||
|
||||
sed -i '/MAILER_DEFINITIONS/i \
|
||||
define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl \
|
||||
define(`RELAY_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
|
||||
define(`ESMTP_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
|
||||
define(`confAUTH_OPTIONS'\'', `'$SMTP_AUTH''\'')dnl \
|
||||
TRUST_AUTH_MECH(`'$SMTP_TRUST_AUTH_MECH''\'')dnl \
|
||||
define(`confAUTH_MECHANISMS'\'', `'$SMTP_AUTH_MECH''\'')dnl \
|
||||
FEATURE(`authinfo'\'',`hash -o /etc/mail/authinfo/auth.db'\'')dnl' /etc/mail/sendmail.mc
|
||||
}
|
||||
|
||||
case $SMTP_TYPE in
|
||||
simple) smtp_simple ;;
|
||||
custom) smtp_custom ;;
|
||||
*)
|
||||
echo "Unknown SMTP-Type '$SMTP_TYPE'"
|
||||
exit 1
|
||||
esac
|
18
.examples/dockerfiles/smtp/fpm-alpine/Dockerfile
Normal file
18
.examples/dockerfiles/smtp/fpm-alpine/Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
FROM friendica:develop-fpm-alpine
|
||||
|
||||
# at least you HAVE to set one SMTP_HOST (normally something like mail.example.org)
|
||||
ENV SMTP_HOST mail
|
||||
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
ssmtp \
|
||||
; \
|
||||
# disable the current mailhub
|
||||
sed -i "s|mailhub=|#mailhub= |g" /etc/ssmtp/ssmtp.conf; \
|
||||
# enable the new mailhub
|
||||
echo "mailhub=${SMTP_HOST:-localhost}" >> /etc/ssmtp/ssmtp.conf;
|
||||
|
||||
# simple = using an smtp without any credentials (mostly in local networks)
|
||||
# custom = you need to set host, port, auth_options, authinfo (e.g. for GMX support)
|
||||
ENV SMTP_TYPE simple
|
9
.examples/dockerfiles/smtp/fpm/Dockerfile
Normal file
9
.examples/dockerfiles/smtp/fpm/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM friendica:develop-fpm
|
||||
|
||||
# simple = using an smtp without any credentials (mostly in local networks)
|
||||
# custom = you need to set host, port, auth_options, authinfo (e.g. for GMX support)
|
||||
ENV SMTP_TYPE simple
|
||||
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN /smtp-config.sh
|
45
.examples/dockerfiles/smtp/fpm/smtp-config.sh
Normal file
45
.examples/dockerfiles/smtp/fpm/smtp-config.sh
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
IFS=\n
|
||||
|
||||
SMTP_TYPE=${SMTP_TYPE:-simple}
|
||||
|
||||
# config options
|
||||
SMTP_HOST=${SMTP_HOST:-'localhost'}
|
||||
SMTP_PORT=${SMTP_PORT:-'25'}
|
||||
SMTP_AUTH=${SMTP_AUTH:-'A p'}
|
||||
SMTP_TRUST_AUTH_MECH=${SMTP_TRUST_AUTH_MECH:-'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
|
||||
SMTP_AUTH_MECH=${SMTP_AUTH_MECH:-'EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN'}
|
||||
|
||||
SMTP_USERNAME=${SMTP_USERNAME:-''}
|
||||
SMTP_PASSWORD=${SMTP_PASSWORD:-''}
|
||||
|
||||
smtp_simple() {
|
||||
sed -i '/MAILER_DEFINITIONS/i define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl/' /etc/mail/sendmail.mc
|
||||
}
|
||||
|
||||
smtp_custom() {
|
||||
cd /etc/mail
|
||||
mkdir -m 700 authinfo
|
||||
cd authinfo/
|
||||
echo 'Authinfo: "U:www-data" "I:'$SMTP_USERNAME'" "P:'$SMTP_PASSWORD'"' > auth_file
|
||||
makemap hash auth < auth_file
|
||||
|
||||
sed -i '/MAILER_DEFINITIONS/i \
|
||||
define(`SMART_HOST'\'',`'$SMTP_HOST''\'')dnl \
|
||||
define(`RELAY_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
|
||||
define(`ESMTP_MAILER_ARGS'\'', `TCP '$SMTP_HOST' '$SMTP_PORT''\'')dnl \
|
||||
define(`confAUTH_OPTIONS'\'', `'$SMTP_AUTH''\'')dnl \
|
||||
TRUST_AUTH_MECH(`'$SMTP_TRUST_AUTH_MECH''\'')dnl \
|
||||
define(`confAUTH_MECHANISMS'\'', `'$SMTP_AUTH_MECH''\'')dnl \
|
||||
FEATURE(`authinfo'\'',`hash -o /etc/mail/authinfo/auth.db'\'')dnl' /etc/mail/sendmail.mc
|
||||
}
|
||||
|
||||
case $SMTP_TYPE in
|
||||
simple) smtp_simple ;;
|
||||
custom) smtp_custom ;;
|
||||
*)
|
||||
echo "Unknown SMTP-Type '$SMTP_TYPE'"
|
||||
exit 1
|
||||
esac
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Disable LF normalization for all files
|
||||
* -text
|
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
favicon.*
|
||||
\#*
|
||||
*.log
|
||||
*.out
|
||||
*.version*
|
||||
favicon.*
|
||||
*~
|
||||
robots.txt
|
||||
|
||||
|
||||
#ignore config files from eclipse, we don't want IDE files in our repository
|
||||
.project
|
||||
.buildpath
|
||||
.externalToolBuilders
|
||||
.settings
|
||||
#ignore OSX .DS_Store files
|
||||
.DS_Store
|
||||
|
||||
#ignore config files from JetBrains
|
||||
/.idea
|
25
.travis.yml
Normal file
25
.travis.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
language: bash
|
||||
services: docker
|
||||
|
||||
env:
|
||||
- VARIANT=stable/apache
|
||||
- VARIANT=stable/fpm
|
||||
- VARIANT=stable/fpm-alpine
|
||||
- VARIANT=develop/apache
|
||||
- VARIANT=develop/fpm
|
||||
- VARIANT=develop/fpm-alpine
|
||||
|
||||
install:
|
||||
- git clone https://github.com/docker-library/official-images.git ~/official-images
|
||||
|
||||
before_script:
|
||||
- env | sort
|
||||
- cd "$VARIANT"
|
||||
- slash='/'; image="friendica:${VARIANT//$slash/-}"
|
||||
|
||||
script:
|
||||
- docker build -t "$image" .
|
||||
- ~/official-images/test/run.sh "$image"
|
||||
|
||||
after_script:
|
||||
- docker images
|
161
README.md
161
README.md
|
@ -1,3 +1,158 @@
|
|||
# Docker Image for Friendica
|
||||
|
||||
This repository holds the official Docker Image for [Friendica](https://friendi.ca)
|
||||
# Docker Image for Friendica
|
||||
[![Build Status Travis](https://travis-ci.org/friendica/docker.svg?branch=master)](https://travis-ci.org/friendica/docker)
|
||||
|
||||
This repository holds the official Docker Image for [Friendica](https://friendi.ca)
|
||||
|
||||
# What is Friendica?
|
||||
|
||||
Friendica is a decentralised communications platform that integrates social communication.
|
||||
Our platform links to independent social projects and corporate services.
|
||||
|
||||
![logo](https://cdn.rawgit.com/nupplaphil/friendica-docker/c59f235f/friendica.svg)
|
||||
|
||||
# How to use this image
|
||||
The images are designed to be used in a micro-service environment.
|
||||
There are two types of the image you can choose from.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## Using the apache image
|
||||
You need at least one other mariadb/mysql-container to link it to Friendica.
|
||||
|
||||
The apache image contains a webserver and exposes port 80.
|
||||
To start the container type:
|
||||
```console
|
||||
$ docker run -d -p 8080:80 --link some-mysql:mysql friendica
|
||||
```
|
||||
|
||||
Now you can access the Friendica installation wizard at http://localhost:8080/ from your host system.
|
||||
|
||||
## Using the fpm image
|
||||
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.
|
||||
|
||||
```console
|
||||
$ docker run -d friendica:fpm
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
## Using the cron job
|
||||
|
||||
There are three options to enable the cron-job for Friendica:
|
||||
- Using the default Image and activate the cron-job (see [Installation](https://friendi.ca/resources/installation/), sector `Activating scheduled tasks`)
|
||||
- Using the default image (apache, fpm, fpm-alpine) and use **two** container (one for cron and one for the main app)
|
||||
- Using one of the additional, prepared [`dockerfiles`](https://github.com/friendica/docker/tree/master/.examples/dockerfiles)
|
||||
|
||||
## Using sendmail for E-Mail support
|
||||
|
||||
You have to set the `--hostname/-h` parameter correctly to make the `mail()` command use the right domainname of it's e-mail.
|
||||
Currently, the command `sendmail` will be used for the `mail()` support of Friendica.
|
||||
|
||||
Be aware that in production environment, you normally have an external MTA (or a SmartHost) for correctly signing and routing your e-mails.
|
||||
See the Dockerfiles at [`smtp`](https://github.com/friendica/docker/tree/master/.examples/dockerfiles/smtp) for examples how to configure it.
|
||||
|
||||
### `apache` and `fpm` image
|
||||
`sendmail` is used as a SMTP MTA for standalone usage and it works out-of-the-box.
|
||||
|
||||
### `fpm-alpine` image
|
||||
For alpine, there is no "standalone" mail-service available.
|
||||
Therefore you **have** to setup a SMTP MTA.
|
||||
|
||||
## Using an external database
|
||||
By default the `latest` container uses a local MySQL-Database for data storage, but the Friendica setup wizard (appears on first run) allows connecting to an existing MySQL/MariaDB database.
|
||||
You can also link a database container, e. g. `--link my-mysql:mysql`, and then use `mysql` as the database host on setup.
|
||||
|
||||
## Persistent data
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Friendica:
|
||||
- `/var/www/html/` folder where all Friendica data lives
|
||||
```console
|
||||
$ docker run -d \
|
||||
-v friendica-vol-1:/var/www/html \
|
||||
friendica
|
||||
```
|
||||
|
||||
Database:
|
||||
- `/var/lib/mysql` MySQL / MariaDB Data
|
||||
```console
|
||||
$ docker run -d \
|
||||
-v mysql-vol-1:/var/lib/mysql \
|
||||
mariadb
|
||||
```
|
||||
|
||||
## Auto configuration via environment variables
|
||||
The Friendica image supports auto configuration via environment variables.
|
||||
You can preconfigure everything that is asked on the install page on first run.
|
||||
|
||||
- `AUTOINSTALL` if `true`, the automatic configuration will start (Default: `false`)
|
||||
|
||||
__MYSQL/MariaDB__:
|
||||
- `MYSQL_USERNAME` Username for the database user using mysql / mariadb.
|
||||
- `MYSQL_PASSWORD` Password for the database user using mysql / mariadb.
|
||||
- `MYSQL_DATABASE` Name of the database using mysql / mariadb.
|
||||
- `MYSQL_HOST` Hostname of the database server using mysql / mariadb.
|
||||
- `MYSQL_PORT` Port of the database server using mysql / mariadb.
|
||||
|
||||
You can also predefine the following `.htconfig.php` values:
|
||||
- `MAILNAME` E-Mail address of the administrator
|
||||
- `TZ` The default localization of the Friendica server
|
||||
- `LANGUAGE` The default language of the Friendica server
|
||||
- `SITENAME` The default name of the Friendica server
|
||||
|
||||
## Updating Friendica
|
||||
|
||||
There are differences between the [stable](https://github.com/friendica/docker/tree/master/stable/) and the [develop](https://github.com/friendica/docker/tree/master/develop/) branches.
|
||||
|
||||
They have both in common that normally we do not automatically overwrite your working directory with the new version.
|
||||
Instead you need to explicit run `update` for the node for updating files&database.
|
||||
|
||||
## Updating stable
|
||||
You have to pull the latest image from the hub (`docker pull friendica`).
|
||||
|
||||
## Updating develop
|
||||
You don't need to pull the image for each commit in [friendica](https://github.com/friendica/friendica/).
|
||||
Instead you can just update your node with executing `friendica update` on the node.
|
||||
Example:
|
||||
```console
|
||||
$ docker exec -ti friendica_running_node friendica update
|
||||
```
|
||||
It will clone the latest Friendica version and copy it to your working directory.
|
||||
|
||||
# The `friendica` CLI
|
||||
|
||||
To make the usage of the Dockerimages smooth, we created a little CLI.
|
||||
It wraps the common commands for Friendica and adds new commands.
|
||||
|
||||
You can call it with
|
||||
```console
|
||||
$ docker exec -ti friendica_running_node friendica <command> \
|
||||
```
|
||||
|
||||
Commands:
|
||||
- `console` Executes an command in the Friendica console (`bin/console.php` wrapper)
|
||||
- `composer` Executes the composer.phar executable for Friendica (`bin/composer.phar` wrapper)
|
||||
- `install` Installs Friendica on a empty environment (gets called automatically during first start)
|
||||
- `update` Updates Friendica on a **existing** environment
|
||||
|
||||
|
||||
# Questions / Issues
|
||||
If you got any questions or problems using the image, please visit our [Github Repository](https://github.com/friendica/docker) and write an issue.
|
108
develop/apache/Dockerfile
Normal file
108
develop/apache/Dockerfile
Normal file
|
@ -0,0 +1,108 @@
|
|||
FROM php:7.1-apache
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
libpng12-0 \
|
||||
libpng12-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libtool \
|
||||
libmcrypt4 \
|
||||
libmcrypt-dev \
|
||||
imagemagick \
|
||||
libmagick++-dev \
|
||||
libgraphicsmagick1-dev \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
librsvg2-2 \
|
||||
libcurl4-openssl-dev \
|
||||
curl \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache \
|
||||
; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
|
||||
; \
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN a2enmod rewrite remoteip ;\
|
||||
{\
|
||||
echo RemoteIPHeader X-Real-IP ;\
|
||||
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
|
||||
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
|
||||
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
|
||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||
a2enconf remoteip
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION develop
|
||||
ENV ADDONS_VERSION develop
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
212
develop/apache/bin/friendica
Normal file
212
develop/apache/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
develop/apache/config/htconfig.php
Normal file
104
develop/apache/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
develop/apache/cron.sh
Normal file
14
develop/apache/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
develop/apache/entrypoint.sh
Normal file
7
develop/apache/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
86
develop/fpm-alpine/Dockerfile
Normal file
86
develop/fpm-alpine/Dockerfile
Normal file
|
@ -0,0 +1,86 @@
|
|||
FROM php:7.1-fpm-alpine
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
rsync \
|
||||
git;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add -U --no-cache --virtual .build-deps \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
openssl-dev \
|
||||
libpng \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
imagemagick-dev \
|
||||
imagemagick \
|
||||
libtool \
|
||||
libmcrypt \
|
||||
libmcrypt-dev \
|
||||
freetype \
|
||||
libpng \
|
||||
libjpeg-turbo-dev \
|
||||
freetype-dev \
|
||||
librsvg \
|
||||
libcurl \
|
||||
curl \
|
||||
curl-dev \
|
||||
rsync \
|
||||
bzip2 \
|
||||
; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .friendica-phpext-rundeps $runDeps; \
|
||||
apk del .build-deps;
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION develop
|
||||
ENV ADDONS_VERSION develop
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
212
develop/fpm-alpine/bin/friendica
Normal file
212
develop/fpm-alpine/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
develop/fpm-alpine/config/htconfig.php
Normal file
104
develop/fpm-alpine/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
develop/fpm-alpine/cron.sh
Normal file
14
develop/fpm-alpine/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
develop/fpm-alpine/entrypoint.sh
Normal file
7
develop/fpm-alpine/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
99
develop/fpm/Dockerfile
Normal file
99
develop/fpm/Dockerfile
Normal file
|
@ -0,0 +1,99 @@
|
|||
FROM php:7.1-fpm
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
libpng12-0 \
|
||||
libpng12-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libtool \
|
||||
libmcrypt4 \
|
||||
libmcrypt-dev \
|
||||
imagemagick \
|
||||
libmagick++-dev \
|
||||
libgraphicsmagick1-dev \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
librsvg2-2 \
|
||||
libcurl4-openssl-dev \
|
||||
curl \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache \
|
||||
; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
|
||||
; \
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION develop
|
||||
ENV ADDONS_VERSION develop
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
212
develop/fpm/bin/friendica
Normal file
212
develop/fpm/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
develop/fpm/config/htconfig.php
Normal file
104
develop/fpm/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
develop/fpm/cron.sh
Normal file
14
develop/fpm/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
develop/fpm/entrypoint.sh
Normal file
7
develop/fpm/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
240
friendica.svg
Normal file
240
friendica.svg
Normal file
|
@ -0,0 +1,240 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="96"
|
||||
height="96"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.0 r9654"
|
||||
sodipodi:docname="friendica.svg"
|
||||
inkscape:export-filename="/home/meta/Documents/My random images/friendica.png"
|
||||
inkscape:export-xdpi="80.552788"
|
||||
inkscape:export-ydpi="80.552788">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="highlightgradient">
|
||||
<stop
|
||||
id="stop3833"
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:0.74374998;" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3829" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="shadowgradient">
|
||||
<stop
|
||||
id="stop3833-5"
|
||||
offset="0"
|
||||
style="stop-color:#000000;stop-opacity:0.5;" />
|
||||
<stop
|
||||
style="stop-color:#818080;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3829-9" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#highlightgradient"
|
||||
id="linearGradient4011"
|
||||
x1="44.948269"
|
||||
y1="0"
|
||||
x2="54.103466"
|
||||
y2="46.797421"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="scale(1,0.54545455)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#shadowgradient"
|
||||
id="linearGradient4021"
|
||||
x1="52.016712"
|
||||
y1="96"
|
||||
x2="42.867535"
|
||||
y2="41.837971"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.5,0,48)" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter4055"
|
||||
x="-0.03"
|
||||
width="1.06"
|
||||
y="-0.12"
|
||||
height="1.24">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="1.2"
|
||||
id="feGaussianBlur4057" />
|
||||
</filter>
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter4059"
|
||||
x="-0.029877551"
|
||||
width="1.0597551"
|
||||
y="-0.122"
|
||||
height="1.244">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="1.22"
|
||||
id="feGaussianBlur4061" />
|
||||
</filter>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.9132799"
|
||||
inkscape:cx="53.033009"
|
||||
inkscape:cy="2.8284271"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
width="256px"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="1010"
|
||||
inkscape:window-x="194"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid2985"
|
||||
empspacing="3"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
spacingx="2px"
|
||||
spacingy="2px" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Colors"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-956.3622)"
|
||||
style="display:inline">
|
||||
<path
|
||||
style="fill:#ffc019;fill-opacity:1;stroke:none"
|
||||
d="M 16,0 C 7.0091019,0.04308252 0,7.0521845 0,16 0,16 0,57.499123 0,80 0,89.120146 7.0091019,96 16,96 L 32,96 32,70 64,70 63.916016,46.068359 32,46.236328 32,26 64,26 64,0 C 64,0 24,0 16,0 z"
|
||||
transform="translate(0,956.3622)"
|
||||
id="rect2993"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccsccccccccc" />
|
||||
<path
|
||||
style="fill:#1872a2;fill-opacity:1;stroke:none"
|
||||
d="m 80,1052.3622 c 8.990898,0 16.086165,-6.966 16,-16 0,0 0,-41.4991 0,-64 0.07767,-9.01639 -7.067354,-16 -16,-16 l -16,0 0,26 -32,0 0,22 32,0 0,22 -32,0 0,26 c 0,0 32,0 48,0 z"
|
||||
id="rect2993-6"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccsccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
style="display:inline"
|
||||
inkscape:label="Lines as original logo"
|
||||
id="g3997"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3999"
|
||||
d="m 64,0 0,26 -32,0 0,22 m 32,0 0,22 -32,0 0,26"
|
||||
style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
<rect
|
||||
ry="16"
|
||||
rx="16"
|
||||
y="0"
|
||||
x="0"
|
||||
height="96"
|
||||
width="96"
|
||||
id="rect4001"
|
||||
style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="Lines with center break"
|
||||
style="display:none">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 64,0 0,26 -32,0 0,22 32,0 0,22 -32,0 0,26"
|
||||
id="path3926"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<rect
|
||||
style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="rect3928"
|
||||
width="96"
|
||||
height="96"
|
||||
x="0"
|
||||
y="0"
|
||||
rx="16"
|
||||
ry="16" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Effects"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="fill:url(#linearGradient3930);fill-opacity:1;stroke:none"
|
||||
id="rect3823"
|
||||
width="96"
|
||||
height="48.04369"
|
||||
x="-3.1086245e-15"
|
||||
y="1.8024861e-14"
|
||||
ry="15.215644"
|
||||
rx="15.214664" />
|
||||
<rect
|
||||
style="fill:url(#linearGradient3904);fill-opacity:1;stroke:none"
|
||||
id="rect3823-8"
|
||||
width="96"
|
||||
height="47.86721"
|
||||
x="1.5376101e-14"
|
||||
y="-96"
|
||||
ry="15.159752"
|
||||
rx="15.214664"
|
||||
transform="scale(1,-1)" />
|
||||
<rect
|
||||
style="fill:url(#linearGradient4011);fill-opacity:1;stroke:none;filter:url(#filter4059)"
|
||||
id="rect4003"
|
||||
width="98"
|
||||
height="24"
|
||||
x="0"
|
||||
y="0"
|
||||
rx="15.214664"
|
||||
ry="8.2994423"
|
||||
transform="matrix(1.0296115,0,0,1.1963836,-2.901924,-4.7132067)" />
|
||||
<rect
|
||||
style="opacity:0.56746030000000003;fill:url(#linearGradient4021);fill-opacity:1;stroke:none;filter:url(#filter4055)"
|
||||
id="rect4013"
|
||||
width="96"
|
||||
height="24"
|
||||
x="0"
|
||||
y="72"
|
||||
rx="14.008356"
|
||||
ry="12"
|
||||
transform="matrix(0.9768331,0,0,0.91974646,1.1649641,8.098115)" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 7.2 KiB |
121
stable/apache/Dockerfile
Normal file
121
stable/apache/Dockerfile
Normal file
|
@ -0,0 +1,121 @@
|
|||
FROM php:7.1-apache
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
libpng12-0 \
|
||||
libpng12-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libtool \
|
||||
libmcrypt4 \
|
||||
libmcrypt-dev \
|
||||
imagemagick \
|
||||
libmagick++-dev \
|
||||
libgraphicsmagick1-dev \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
librsvg2-2 \
|
||||
libcurl4-openssl-dev \
|
||||
curl \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache \
|
||||
; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
|
||||
; \
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN a2enmod rewrite remoteip ;\
|
||||
{\
|
||||
echo RemoteIPHeader X-Real-IP ;\
|
||||
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
|
||||
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
|
||||
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
|
||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||
a2enconf remoteip
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION 3.6
|
||||
ENV ADDONS_VERSION 3.6
|
||||
|
||||
RUN set -ex; \
|
||||
curl -fsSL -o friendica.tar.gz \
|
||||
"https://github.com/friendica/friendica/releases/download/${FRIENDICA_VERSION}/friendica-full-${FRIENDICA_VERSION}.tar.gz"; \
|
||||
tar -xzf friendica.tar.gz -C /usr/src/; \
|
||||
rm friendica.tar.gz; \
|
||||
mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \
|
||||
chmod 777 /usr/src/friendica/view/smarty3; \
|
||||
curl -fsSL -o friendica_addons.tar.gz \
|
||||
"https://github.com/friendica/friendica-addons/archive/${ADDONS_VERSION}.tar.gz"; \
|
||||
mkdir /usr/src/friendica/addon; \
|
||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||
rm friendica_addons.tar.gz;
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
212
stable/apache/bin/friendica
Normal file
212
stable/apache/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
stable/apache/config/htconfig.php
Normal file
104
stable/apache/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
stable/apache/cron.sh
Normal file
14
stable/apache/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
stable/apache/entrypoint.sh
Normal file
7
stable/apache/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
99
stable/fpm-alpine/Dockerfile
Normal file
99
stable/fpm-alpine/Dockerfile
Normal file
|
@ -0,0 +1,99 @@
|
|||
FROM php:7.1-fpm-alpine
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache \
|
||||
rsync \
|
||||
git;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add -U --no-cache --virtual .build-deps \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
openssl-dev \
|
||||
libpng \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
imagemagick-dev \
|
||||
imagemagick \
|
||||
libtool \
|
||||
libmcrypt \
|
||||
libmcrypt-dev \
|
||||
freetype \
|
||||
libpng \
|
||||
libjpeg-turbo-dev \
|
||||
freetype-dev \
|
||||
librsvg \
|
||||
libcurl \
|
||||
curl \
|
||||
curl-dev \
|
||||
rsync \
|
||||
bzip2 \
|
||||
; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .friendica-phpext-rundeps $runDeps; \
|
||||
apk del .build-deps;
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION 3.6
|
||||
ENV ADDONS_VERSION 3.6
|
||||
|
||||
RUN set -ex; \
|
||||
curl -fsSL -o friendica.tar.gz \
|
||||
"https://github.com/friendica/friendica/releases/download/${FRIENDICA_VERSION}/friendica-full-${FRIENDICA_VERSION}.tar.gz"; \
|
||||
tar -xzf friendica.tar.gz -C /usr/src/; \
|
||||
rm friendica.tar.gz; \
|
||||
mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \
|
||||
chmod 777 /usr/src/friendica/view/smarty3; \
|
||||
curl -fsSL -o friendica_addons.tar.gz \
|
||||
"https://github.com/friendica/friendica-addons/archive/${ADDONS_VERSION}.tar.gz"; \
|
||||
mkdir /usr/src/friendica/addon; \
|
||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||
rm friendica_addons.tar.gz;
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
212
stable/fpm-alpine/bin/friendica
Normal file
212
stable/fpm-alpine/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
stable/fpm-alpine/config/htconfig.php
Normal file
104
stable/fpm-alpine/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
stable/fpm-alpine/cron.sh
Normal file
14
stable/fpm-alpine/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
stable/fpm-alpine/entrypoint.sh
Normal file
7
stable/fpm-alpine/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
112
stable/fpm/Dockerfile
Normal file
112
stable/fpm/Dockerfile
Normal file
|
@ -0,0 +1,112 @@
|
|||
FROM php:7.1-fpm
|
||||
LABEL maintainer="Philipp Holzer <admin@philipp.info>"
|
||||
|
||||
ENV IMAGICK_PECL 3.4.3
|
||||
ENV AUTOINSTALL false
|
||||
|
||||
# entrypoint.sh and cron.sh dependencies
|
||||
RUN set -ex; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
rsync \
|
||||
bzip2 \
|
||||
git \
|
||||
# For mail() support
|
||||
sendmail \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
# install the PHP extensions we need
|
||||
# see https://friendi.ca/resources/requirements/
|
||||
RUN set -ex; \
|
||||
\
|
||||
savedAptMark="$(apt-mark showmanual)"; \
|
||||
\
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libxml2-dev \
|
||||
mysql-client \
|
||||
bash \
|
||||
autoconf \
|
||||
g++ \
|
||||
make \
|
||||
openssl \
|
||||
libssl-dev \
|
||||
libpng12-0 \
|
||||
libpng12-dev \
|
||||
libjpeg62-turbo-dev \
|
||||
libtool \
|
||||
libmcrypt4 \
|
||||
libmcrypt-dev \
|
||||
imagemagick \
|
||||
libmagick++-dev \
|
||||
libgraphicsmagick1-dev \
|
||||
libfreetype6 \
|
||||
libfreetype6-dev \
|
||||
librsvg2-2 \
|
||||
libcurl4-openssl-dev \
|
||||
curl \
|
||||
; \
|
||||
\
|
||||
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
|
||||
pecl install imagick-${IMAGICK_PECL}; \
|
||||
docker-php-ext-enable imagick; \
|
||||
pecl clear-cache \
|
||||
; \
|
||||
docker-php-ext-configure gd \
|
||||
--with-gd \
|
||||
--enable-gd-native-ttf \
|
||||
--with-freetype-dir=/usr/include/ \
|
||||
--with-png-dir=/usr/include/ \
|
||||
--with-jpeg-dir=/usr/include/ \
|
||||
; \
|
||||
docker-php-ext-install -j 4 curl pdo pdo_mysql xml gd zip opcache mbstring posix ctype json iconv mcrypt \
|
||||
; \
|
||||
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
|
||||
apt-mark auto '.*' > /dev/null; \
|
||||
apt-mark manual $savedAptMark; \
|
||||
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| sort -u \
|
||||
| xargs -r dpkg-query -S \
|
||||
| cut -d: -f1 \
|
||||
| sort -u \
|
||||
| xargs -rt apt-mark manual; \
|
||||
\
|
||||
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN chown -R www-data:root /var/www; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
VOLUME /var/www/html
|
||||
|
||||
RUN {\
|
||||
echo sendmail_path = "/usr/sbin/sendmail -t -i" ;\
|
||||
} > /usr/local/etc/php/conf.d/sendmail.ini;
|
||||
|
||||
ENV FRIENDICA_VERSION 3.6
|
||||
ENV ADDONS_VERSION 3.6
|
||||
|
||||
RUN set -ex; \
|
||||
curl -fsSL -o friendica.tar.gz \
|
||||
"https://github.com/friendica/friendica/releases/download/${FRIENDICA_VERSION}/friendica-full-${FRIENDICA_VERSION}.tar.gz"; \
|
||||
tar -xzf friendica.tar.gz -C /usr/src/; \
|
||||
rm friendica.tar.gz; \
|
||||
mv -f /usr/src/friendica-${FRIENDICA_VERSION}/ /usr/src/friendica; \
|
||||
chmod 777 /usr/src/friendica/view/smarty3; \
|
||||
curl -fsSL -o friendica_addons.tar.gz \
|
||||
"https://github.com/friendica/friendica-addons/archive/${ADDONS_VERSION}.tar.gz"; \
|
||||
mkdir /usr/src/friendica/addon; \
|
||||
tar -xzf friendica_addons.tar.gz -C /usr/src/friendica/addon --strip-components=1; \
|
||||
rm friendica_addons.tar.gz;
|
||||
|
||||
COPY bin/* /usr/local/bin/
|
||||
COPY config/* /usr/src/config/
|
||||
COPY *.sh /
|
||||
RUN chmod +x /*.sh
|
||||
RUN chmod +x /usr/local/bin/*
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
212
stable/fpm/bin/friendica
Normal file
212
stable/fpm/bin/friendica
Normal file
|
@ -0,0 +1,212 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
FRIENDICA_VERSION=${FRIENDICA_VERSION:-develop}
|
||||
FRIENDICA_ADDONS=${FRIENDICA_ADDONS:-develop}
|
||||
AUTOINSTALL=${AUTOINSTALL:-false}
|
||||
|
||||
SOURCEDIR=/usr/src
|
||||
WORKDIR=/var/www/html
|
||||
|
||||
# change delimiter for arrays from whitespaces to newlines (so we can pass strings with whitespaces)
|
||||
#IFS=\r\n
|
||||
|
||||
VERBOSE=1
|
||||
for arg; do
|
||||
case "$arg" in
|
||||
-q|--quit)
|
||||
if [ "$VERBOSE" -eq "2" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=0
|
||||
break
|
||||
;;
|
||||
-v|--verbose)
|
||||
if [ "$VERBOSE" -eq "0" ]; then
|
||||
echo 'You cannot use verbose and quiet at the same time'
|
||||
exit 1
|
||||
fi
|
||||
VERBOSE=2
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su - www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# log event
|
||||
log() {
|
||||
currVerb=1
|
||||
if [ $# -eq 2 ]; then
|
||||
currVerb=$2
|
||||
fi
|
||||
if [ "$VERBOSE" -ge "$currVerb" ]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# checks if the the first parameter is greater than the second parameter
|
||||
version_greater() {
|
||||
[ "$(printf '%s\n' "$@" | sort -t '.' -n -k1,1 -k2,2 | head -n 1)" != "$1" ]
|
||||
}
|
||||
|
||||
# clones the whole develop branch (Friendica and Addons)
|
||||
clone_develop() {
|
||||
dir="${1:-$SOURCEDIR}"
|
||||
friendica="${2:-$FRIENDICA_VERSION}"
|
||||
addons="${3:-$FRIENDICA_ADDONS}"
|
||||
|
||||
log 'Cloning Friendica '\'$friendica\'' with Addons '\'$addons\'' into '\'$dir\'
|
||||
|
||||
# Removing the whole directory first
|
||||
rm -fr $dir/friendica
|
||||
|
||||
sh -c "git clone -b ${friendica} https://github.com/friendica/friendica ${dir}/friendica"
|
||||
mkdir $dir/friendica/addon
|
||||
sh -c "git clone -b ${addons} https://github.com/friendica/friendica-addons ${dir}/friendica/addon"
|
||||
}
|
||||
|
||||
# help of this shell script
|
||||
friendica_help() {
|
||||
echo "Usage: friendica <command> [<args>]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " console Executes an command in the Friendica console"
|
||||
echo " composer Executes the composer.phar executable for Friendica"
|
||||
echo " install Installs Friendica"
|
||||
echo " update Updates Friendica"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# executes the Friendica console
|
||||
console() {
|
||||
cd $WORKDIR
|
||||
# Todo starting a php-executable without quoting the arguments seems not secure (but is the only way it works)
|
||||
sh -c "php $WORKDIR/bin/console.php $@"
|
||||
}
|
||||
|
||||
# executes the composer.phar binary of Friendica
|
||||
composer() {
|
||||
if [ -f $WORKDIR/bin/composer.phar ]; then
|
||||
run_as "cd $WORKDIR;$WORKDIR/bin/composer.phar $@ -d $WORKDIR"
|
||||
fi
|
||||
}
|
||||
|
||||
copy_sources() {
|
||||
installed_version="0.0.0.0"
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
installed_version="$(cat ${WORKDIR}/VERSION)"
|
||||
fi
|
||||
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
clone_develop
|
||||
fi
|
||||
|
||||
image_version="0.0.0.0"
|
||||
if [ -f $SOURCEDIR/friendica/VERSION ]; then
|
||||
image_version="$(cat $SOURCEDIR/friendica/VERSION)"
|
||||
else
|
||||
# no given installation and not using the developer branch => nothing to do
|
||||
log 'Friendica command '\'$1\'' failed, because of no version found', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$installed_version" "$image_version"; then
|
||||
log 'Can'\''t copy Friendica sources because the version of the data ($installed_version) is higher than the docker image ('$image_version')', 0
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if version_greater "$image_version" "$installed_version"; then
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
rsync_options="-rlDog --chown=www-data:root"
|
||||
else
|
||||
rsync_options="-rlD"
|
||||
fi
|
||||
|
||||
log 'Copying Friendica sources ('$image_version') from '\'$SOURCEDIR'/friendica'\'' to '\'$WORKDIR\'
|
||||
rsync $rsync_options --delete --exclude='.git' $SOURCEDIR/friendica/ $WORKDIR/
|
||||
|
||||
if [ -f $WORKDIR/view/smarty3 ]; then
|
||||
chmod 777 $WORKDIR/view/smarty3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# install Friendica
|
||||
install() {
|
||||
if [ -f ${WORKDIR}/VERSION ]; then
|
||||
# If there is a given installation of Friendica and we should not update it => exit
|
||||
# We have to explicit update Friendica to avoid breaking something
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Installing Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
|
||||
if [ ! -f ${WORKDIR}/.htconfig.php ] &&
|
||||
[ -f ${SOURCEDIR}/config/htconfig.php ] &&
|
||||
"$AUTOINSTALL" == "true"; then
|
||||
run_as "cp ${SOURCEDIR}/config/htconfig.php ${WORKDIR}/html/.htconfig.php"
|
||||
# TODO Pull Request for dba Change
|
||||
run_as "sed -i 's/\s+\sDNS_CNAME//g' ${WORKDIR}/include/dba.php"
|
||||
console "autoinstall -f .htconfig.php"
|
||||
# TODO Workaround because of a strange permission issue
|
||||
rm -fr ${WORKDIR}/view/smarty3/compiled
|
||||
fi
|
||||
}
|
||||
|
||||
update() {
|
||||
if [ ! -f ${WORKDIR}/VERSION ]; then
|
||||
# We want to update a given installation
|
||||
# if there is no installation, exit
|
||||
return
|
||||
fi
|
||||
|
||||
copy_sources
|
||||
|
||||
log 'Upgrading Friendica'
|
||||
if [ "$FRIENDICA_VERSION" = "develop" ]; then
|
||||
composer "install"
|
||||
fi
|
||||
console "dbstructure update"
|
||||
}
|
||||
|
||||
sendmail() {
|
||||
if [ ! -f /etc/init.d/sendmail ]; then
|
||||
# If sendmail isn't installed, exit this method
|
||||
return
|
||||
fi
|
||||
|
||||
line=$(head -n 1 /etc/hosts)
|
||||
line2=$(echo $line | awk '{print $2}')
|
||||
echo "$line $line2.localdomain" >> /etc/hosts
|
||||
|
||||
log 'Starting sendmail for Mail-Support'
|
||||
nohup /etc/init.d/sendmail start > /dev/null 2>&1 &
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
friendica_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
install) shift; install "$@";;
|
||||
update) shift; update "$@" ;;
|
||||
console) shift; console "$@" ;;
|
||||
composer) shift; composer "$@" ;;
|
||||
sendmail) shift; sendmail "$@" ;;
|
||||
*) friendica_help ;;
|
||||
esac
|
104
stable/fpm/config/htconfig.php
Normal file
104
stable/fpm/config/htconfig.php
Normal file
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
// Custom htconfig.php for Docker usage.
|
||||
// Uses a lot of environment variables
|
||||
|
||||
// Use environment variables for mysql if they are set beforehand
|
||||
if (!empty(getenv('MYSQL_HOST'))
|
||||
&& !empty(getenv('MYSQL_PORT'))
|
||||
&& !empty(getenv('MYSQL_USERNAME'))
|
||||
&& !empty(getenv('MYSQL_PASSWORD'))
|
||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
||||
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
|
||||
$db_user = getenv('MYSQL_USERNAME');
|
||||
$db_pass = getenv('MYSQL_PASSWORD');
|
||||
$db_data = getenv('MYSQL_DATABASE');
|
||||
}
|
||||
|
||||
// Set the database connection charset to full Unicode (utf8mb4).
|
||||
// Changing this value will likely corrupt the special characters.
|
||||
// You have been warned.
|
||||
$a->config['system']['db_charset'] = "utf8mb4";
|
||||
|
||||
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
|
||||
// It can be changed later and only applies to timestamps for anonymous viewers.
|
||||
|
||||
if (!empty(getenv('TZ'))) {
|
||||
$default_timezone = getenv('TZ');
|
||||
} else {
|
||||
$default_timezone = 'America/Los_Angeles';
|
||||
}
|
||||
|
||||
// Default system language
|
||||
if (!empty(getenv('LANGUAGE'))) {
|
||||
$a->config['system']['language'] = getenv('LANGUAGE');
|
||||
} else {
|
||||
$a->config['system']['language'] = 'en';
|
||||
}
|
||||
|
||||
// What is your site name?
|
||||
if (!empty(getenv('SITENAME'))) {
|
||||
$a->config['sitename'] = getenv('SITENAME');
|
||||
} else {
|
||||
$a->config['sitename'] = "Friendica Social Network";
|
||||
}
|
||||
|
||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||
// Be certain to create your own personal account before setting
|
||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
||||
// to the email address of an already registered person who can authorise
|
||||
// and/or approve/deny the request.
|
||||
|
||||
// In order to perform system administration via the admin panel, admin_email
|
||||
// must precisely match the email address of the person logged in.
|
||||
|
||||
$a->config['register_policy'] = REGISTER_OPEN;
|
||||
$a->config['register_text'] = '';
|
||||
if (!empty(getenv('MAILNAME'))) {
|
||||
$a->config['admin_email'] = getenv('MAILNAME');
|
||||
} else {
|
||||
$a->config['admin_email'] = '';
|
||||
}
|
||||
|
||||
// Maximum size of an imported message, 0 is unlimited
|
||||
|
||||
$a->config['max_import_size'] = 200000;
|
||||
|
||||
// maximum size of uploaded photos
|
||||
|
||||
$a->config['system']['maximagesize'] = 800000;
|
||||
|
||||
// Location of PHP command line processor
|
||||
|
||||
$a->config['php_path'] = 'php';
|
||||
|
||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
||||
// set to 0 to disable, 1 to enable
|
||||
|
||||
$a->config['system']['rino_encrypt'] = 1;
|
||||
|
||||
// allowed themes (change this from admin panel after installation)
|
||||
|
||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
||||
|
||||
// default system theme
|
||||
|
||||
$a->config['system']['theme'] = 'vier';
|
||||
|
||||
|
||||
// By default allow pseudonyms
|
||||
|
||||
$a->config['system']['no_regfullname'] = true;
|
||||
|
||||
//Deny public access to the local directory
|
||||
//$a->config['system']['block_local_dir'] = false;
|
||||
|
||||
// Location of the global directory
|
||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
||||
|
||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
||||
|
||||
// Authentication cookie lifetime, in days
|
||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
14
stable/fpm/cron.sh
Normal file
14
stable/fpm/cron.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
trap "break;exit" SIGHUP SIGINT SIGTERM
|
||||
|
||||
while [ ! -f /var/www/html/.htconfig.php ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
while true; do
|
||||
cd /var/www/html
|
||||
php -f /var/www/html/bin/worker.php
|
||||
sleep 10m
|
||||
done
|
7
stable/fpm/entrypoint.sh
Normal file
7
stable/fpm/entrypoint.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
friendica install -q
|
||||
friendica sendmail -q
|
||||
|
||||
exec "$@"
|
Loading…
Reference in a new issue