-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from utopia-php/shmuel.1
Initialization mongo
- Loading branch information
Showing
8 changed files
with
1,150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/vendor/ | ||
/.idea/ | ||
.DS_Store | ||
mock.json | ||
data-tests.php | ||
loader.php | ||
.phpunit.result.cache | ||
/bin/view/results/ | ||
.vscode | ||
.vscode/* | ||
|
||
## - Oh Wess! | ||
Makefile | ||
.envrc | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
FROM composer:2.0 as composer | ||
|
||
ARG TESTING=false | ||
ENV TESTING=$TESTING | ||
|
||
WORKDIR /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 | ||
|
||
FROM php:8.0-cli-alpine as compile | ||
|
||
ENV PHP_REDIS_VERSION=5.3.4 \ | ||
PHP_SWOOLE_VERSION=v4.8.0 \ | ||
PHP_MONGO_VERSION=1.11.1 | ||
|
||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN \ | ||
apk update \ | ||
&& apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev \ | ||
&& docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
# Redis Extension | ||
FROM compile AS redis | ||
RUN \ | ||
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git \ | ||
&& cd phpredis \ | ||
&& phpize \ | ||
&& ./configure \ | ||
&& make && make install | ||
|
||
## Swoole Extension | ||
FROM compile AS swoole | ||
RUN \ | ||
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git \ | ||
&& cd swoole-src \ | ||
&& phpize \ | ||
&& ./configure --enable-http2 \ | ||
&& make && make install | ||
|
||
## MongoDB Extension | ||
FROM compile AS mongodb | ||
RUN \ | ||
git clone --depth 1 --branch $PHP_MONGO_VERSION https://github.com/mongodb/mongo-php-driver.git \ | ||
&& cd mongo-php-driver \ | ||
&& git submodule update --init \ | ||
&& phpize \ | ||
&& ./configure \ | ||
&& make && make install | ||
|
||
FROM compile as final | ||
|
||
LABEL maintainer="team@appwrite.io" | ||
|
||
WORKDIR /usr/src/code | ||
|
||
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini | ||
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini | ||
RUN echo extension=mongodb.so >> /usr/local/etc/php/conf.d/mongodb.ini | ||
|
||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
|
||
RUN echo "opcache.enable_cli=1" >> $PHP_INI_DIR/php.ini | ||
|
||
RUN echo "memory_limit=1024M" >> $PHP_INI_DIR/php.ini | ||
|
||
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor | ||
COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ | ||
COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20200930/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ | ||
COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20200930/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/ | ||
|
||
# Add Source Code | ||
COPY . /usr/src/code | ||
|
||
CMD [ "tail", "-f", "/dev/null" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "utopia-php/mongo", | ||
"description": "A simple library to manage Mongo database", | ||
"type": "library", | ||
"keywords": ["php","mongo", "upf", "utopia", "database"], | ||
"license": "MIT", | ||
"minimum-stability": "stable", | ||
"authors": [ | ||
{ | ||
"name": "Eldad Fux", | ||
"email": "eldad@appwrite.io" | ||
}, | ||
{ | ||
"name": "Wess", | ||
"email": "wess@appwrite.io" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": {"Utopia\\Mongo\\": "src/Mongo"} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": {"Utopia\\Tests\\": "tests/Mongo"} | ||
}, | ||
"require": { | ||
"php": ">=8.0", | ||
"ext-mongodb": "*", | ||
"mongodb/mongodb": "1.8.0" | ||
}, | ||
"require-dev": { | ||
"fakerphp/faker": "^1.14", | ||
"phpunit/phpunit": "^9.4", | ||
"swoole/ide-helper": "4.8.0", | ||
"utopia-php/cli": "^0.11.0", | ||
"vimeo/psalm": "4.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
version: '3.1' | ||
|
||
services: | ||
|
||
tests: | ||
container_name: tests | ||
build: | ||
context: . | ||
networks: | ||
- database | ||
volumes: | ||
- ./:/usr/src/code | ||
ports: | ||
- "8708:8708" | ||
|
||
adminer: | ||
image: adminer | ||
container_name: utopia-adminer | ||
restart: always | ||
ports: | ||
- "8760:8080" | ||
networks: | ||
- database | ||
|
||
postgres: | ||
image: postgres:13 | ||
container_name: utopia-postgres | ||
networks: | ||
- database | ||
ports: | ||
- "8700:5432" | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: password | ||
|
||
cockroach: | ||
image: cockroachdb/cockroach:v20.2.0 | ||
container_name: utopia-cockroach | ||
command: start-single-node --insecure --logtostderr | ||
networks: | ||
- database | ||
ports: | ||
- "8704:26257" | ||
- "8705:8080" | ||
|
||
mariadb: | ||
image: mariadb:10.5 | ||
container_name: utopia-mariadb | ||
networks: | ||
- database | ||
ports: | ||
- "8701:3306" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=password | ||
|
||
mongo: | ||
image: mongo:4.4 | ||
container_name: utopia-mongo | ||
networks: | ||
- database | ||
ports: | ||
- "8702:27017" | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: root | ||
MONGO_INITDB_ROOT_PASSWORD: example | ||
|
||
mysql: | ||
image: mysql:8.0.28-oracle | ||
container_name: utopia-mysql | ||
networks: | ||
- database | ||
ports: | ||
- "8703:3307" | ||
environment: | ||
MYSQL_ROOT_PASSWORD: password | ||
MYSQL_DATABASE: default | ||
MYSQL_USER: user | ||
MYSQL_PASSWORD: password | ||
MYSQL_TCP_PORT: 3307 | ||
cap_add: | ||
- SYS_NICE | ||
|
||
redis: | ||
image: redis:6.0-alpine | ||
container_name: utopia-redis | ||
networks: | ||
- database | ||
|
||
networks: | ||
database: |
Oops, something went wrong.