我们的开发人员在sudo-demo阶段将我们的项目交给了我们,我正试图在我的本地开发机器上设置环境。容器化对我来说是新的,但我正在弄清楚它。
我有四个泊坞容器:
CONTAINER ID - name - ports
ce05f4675d70 - laradock_nginx_1 - 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
bd900f08e9b3 - laradock_php-fpm_1 - 9000/tcp
75a7aa1698de - laradock_workspace_1 - 0.0.0.0:2222->22/tcp
1d8c69a06ae4 - laradock_mongo_1 - 0.0.0.0:27017->27017/tcp
我的应用程序位于yellowcard.app,api位于api.yellowcard.app,这是在我的主机文件中设置的。
所有四个容器都已启动并运行,但我的所有api调用都会生成500个响应代码。我不能为我的生活弄清楚什么是错的。
Mongodb记录
2017-07-28T07:13:51.034+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=1d8c69a06ae4
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] db version v3.4.6
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] modules: none
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] build environment:
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] distmod: debian81
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] distarch: x86_64
2017-07-28T07:13:51.040+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-07-28T07:13:51.041+0000 I CONTROL [initandlisten] options: {}
2017-07-28T07:13:51.041+0000 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2017-07-28T07:13:51.119+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-07-28T07:13:51.119+0000 W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
2017-07-28T07:13:51.119+0000 I STORAGE [initandlisten]
2017-07-28T07:13:51.119+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-07-28T07:13:51.119+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-07-28T07:13:51.119+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7501M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten]
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten]
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten]
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2017-07-28T07:13:52.097+0000 I CONTROL [initandlisten]
2017-07-28T07:13:52.210+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2017-07-28T07:13:52.210+0000 I NETWORK [thread1] waiting for connections on port 27017
2017-07-28T07:13:53.040+0000 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
这似乎很好。
工作区日志
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
Jul 28 07:06:41 75a7aa1698de syslog-ng[14]: syslog-ng starting up; version='3.5.6'
Jul 28 07:09:01 75a7aa1698de CRON[21]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
Jul 28 07:17:01 75a7aa1698de CRON[51]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
正常工作。不知道这究竟是什么。但它似乎还可以。
PHP-FPM日志
[28-Jul-2017 07:06:42] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/sqlsrv.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/sqlsrv.so: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Jul-2017 07:06:42] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/pdo_sqlsrv.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/pdo_sqlsrv.so: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Jul-2017 07:06:42] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so: cannot open shared object file: No such file or directory in Unknown on line 0
[28-Jul-2017 07:06:42] NOTICE: fpm is running, pid 1
[28-Jul-2017 07:06:42] NOTICE: ready to handle connections
NGINX Container没有实质性的日志。只是请求
PHP-FPM容器当然似乎是罪魁祸首,但我无法弄明白。
php -m
[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mongodb
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
很明显已经安装了Mongodb,所以我不确定为什么我会遇到mongodb.so的问题。
/ laradock
adminer
beanstalkd-console
composer.lock
elasticsearch
haproxy
logs
memcached
mysql
php-fpm
postgres-postgis
redis
vendor
aerospike
caddy
docker-compose.yml
enabled
hhvm
log.txt
minio
neo4j
phpmyadmin
rabbitmq
rethinkdb
workspace
apache2
certbot
docs
env-env.txt
jenkins
mailhog
mongo
nginx
php-worker
README.md
selenium
xdebugPhpFpm
beanstalkd
composer.json
DOCUMENTATION
_guides
LICENSE
mariadb
mssql
pgadmin
postgres
README-zh.md
varnish
/ laradock / PHP-FPM
aerospike.ini
Dockerfile-56
Dockerfile-70
Dockerfile-71
laravel.ini
laravel.pool.conf
mysql.ini
opcache.ini
xdebug.ini
laravel.ini
date.timezone=UTC
display_errors=on
log_errors=On
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 20M
; Sets max size of post data allowed.
; http://php.net/post-max-size
post_max_size = 20M
; Enables the MSSQL extensions
extension=sqlsrv.so
extension=pdo_sqlsrv.so
extension=mongodb.so
Dockerfile-70
#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#
# To edit the 'php-fpm' base Image, visit its repository on Github
# https://github.com/LaraDock/php-fpm
#
# To change its version, see the available Tags on the Docker Hub:
# https://hub.docker.com/r/laradock/php-fpm/tags/
#
FROM laradock/php-fpm:7.0--1.2
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
#
#--------------------------------------------------------------------------
# Mandatory Software's Installation
#--------------------------------------------------------------------------
#
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
# are installed on the base image 'laradock/php-fpm' image. If you want
# to add more Software's or remove existing one, you need to edit the
# base image (https://github.com/LaraDock/php-fpm).
#
#
#--------------------------------------------------------------------------
# Optional Software's Installation
#--------------------------------------------------------------------------
#
# Optional Software's will only be installed if you set them to `true`
# in the `docker-compose.yml` before the build.
# Example:
# - INSTALL_ZIP_ARCHIVE=true
#
#####################################
# SOAP:
#####################################
ARG INSTALL_SOAP=false
RUN if [ ${INSTALL_SOAP} = true ]; then \
# Install the soap extension
apt-get -y update && \
apt-get -y install libxml2-dev php-soap && \
docker-php-ext-install soap \
;fi
#####################################
# xDebug:
#####################################
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension
pecl install xdebug && \
docker-php-ext-enable xdebug \
;fi
# Copy xdebug configration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
#####################################
# PHP REDIS EXTENSION FOR PHP 7
#####################################
ARG INSTALL_PHPREDIS=false
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis Extension
pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi
#####################################
# MongoDB:
#####################################
ARG INSTALL_MONGO=false
RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension
pecl install mongodb && \
docker-php-ext-enable mongodb \
;fi
#####################################
# ZipArchive:
#####################################
ARG INSTALL_ZIP_ARCHIVE=false
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension
docker-php-ext-install zip \
;fi
#####################################
# bcmath:
#####################################
ARG INSTALL_BCMATH=false
RUN if [ ${INSTALL_BCMATH} = true ]; then \
# Install the bcmath extension
docker-php-ext-install bcmath \
;fi
#####################################
# PHP Memcached:
#####################################
ARG INSTALL_MEMCACHED=false
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Install the php memcached extension
curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
&& mkdir -p memcached \
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
&& ( \
cd memcached \
&& phpize \
&& ./configure \
&& make -j$(nproc) \
&& make install \
) \
&& rm -r memcached \
&& rm /tmp/memcached.tar.gz \
&& docker-php-ext-enable memcached \
;fi
#####################################
# Exif:
#####################################
ARG INSTALL_EXIF=false
RUN if [ ${INSTALL_EXIF} = true ]; then \
# Enable Exif PHP extentions requirements
docker-php-ext-install exif \
;fi
#####################################
# PHP Aerospike:
#####################################
ARG INSTALL_AEROSPIKE_EXTENSION=false
ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
# Copy aerospike configration for remote debugging
COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini
RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
# Install the php aerospike extension
curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \
&& mkdir -p aerospike-client-php \
&& tar -C aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \
&& ( \
cd aerospike-client-php/src/aerospike \
&& phpize \
&& ./build.sh \
&& make install \
) \
&& rm /tmp/aerospike-client-php.tar.gz \
&& docker-php-ext-enable aerospike \
;fi
#####################################
# Opcache:
#####################################
ARG INSTALL_OPCACHE=false
RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache \
;fi
# Copy opcache configration
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
#####################################
# Mysqli Modifications:
#####################################
ARG INSTALL_MYSQLI=false
RUN if [ ${INSTALL_MYSQLI} = true ]; then \
docker-php-ext-install mysqli \
;fi
#####################################
# Tokenizer Modifications:
#####################################
ARG INSTALL_TOKENIZER=false
RUN if [ ${INSTALL_TOKENIZER} = true ]; then \
docker-php-ext-install tokenizer \
;fi
#####################################
# SQL SERVER:
#####################################
ARG MSSQL=false
RUN if [ ${MSSQL} = true ]; then \
#####################################
# Install Depenencies:
#####################################
apt-get update && \
apt-get install -y --force-yes wget apt-transport-https curl freetds-common php5-odbc libsybdb5 freetds-bin unixodbc unixodbc-dev php5-sybase && \
#####################################
# The following steps were taken from
# Microsoft's github account:
# https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-getting-pdo_sqlsrv-for-PHP-7.0-on-Debian-in-3-ways
#####################################
# Add PHP 7 repository
# for Debian jessie
# And System upgrade
echo "deb http://packages.dotdeb.org jessie all" \
| tee /etc/apt/sources.list.d/dotdeb.list \
&& wget -qO- https://www.dotdeb.org/dotdeb.gpg \
| apt-key add - \
&& apt-get update \
&& apt-get upgrade -qq && \
# Install UnixODBC
# Compile odbc_config as it is not part of unixodbc package
apt-get install -y whiptail \
unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev \
&& dget -u -x http://http.debian.net/debian/pool/main/u/unixodbc/unixodbc_2.3.1-3.dsc \
&& cd unixodbc-*/ \
&& dpkg-buildpackage -uc -us -B -d \
&& cp -v ./exe/odbc_config /usr/local/bin/ && \
# Fake uname for install.sh
printf '#!/bin/bash\nif [ "$*" == "-p" ]; then echo "x86_64"; else /bin/uname "$@"; fi' \
| tee /usr/local/bin/uname \
&& chmod +x /usr/local/bin/uname && \
# Microsoft ODBC Driver 13 for Linux
# Note: There's a copy of this tar on my hubiC
wget -nv -O msodbcsql-13.0.0.0.tar.gz \
"https://meetsstorenew.blob.core.windows.net/contianerhd/Ubuntu%2013.0%20Tar/msodbcsql-13.0.0.0.tar.gz?st=2016-10-18T17%3A29%3A00Z&se=2022-10-19T17%3A29%3A00Z&sp=rl&sv=2015-04-05&sr=b&sig=cDwPfrouVeIQf0vi%2BnKt%2BzX8Z8caIYvRCmicDL5oknY%3D" \
&& tar -xf msodbcsql-13.0.0.0.tar.gz \
&& cd msodbcsql-*/ \
&& ldd lib64/libmsodbcsql-13.0.so.0.0 \
&& ./install.sh install --accept-license \
&& ls -l /opt/microsoft/msodbcsql/ \
&& odbcinst -q -d -n "ODBC Driver 13 for SQL Server" \
#####################################
# Install pdo_dblib
#####################################
&& docker-php-ext-install pdo \
&& docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \
&& docker-php-ext-install pdo_dblib \
&& docker-php-ext-enable pdo_dblib && \
#####################################
# Install sqlsrv y pdo_sqlsrv
# extensions:
#####################################
pecl install sqlsrv-4.0.6 && \
pecl install pdo_sqlsrv-4.0.6 && \
#####################################
# Set locales for the container
#####################################
apt-get install -y locales \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& locale-gen \
;fi
#####################################
# Human Language and Character Encoding Support:
#####################################
ARG INSTALL_INTL=false
RUN if [ ${INSTALL_INTL} = true ]; then \
# Install intl and requirements
apt-get install -y zlib1g-dev libicu-dev g++ && \
docker-php-ext-configure intl && \
docker-php-ext-install intl \
;fi
#####################################
# GHOSTSCRIPT:
#####################################
ARG INSTALL_GHOSTSCRIPT=false
RUN if [ ${GHOSTSCRIPT} = true ]; then \
# Install the ghostscript extension
# for PDF editing
apt-get -y update \
&& apt-get install -y \
poppler-utils \
ghostscript \
;fi
#
#--------------------------------------------------------------------------
# Final Touch
#--------------------------------------------------------------------------
#
ARG CATCH_WORKERS_OUTPUT=yes
ADD ./laravel.ini /usr/local/etc/php/conf.d
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
RUN rm -r /var/lib/apt/lists/*
RUN usermod -u 1000 www-data
WORKDIR /var/www
CMD ["php-fpm"]
EXPOSE 9000
关于可能出现什么问题的任何想法或我可以采取哪些步骤来获取更多信息?
感谢。
[更新]
我现在能够在访问api.yellowcard.app时看到调试器 我不知道是什么造成了这种变化。虽然加载页面时不再获得500状态代码。
grep -Rl no-debug-non-zts-20151012/mongodb.so
除了日志外,似乎没有在任何容器上找到它。