mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Merge branch 'swoole-and-functions' of github.com:appwrite/appwrite into swoole-and-functions
This commit is contained in:
commit
ccf5300906
720 changed files with 44697 additions and 28329 deletions
|
|
@ -6,4 +6,5 @@ public/styles
|
|||
.git
|
||||
.idea
|
||||
.cd .babelrc
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
debug
|
||||
23
.env
Normal file
23
.env
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
_APP_ENV=production
|
||||
_APP_ENV=development
|
||||
_APP_OPTIONS_ABUSE=disabled
|
||||
_APP_OPTIONS_FORCE_HTTPS=disabled
|
||||
_APP_OPENSSL_KEY_V1=your-secret-key
|
||||
_APP_DOMAIN=demo.appwrite.io
|
||||
_APP_DOMAIN_TARGET=demo.appwrite.io
|
||||
_APP_REDIS_HOST=redis
|
||||
_APP_REDIS_PORT=6379
|
||||
_APP_DB_HOST=mariadb
|
||||
_APP_DB_PORT=3306
|
||||
_APP_DB_SCHEMA=appwrite
|
||||
_APP_DB_USER=user
|
||||
_APP_DB_PASS=password
|
||||
_APP_INFLUXDB_HOST=influxdb
|
||||
_APP_INFLUXDB_PORT=8086
|
||||
_APP_STATSD_HOST=telegraf
|
||||
_APP_STATSD_PORT=8125
|
||||
_APP_SMTP_HOST=maildev
|
||||
_APP_SMTP_PORT=25
|
||||
_APP_STORAGE_LIMIT=10000000
|
||||
_APP_FUNCTIONS_TIMEOUT=900
|
||||
_APP_FUNCTIONS_CONTAINERS=10
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,12 +1,7 @@
|
|||
/.vscode/
|
||||
/vendor/
|
||||
/node_modules/
|
||||
/storage/uploads/
|
||||
/storage/cache
|
||||
/storage/db
|
||||
/storage/influxdb
|
||||
/tests/resources/storage/
|
||||
/.idea/
|
||||
.DS_Store
|
||||
.php_cs.cache
|
||||
.env
|
||||
.php_cs.cache
|
||||
10
.travis.yml
10
.travis.yml
|
|
@ -14,6 +14,12 @@ notifications:
|
|||
services:
|
||||
- docker
|
||||
|
||||
before_install:
|
||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
||||
- sudo apt-get update
|
||||
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
|
||||
|
||||
# cache:
|
||||
# directories:
|
||||
# - docker_images
|
||||
|
|
@ -25,9 +31,11 @@ services:
|
|||
# - docker save -o docker_images/images.tar appwrite_appwrite
|
||||
|
||||
install:
|
||||
- docker --version
|
||||
- docker-compose up -d
|
||||
- sleep 90
|
||||
|
||||
script:
|
||||
- docker ps
|
||||
- docker exec appwrite test
|
||||
- docker-compose logs appwrite
|
||||
- docker exec appwrite test
|
||||
32
CHANGES.md
32
CHANGES.md
|
|
@ -19,6 +19,32 @@
|
|||
- Upgraded ClamAV container image to version 1.0.11 ([#412](https://github.com/appwrite/appwrite/issues/412))
|
||||
- Optimised function execution by using fully-qualified function calls
|
||||
- Added support for boolean 'true' and 'false' in query strings alongside 1 and 0
|
||||
- Added pagination for projects list on the console home page.
|
||||
- Updated storage calculation to match IEC standards
|
||||
- Now using Alpine as base Docker image
|
||||
- Upgraded device detctor to version 3.12.6
|
||||
- Upgraded MariaDB to version 10.5.5
|
||||
- User name max length is now 128 chars and not 100 for better API consistency
|
||||
- Team name max length is now 128 chars and not 100 for better API consistency
|
||||
- Collection name max length is now 128 chars and not 256 for better API consistency
|
||||
- Project name max length is now 128 chars and not 100 for better API consistency
|
||||
- Webhook name max length is now 128 chars and not 256 for better API consistency
|
||||
- API Key name max length is now 128 chars and not 256 for better API consistency
|
||||
- Task name max length is now 128 chars and not 256 for better API consistency
|
||||
- Platform name max length is now 128 chars and not 256 for better API consistency
|
||||
- Webhooks payloads are now exactly the same as any of the API response objects
|
||||
- New and consistent response format for all API object + new response examples in the docs
|
||||
- Removed user roles attribute from user object (can be fetched from /v1/teams/memberships) **
|
||||
- Removed type attribute from session object response (used only internally)
|
||||
- ** - might be changed before merging to master
|
||||
|
||||
## Breaking Changes (Read before upgrading!)
|
||||
- **Deprecated** `first` and `last` query params for documents list route in the database API
|
||||
- **Deprecated** Deprectaed Pubjabi Translations ('pn')
|
||||
- **Deprecated** `PATCH /account/prefs` is now updating the prefs payload and not just merging it
|
||||
- **Deprecated** `PATCH /users/:userId/prefs` is now updating the prefs payload and not just merging it
|
||||
- Switched order of limit and offset params in all the SDKs `listDocuments` method for better consistency
|
||||
- Default `limit` param value in all the SDKs `listDocuments` method is now 25 for better consistency
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
|
|
@ -41,15 +67,13 @@
|
|||
- New OAuth adapter for PayPal sandbox
|
||||
- Fixed a bug making read permission overwrite write permission in some cases
|
||||
|
||||
## Breaking Changes
|
||||
- **Deprecated** `first` and `last` query params for documents list route in the database API
|
||||
- **Deprecated** Deprectaed Pubjabi Translations ('pn')
|
||||
|
||||
## Security
|
||||
|
||||
- Access to Health API now requires authentication with an API Key with access to `health.read` scope allowed
|
||||
- Added option to force HTTPS connection to the Appwrite server (_APP_OPTIONS_FORCE_HTTPS)
|
||||
- Now using your `_APP_SYSTEM_EMAIL_ADDRESS` as the email address for issuing and renewing SSL certificates
|
||||
- Block iframe access to Appwrite console using the `X-Frame-Options` header.
|
||||
- Fixed `roles` param input validator
|
||||
|
||||
# Version 0.6.2 (PRE-RELEASE)
|
||||
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ When contributing code, please take into account the following considerations:
|
|||
|
||||
Security and privacy are extremely important to Appwrite, developers, and users alike. Make sure to follow the best industry standards and practices.
|
||||
|
||||
<!-- To help you make sure you are doing as best as possible, we have set up our security checklist for pull requests and contributors. Please make sure to follow the list before sending a pull request. -->
|
||||
|
||||
## Dependencies
|
||||
|
||||
Please avoid introducing new dependencies to Appwrite without consulting the team. New dependencies can be very helpful but also introduce new security and privacy issues, complexity, and impact total docker image size.
|
||||
|
|
@ -124,7 +122,7 @@ This is also important for the Appwrite lead developers to be able to give techn
|
|||
To build a new version of the Appwrite server, all you need to do is run the build.sh file like this:
|
||||
|
||||
```bash
|
||||
bash ./build.sh 1.0.0
|
||||
bash ./build.sh X.X.X
|
||||
```
|
||||
|
||||
Before running the command, make sure you have proper write permissions to the Appwrite docker hub team.
|
||||
|
|
@ -143,6 +141,27 @@ To run tests manually, use the Appwrite Docker CLI from your terminal:
|
|||
docker exec appwrite test
|
||||
```
|
||||
|
||||
## Benchmarking
|
||||
|
||||
You can use WRK Docker image to benchmark the server performance. Benchmarking is extremely useful when you want to compare how the server behaves before and after a change has been applied. Replace [APPWRITE_HOSTNAME_OR_IP] with your Appwrite server hostname or IP. Note that localhost is not accessible from inside the WRK container.
|
||||
|
||||
```
|
||||
Options:
|
||||
-c, --connections <N> Connections to keep open
|
||||
-d, --duration <T> Duration of test
|
||||
-t, --threads <N> Number of threads to use
|
||||
|
||||
-s, --script <S> Load Lua script file
|
||||
-H, --header <H> Add header to request
|
||||
--latency Print latency statistics
|
||||
--timeout <T> Socket/request timeout
|
||||
-v, --version Print version details
|
||||
```
|
||||
|
||||
```bash
|
||||
docker run --rm skandyla/wrk -t3 -c100 -d30 https://[APPWRITE_HOSTNAME_OR_IP]
|
||||
```
|
||||
|
||||
## Code Maintenance
|
||||
|
||||
We use some automation tools to help us keep a healthy code base.
|
||||
|
|
|
|||
221
Dockerfile
Normal file → Executable file
221
Dockerfile
Normal file → Executable file
|
|
@ -1,56 +1,65 @@
|
|||
FROM ubuntu:18.04 AS builder
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
FROM composer:2.0 as step0
|
||||
|
||||
ARG TESTING=false
|
||||
|
||||
ENV TZ=Asia/Tel_Aviv \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
PHP_VERSION=7.4 \
|
||||
PHP_REDIS_VERSION=5.2.1
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl && \
|
||||
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests make php$PHP_VERSION php$PHP_VERSION-dev zip unzip php$PHP_VERSION-zip && \
|
||||
# Redis Extension
|
||||
wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \
|
||||
tar -xf $PHP_REDIS_VERSION.tar.gz && \
|
||||
cd phpredis-$PHP_REDIS_VERSION && \
|
||||
phpize$PHP_VERSION && \
|
||||
./configure && \
|
||||
make && \
|
||||
# Composer
|
||||
wget https://getcomposer.org/composer.phar && \
|
||||
chmod +x ./composer.phar && \
|
||||
mv ./composer.phar /usr/bin/composer && \
|
||||
#Brotli
|
||||
cd / && \
|
||||
git clone https://github.com/eustas/ngx_brotli.git && \
|
||||
cd ngx_brotli && git submodule update --init && cd ..
|
||||
ENV TESTING=$TESTING
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
# Updating PHP Dependencies and Auto-loading...
|
||||
|
||||
ENV TESTING=$TESTING
|
||||
|
||||
COPY composer.* /usr/local/src/
|
||||
COPY composer.lock /usr/local/src/
|
||||
COPY composer.json /usr/local/src/
|
||||
|
||||
RUN composer update --ignore-platform-reqs --optimize-autoloader \
|
||||
--no-plugins --no-scripts --prefer-dist \
|
||||
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
|
||||
|
||||
FROM ubuntu:18.04
|
||||
FROM php:7.4-cli-alpine as step1
|
||||
|
||||
ENV TZ=Asia/Tel_Aviv \
|
||||
PHP_REDIS_VERSION=5.3.1 \
|
||||
PHP_SWOOLE_VERSION=4.5.3 \
|
||||
PHP_XDEBUG_VERSION=sdebug_2_9-beta
|
||||
|
||||
RUN \
|
||||
apk add --no-cache --virtual .deps \
|
||||
make \
|
||||
automake \
|
||||
autoconf \
|
||||
gcc \
|
||||
g++ \
|
||||
tar \
|
||||
wget \
|
||||
git \
|
||||
zlib-dev \
|
||||
brotli-dev
|
||||
|
||||
RUN docker-php-ext-install sockets
|
||||
|
||||
RUN \
|
||||
# Redis Extension
|
||||
wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \
|
||||
tar -xf $PHP_REDIS_VERSION.tar.gz && \
|
||||
cd phpredis-$PHP_REDIS_VERSION && \
|
||||
phpize && \
|
||||
./configure && \
|
||||
make && make install && \
|
||||
cd .. && \
|
||||
## Swoole Extension
|
||||
git clone https://github.com/swoole/swoole-src.git && \
|
||||
cd swoole-src && \
|
||||
git checkout v$PHP_SWOOLE_VERSION && \
|
||||
phpize && \
|
||||
./configure --enable-sockets --enable-http2 && \
|
||||
make && make install && \
|
||||
cd ..
|
||||
|
||||
FROM php:7.4-cli-alpine as final
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
ARG VERSION=dev
|
||||
|
||||
ENV TZ=Asia/Tel_Aviv \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
PHP_VERSION=7.4 \
|
||||
_APP_SERVER=swoole \
|
||||
_APP_ENV=production \
|
||||
_APP_DOMAIN=localhost \
|
||||
_APP_DOMAIN_TARGET=localhost \
|
||||
|
|
@ -59,7 +68,7 @@ ENV TZ=Asia/Tel_Aviv \
|
|||
_APP_OPTIONS_ABUSE=enabled \
|
||||
_APP_OPTIONS_FORCE_HTTPS=disabled \
|
||||
_APP_OPENSSL_KEY_V1=your-secret-key \
|
||||
_APP_STORAGE_LIMIT=104857600 \
|
||||
_APP_STORAGE_LIMIT=10000000 \
|
||||
_APP_STORAGE_ANTIVIRUS=enabled \
|
||||
_APP_REDIS_HOST=redis \
|
||||
_APP_REDIS_PORT=6379 \
|
||||
|
|
@ -74,106 +83,92 @@ ENV TZ=Asia/Tel_Aviv \
|
|||
_APP_STATSD_PORT=8125 \
|
||||
_APP_SMTP_HOST=smtp \
|
||||
_APP_SMTP_PORT=25 \
|
||||
_APP_FUNCTIONS_TIMEOUT=900 \
|
||||
_APP_FUNCTIONS_CONTAINERS=10 \
|
||||
_APP_SETUP=self-hosted \
|
||||
_APP_VERSION=$VERSION
|
||||
#ENV _APP_SMTP_SECURE ''
|
||||
#ENV _APP_SMTP_USERNAME ''
|
||||
#ENV _APP_SMTP_PASSWORD ''
|
||||
|
||||
COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/
|
||||
COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/
|
||||
COPY --from=builder /ngx_brotli /ngx_brotli
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests wget ca-certificates software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev openssl gnupg htop supervisor && \
|
||||
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \
|
||||
add-apt-repository universe && \
|
||||
add-apt-repository ppa:certbot/certbot && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests php$PHP_VERSION php$PHP_VERSION-fpm \
|
||||
php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom webp certbot && \
|
||||
# Nginx
|
||||
wget http://nginx.org/download/nginx-1.19.0.tar.gz && \
|
||||
tar -xzvf nginx-1.19.0.tar.gz && rm nginx-1.19.0.tar.gz && \
|
||||
cd nginx-1.19.0 && \
|
||||
./configure --prefix=/usr/share/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/run/nginx.pid \
|
||||
--lock-path=/var/lock/nginx.lock \
|
||||
--user=www-data \
|
||||
--group=www-data \
|
||||
--build=Ubuntu \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_v2_module \
|
||||
--add-module=/ngx_brotli && \
|
||||
make && \
|
||||
make install && \
|
||||
rm -rf ../nginx-1.19.0 && \
|
||||
# Redis Extension
|
||||
echo extension=redis.so >> /etc/php/$PHP_VERSION/fpm/conf.d/redis.ini && \
|
||||
echo extension=redis.so >> /etc/php/$PHP_VERSION/cli/conf.d/redis.ini && \
|
||||
# Cleanup
|
||||
cd ../ && \
|
||||
apt-get purge -y --auto-remove wget software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev gnupg && \
|
||||
apt-get clean && \
|
||||
rm -rf /ngx_brotli && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
apk update \
|
||||
&& apk add --no-cache --virtual .deps \
|
||||
make \
|
||||
automake \
|
||||
autoconf \
|
||||
gcc \
|
||||
g++ \
|
||||
curl-dev \
|
||||
&& apk add --no-cache \
|
||||
libstdc++ \
|
||||
yaml-dev \
|
||||
imagemagick \
|
||||
imagemagick-dev \
|
||||
certbot \
|
||||
docker-cli \
|
||||
&& pecl install imagick yaml \
|
||||
&& docker-php-ext-enable imagick yaml \
|
||||
&& docker-php-ext-install sockets opcache pdo_mysql \
|
||||
&& apk del .deps
|
||||
|
||||
# Set Upload Limit (default to 100MB)
|
||||
RUN echo "upload_max_filesize = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
RUN echo "post_max_size = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
WORKDIR /usr/src/code
|
||||
|
||||
# Add logs file
|
||||
RUN echo "" >> /var/log/appwrite.log
|
||||
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||
|
||||
# Nginx Configuration (with self-signed ssl certificates)
|
||||
COPY ./docker/nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem
|
||||
COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem
|
||||
|
||||
# PHP Configuration
|
||||
RUN mkdir -p /var/run/php
|
||||
COPY ./docker/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
|
||||
|
||||
# Add PHP Source Code
|
||||
COPY ./app /usr/share/nginx/html/app
|
||||
# Add Source Code
|
||||
COPY ./app /usr/src/code/app
|
||||
COPY ./bin /usr/local/bin
|
||||
COPY ./docs /usr/share/nginx/html/docs
|
||||
COPY ./public /usr/share/nginx/html/public
|
||||
COPY ./src /usr/share/nginx/html/src
|
||||
COPY --from=builder /usr/local/src/vendor /usr/share/nginx/html/vendor
|
||||
COPY ./docs /usr/src/code/docs
|
||||
COPY ./public /usr/src/code/public
|
||||
COPY ./src /usr/src/code/src
|
||||
|
||||
# Set Volumes
|
||||
RUN mkdir -p /storage/uploads && \
|
||||
mkdir -p /storage/cache && \
|
||||
mkdir -p /storage/config && \
|
||||
mkdir -p /storage/certificates && \
|
||||
mkdir -p /storage/functions && \
|
||||
mkdir -p /storage/debug && \
|
||||
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
|
||||
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
|
||||
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
|
||||
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates
|
||||
|
||||
# Supervisord Conf
|
||||
COPY ./docker/supervisord.conf /etc/supervisord.conf
|
||||
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
|
||||
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
|
||||
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
|
||||
|
||||
# Executables
|
||||
RUN chmod +x /usr/local/bin/start
|
||||
RUN chmod +x /usr/local/bin/doctor
|
||||
RUN chmod +x /usr/local/bin/migrate
|
||||
RUN chmod +x /usr/local/bin/test
|
||||
RUN chmod +x /usr/local/bin/doctor && \
|
||||
chmod +x /usr/local/bin/install && \
|
||||
chmod +x /usr/local/bin/migrate && \
|
||||
chmod +x /usr/local/bin/schedule && \
|
||||
chmod +x /usr/local/bin/ssl && \
|
||||
chmod +x /usr/local/bin/test && \
|
||||
chmod +x /usr/local/bin/vars && \
|
||||
chmod +x /usr/local/bin/worker-audits && \
|
||||
chmod +x /usr/local/bin/worker-certificates && \
|
||||
chmod +x /usr/local/bin/worker-deletes && \
|
||||
chmod +x /usr/local/bin/worker-functions && \
|
||||
chmod +x /usr/local/bin/worker-mails && \
|
||||
chmod +x /usr/local/bin/worker-tasks && \
|
||||
chmod +x /usr/local/bin/worker-usage && \
|
||||
chmod +x /usr/local/bin/worker-webhooks
|
||||
|
||||
# Letsencrypt Permissions
|
||||
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||
|
||||
# Enable Extensions
|
||||
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
|
||||
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
|
||||
|
||||
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
WORKDIR /usr/share/nginx/html
|
||||
|
||||
CMD ["/bin/bash", "/usr/local/bin/start"]
|
||||
CMD [ "php", "app/http.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
|
||||
|
|
|
|||
185
Dockerfile.nginx
Normal file
185
Dockerfile.nginx
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
FROM ubuntu:18.04 AS builder
|
||||
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
ARG TESTING=false
|
||||
|
||||
ENV TZ=Asia/Tel_Aviv \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
PHP_VERSION=7.4 \
|
||||
PHP_REDIS_VERSION=5.2.1
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl && \
|
||||
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests make php$PHP_VERSION php$PHP_VERSION-dev zip unzip php$PHP_VERSION-zip && \
|
||||
# Redis Extension
|
||||
wget -q https://github.com/phpredis/phpredis/archive/$PHP_REDIS_VERSION.tar.gz && \
|
||||
tar -xf $PHP_REDIS_VERSION.tar.gz && \
|
||||
cd phpredis-$PHP_REDIS_VERSION && \
|
||||
phpize$PHP_VERSION && \
|
||||
./configure && \
|
||||
make && \
|
||||
# Composer
|
||||
wget https://getcomposer.org/composer.phar && \
|
||||
chmod +x ./composer.phar && \
|
||||
mv ./composer.phar /usr/bin/composer && \
|
||||
#Brotli
|
||||
cd / && \
|
||||
git clone https://github.com/eustas/ngx_brotli.git && \
|
||||
cd ngx_brotli && git submodule update --init && cd ..
|
||||
|
||||
WORKDIR /usr/local/src/
|
||||
|
||||
# Updating PHP Dependencies and Auto-loading...
|
||||
|
||||
ENV TESTING=$TESTING
|
||||
|
||||
COPY composer.* /usr/local/src/
|
||||
|
||||
RUN composer update --ignore-platform-reqs --optimize-autoloader \
|
||||
--no-plugins --no-scripts --prefer-dist \
|
||||
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
|
||||
|
||||
FROM ubuntu:18.04
|
||||
LABEL maintainer="team@appwrite.io"
|
||||
|
||||
ARG VERSION=dev
|
||||
|
||||
ENV TZ=Asia/Tel_Aviv \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
PHP_VERSION=7.4 \
|
||||
_APP_SERVER=nginx \
|
||||
_APP_ENV=production \
|
||||
_APP_DOMAIN=localhost \
|
||||
_APP_DOMAIN_TARGET=localhost \
|
||||
_APP_HOME=https://appwrite.io \
|
||||
_APP_EDITION=community \
|
||||
_APP_OPTIONS_ABUSE=enabled \
|
||||
_APP_OPTIONS_FORCE_HTTPS=disabled \
|
||||
_APP_OPENSSL_KEY_V1=your-secret-key \
|
||||
_APP_STORAGE_LIMIT=10000000 \
|
||||
_APP_STORAGE_ANTIVIRUS=enabled \
|
||||
_APP_REDIS_HOST=redis \
|
||||
_APP_REDIS_PORT=6379 \
|
||||
_APP_DB_HOST=mariadb \
|
||||
_APP_DB_PORT=3306 \
|
||||
_APP_DB_USER=root \
|
||||
_APP_DB_PASS=password \
|
||||
_APP_DB_SCHEMA=appwrite \
|
||||
_APP_INFLUXDB_HOST=influxdb \
|
||||
_APP_INFLUXDB_PORT=8086 \
|
||||
_APP_STATSD_HOST=telegraf \
|
||||
_APP_STATSD_PORT=8125 \
|
||||
_APP_SMTP_HOST=smtp \
|
||||
_APP_SMTP_PORT=25 \
|
||||
_APP_SETUP=self-hosted \
|
||||
_APP_VERSION=$VERSION
|
||||
#ENV _APP_SMTP_SECURE ''
|
||||
#ENV _APP_SMTP_USERNAME ''
|
||||
#ENV _APP_SMTP_PASSWORD ''
|
||||
|
||||
COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/
|
||||
COPY --from=builder /phpredis-5.2.1/modules/redis.so /usr/lib/php/20190902/
|
||||
COPY --from=builder /ngx_brotli /ngx_brotli
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests wget ca-certificates software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev openssl gnupg htop supervisor && \
|
||||
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && \
|
||||
add-apt-repository universe && \
|
||||
add-apt-repository ppa:certbot/certbot && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends --no-install-suggests php$PHP_VERSION php$PHP_VERSION-fpm \
|
||||
php$PHP_VERSION-mysqlnd php$PHP_VERSION-curl php$PHP_VERSION-imagick php$PHP_VERSION-mbstring php$PHP_VERSION-dom certbot && \
|
||||
# Nginx
|
||||
wget http://nginx.org/download/nginx-1.19.0.tar.gz && \
|
||||
tar -xzvf nginx-1.19.0.tar.gz && rm nginx-1.19.0.tar.gz && \
|
||||
cd nginx-1.19.0 && \
|
||||
./configure --prefix=/usr/share/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/run/nginx.pid \
|
||||
--lock-path=/var/lock/nginx.lock \
|
||||
--user=www-data \
|
||||
--group=www-data \
|
||||
--build=Ubuntu \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_v2_module \
|
||||
--add-module=/ngx_brotli && \
|
||||
make && \
|
||||
make install && \
|
||||
rm -rf ../nginx-1.19.0 && \
|
||||
# Redis Extension
|
||||
echo extension=redis.so >> /etc/php/$PHP_VERSION/fpm/conf.d/redis.ini && \
|
||||
echo extension=redis.so >> /etc/php/$PHP_VERSION/cli/conf.d/redis.ini && \
|
||||
# Cleanup
|
||||
cd ../ && \
|
||||
apt-get purge -y --auto-remove wget software-properties-common build-essential libpcre3-dev zlib1g-dev libssl-dev gnupg && \
|
||||
apt-get clean && \
|
||||
rm -rf /ngx_brotli && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set Upload Limit (default to 100MB)
|
||||
RUN echo "upload_max_filesize = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
RUN echo "post_max_size = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
RUN echo "opcache.preload_user=www-data" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
RUN echo "opcache.enable_cli = 1" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
|
||||
|
||||
# Add logs file
|
||||
RUN echo "" >> /var/log/appwrite.log
|
||||
|
||||
# Nginx Configuration (with self-signed ssl certificates)
|
||||
COPY ./docker/nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem
|
||||
COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem
|
||||
|
||||
# PHP Configuration
|
||||
RUN mkdir -p /var/run/php
|
||||
COPY ./docker/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
|
||||
|
||||
# Add PHP Source Code
|
||||
COPY ./app /usr/src/code/app
|
||||
COPY ./bin /usr/local/bin
|
||||
COPY ./docs /usr/src/code/docs
|
||||
COPY ./public /usr/src/code/public
|
||||
COPY ./src /usr/src/code/src
|
||||
COPY --from=builder /usr/local/src/vendor /usr/src/code/vendor
|
||||
|
||||
RUN mkdir -p /storage/uploads && \
|
||||
mkdir -p /storage/cache && \
|
||||
mkdir -p /storage/config && \
|
||||
mkdir -p /storage/certificates && \
|
||||
mkdir -p /storage/functions && \
|
||||
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
|
||||
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
|
||||
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
|
||||
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
|
||||
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions
|
||||
|
||||
# Supervisord Conf
|
||||
COPY ./docker/supervisord.conf /etc/supervisord.conf
|
||||
|
||||
# Executables
|
||||
RUN chmod +x /usr/local/bin/start
|
||||
RUN chmod +x /usr/local/bin/doctor
|
||||
RUN chmod +x /usr/local/bin/migrate
|
||||
RUN chmod +x /usr/local/bin/test
|
||||
|
||||
# Letsencrypt Permissions
|
||||
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
WORKDIR /usr/src/code
|
||||
|
||||
CMD ["/bin/bash", "/usr/local/bin/start"]
|
||||
16
README.md
16
README.md
|
|
@ -50,9 +50,8 @@ The easiest way to start running your Appwrite server is by running our docker-c
|
|||
```bash
|
||||
docker run -it --rm \
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock \
|
||||
--volume "$(pwd)"/appwrite:/install/appwrite:rw \
|
||||
-e version=0.6.2 \
|
||||
appwrite/install
|
||||
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
|
||||
appwrite/appwrite:0.7.0
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
|
@ -62,9 +61,8 @@ docker run -it --rm \
|
|||
```cmd
|
||||
docker run -it --rm ^
|
||||
--volume //var/run/docker.sock:/var/run/docker.sock ^
|
||||
--volume "%cd%"/appwrite:/install/appwrite:rw ^
|
||||
-e version=0.6.2 ^
|
||||
appwrite/install
|
||||
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
|
||||
appwrite/appwrite:0.7.0
|
||||
```
|
||||
|
||||
#### PowerShell
|
||||
|
|
@ -72,9 +70,8 @@ docker run -it --rm ^
|
|||
```powershell
|
||||
docker run -it --rm ,
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock ,
|
||||
--volume ${pwd}/appwrite:/install/appwrite:rw ,
|
||||
-e version=0.6.2 ,
|
||||
appwrite/install
|
||||
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ,
|
||||
appwrite/appwrite:0.7.0
|
||||
```
|
||||
|
||||
Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-linux native hosts, the server might take a few minutes to start after installation completes.
|
||||
|
|
@ -99,6 +96,7 @@ Getting started with Appwrite is as easy as creating a new project, choosing you
|
|||
* [**Teams**](https://appwrite.io/docs/client/teams) - Manage and group users in teams. Manage memberships, invites, and user roles within a team.
|
||||
* [**Database**](https://appwrite.io/docs/client/database) - Manage database collections and documents. Read, create, update, and delete documents and filter lists of documents collections using an advanced filter with graph-like capabilities.
|
||||
* [**Storage**](https://appwrite.io/docs/client/storage) - Manage storage files. Read, create, delete, and preview files. Manipulate the preview of your files to fit your app perfectly. All files are scanned by ClamAV and stored in a secure and encrypted way.
|
||||
* [**Functions**](https://appwrite.io/docs/server/functions) - Customize your Appwrite server by executing your custom code in an isolate environment, you can trigger your code on any Appwrite system event, manually or using a CRON schedule.
|
||||
* [**Locale**](https://appwrite.io/docs/client/locale) - Track your user's location, and manage your app locale-based data.
|
||||
* [**Avatars**](https://appwrite.io/docs/client/avatars) - Manage your users' avatars, countries' flags, browser icons, credit card symbols, and generate QR codes.
|
||||
|
||||
|
|
|
|||
26
app/cli.php
Normal file
26
app/cli.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/env php
|
||||
<?php
|
||||
|
||||
require_once __DIR__.'/init.php';
|
||||
|
||||
use Utopia\App;
|
||||
use Utopia\CLI\CLI;
|
||||
use Utopia\CLI\Console;
|
||||
|
||||
$cli = new CLI();
|
||||
|
||||
include 'tasks/doctor.php';
|
||||
include 'tasks/install.php';
|
||||
include 'tasks/migrate.php';
|
||||
include 'tasks/sdks.php';
|
||||
include 'tasks/ssl.php';
|
||||
include 'tasks/vars.php';
|
||||
|
||||
$cli
|
||||
->task('version')
|
||||
->desc('Get the server version')
|
||||
->action(function () {
|
||||
Console::log(App::getEnv('_APP_VERSION', 'UNKNOWN'));
|
||||
});
|
||||
|
||||
$cli->run();
|
||||
File diff suppressed because it is too large
Load diff
46
app/config/environments.php
Normal file
46
app/config/environments.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'node-14' => [
|
||||
'name' => 'Node.js',
|
||||
'version' => '14.5',
|
||||
'base' => 'node:14.5-alpine',
|
||||
'image' => 'appwrite/env-node:14.5',
|
||||
'logo' => 'node.png',
|
||||
],
|
||||
'php-7.4' => [
|
||||
'name' => 'PHP',
|
||||
'version' => '7.4',
|
||||
'base' => 'php:7.4-cli-alpine',
|
||||
'image' => 'appwrite/env-php:7.4',
|
||||
'logo' => 'php.png',
|
||||
],
|
||||
'ruby-2.7' => [
|
||||
'name' => 'Ruby',
|
||||
'version' => '2.7',
|
||||
'base' => 'ruby:2.7-alpine',
|
||||
'image' => 'appwrite/env-ruby:2.7',
|
||||
'logo' => 'ruby.png',
|
||||
],
|
||||
'python-3.8' => [
|
||||
'name' => 'Python',
|
||||
'version' => '3.8',
|
||||
'base' => 'python:3.8-alpine',
|
||||
'image' => 'appwrite/env-python:3.8',
|
||||
'logo' => 'python.png',
|
||||
],
|
||||
'deno-1.2' => [
|
||||
'name' => 'Deno',
|
||||
'version' => '1.2',
|
||||
'base' => 'hayd/deno:alpine-1.2.0',
|
||||
'image' => 'appwrite/env-deno:1.2',
|
||||
'logo' => 'deno.png',
|
||||
],
|
||||
// 'dart-2.8' => [
|
||||
// 'name' => 'Dart',
|
||||
// 'version' => '2.8',
|
||||
// 'base' => 'google/dart:2.8',
|
||||
// 'image' => 'appwrite/env-dart:2.8',
|
||||
// 'logo' => 'dart.png',
|
||||
// ],
|
||||
];
|
||||
|
|
@ -55,4 +55,16 @@ return [
|
|||
'storage.files.delete' => [
|
||||
'description' => 'This event triggers when a storage file is deleted.',
|
||||
],
|
||||
'users.create' => [
|
||||
'description' => 'This event triggers when a user is created from the users API.',
|
||||
],
|
||||
'users.update.status' => [
|
||||
'description' => 'This event triggers when a user status is updated from the users API.',
|
||||
],
|
||||
'users.delete' => [
|
||||
'description' => 'This event triggers when a user is deleted from users API.',
|
||||
],
|
||||
'users.sessions.delete' => [
|
||||
'description' => 'This event triggers when a user session is deleted from users API.',
|
||||
],
|
||||
];
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue