I've deployed my Symfony 2.1 application on openshift and it doesn't work.
Calling app.php server return 200 OK and a white page (in my local server work well).
Log:
=> php-5.3/logs/error_log-20130306-000000-EST <== [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 3. require_once()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/bootstrap.php.cache:4
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 4.
require()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/autoload.php:5
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 5.
ComposerAutoloaderInit12cecca862685bdd480babbdd1b1ec7a::getLoader()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/autoload.php:7
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP Fatal
error: require(): Failed opening required
'/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/kriswallsmith/assetic/src/functions.php' (include_path='.:/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo//libs/:/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/php-5.3/phplib/pear/pear/php/:/usr/share/pear/')
in
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/composer/autoload_real.php
on line 42 [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP
Stack trace: [Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1]
PHP 1. {main}()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/web/app.php:0
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 2.
require_once()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/web/app.php:7
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 3.
require_once()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/bootstrap.php.cache:4
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 4.
require()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/app/autoload.php:5
[Tue Mar 05 19:16:00 2013] [error] [client 127.5.146.1] PHP 5.
ComposerAutoloaderInit12cecca862685bdd480babbdd1b1ec7a::getLoader()
/var/lib/openshift/5e487f6c4a484700999d9213755b64eb/app-root/runtime/repo/php/vendor/autoload.php:7
Any idea or suggestion?
Seems like you're missing some of the files in your gear repository. Did you add-commit-push all of your files?
You can get list of the deployed *.php files by running:
ssh <INTO-YOUR-GEAR> 'cd ~/app-root/runtime/repo/php && find ./ -name \*.php'
(obviously you need to substitute <INTO-YOUR-GEAR> with your SSH string)
You have not "warm-up" your cache since the bootstrap.php.cache file isn't there, it seems like you just push your repo and do nothing yet on the openshift side.
You'll need to configure your symphony app first, that is download all the dependencies, fill in all the database settings, mailer settings and all other stuff.
ssh into your gear using this command rhc ssh -a <yourappname>, cd into your symfony root directory, and run php composer.phar install this will start everything that is needed to deploy your app completely
The best way to deploy a Symfony app to Openshift is:
Be sure you have a Symfony2 app working well in localhost (dev and prod)
Your proyect have to be using git.
Your .gitignore file is ignoring vendors, cache, bootstrap, logs, composer etc.
You have committed every pending change.
You need an openshift gear using PHP 5.4 and a cartridge of MySql 5.5
You need rhc to be installed and configured
Config your gear to public a branch called release: rhc app-configure --deployment-branch release -a <app-name>
Create a new php file that will give MySQL access to your app:
<?php
# app/config/params.php
if (getEnv("OPENSHIFT_APP_NAME")!='') {
$container->setParameter('database_host', getEnv("OPENSHIFT_MYSQL_DB_HOST"));
$container->setParameter('database_port', getEnv("OPENSHIFT_MYSQL_DB_PORT"));
$container->setParameter('database_name', getEnv("OPENSHIFT_APP_NAME"));
$container->setParameter('database_user', getEnv("OPENSHIFT_MYSQL_DB_USERNAME"));
$container->setParameter('database_password', getEnv("OPENSHIFT_MYSQL_DB_PASSWORD"));
}?>
This will tell the app that if is openshift environment it needs to load different user an database
Import this file (params.php) to your app/config/config.yml file:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: params.php }
...
Commit your changes.
Create a new branch that will push your changes to Openshift: git checkout -b release
Add your remote repository from openshift: git remote add openshift -f <youropenshiftrepository.git>
Merge the differences between both repositories git merge openshift/master -s recursive -X ours
Create a 'deploy' file (the one executed in openshift after you push your app) in your new folder "/.openshift/action-hooks" (Created when you added your openshift repository):
#!/bin/bash
# Symfony deploy
export COMPOSER_HOME="$OPENSHIFT_DATA_DIR/.composer"
if [ ! -f "$OPENSHIFT_DATA_DIR/composer.phar" ]; then
curl -s https://getcomposer.org/installer | php -- --install-dir=$OPENSHIFT_DATA_DIR
else
php $OPENSHIFT_DATA_DIR/composer.phar self-update
fi
unset GIT_DIR
cd $OPENSHIFT_REPO_DIR/
php $OPENSHIFT_DATA_DIR/composer.phar install
php $OPENSHIFT_REPO_DIR/app/console cache:clear --env=dev
chmod -R 0777 $OPENSHIFT_REPO_DIR/app/cache
chmod -R 0777 $OPENSHIFT_REPO_DIR/app/logs
rm -r $OPENSHIFT_REPO_DIR/php
ln -s $OPENSHIFT_REPO_DIR/web $OPENSHIFT_REPO_DIR/php
rm -r $OPENSHIFT_REPO_DIR/php
ln -s $OPENSHIFT_REPO_DIR/web $OPENSHIFT_REPO_DIR/php
php $OPENSHIFT_REPO_DIR/app/console doctrine:schema:update --force
Give this file permissions to be executed. In windows: git update-index --chmod=+x .openshift/action_hooks/deploy In Linux and Mac: chmod +x .openshift/action_hooks/deploy
Add your new file to the git project and make the commit.
Push to openshift: git push openshift HEAD
Your console will show you every step it is working on.
Come back to your master branch. git checkout master
Then you can keep working normaly on your project, commit your changes and move to release branch to deploy your new changes: git checkout release git merge master git push openshift HEAD git checkout master
And that's how I work with Symfony and Openshift. (These instructions are a mix from many ways I read and I imporved with some changes. It works very well for every app I've made.
Related
I have strange problem after I've installed Asterisk on my CentOS server. So, I have used tutorial step-by-step and didn't get any error or warnings. Whole installation went successfully.
When I try to log into Asterisk CLI with asterisk -r I've got this error
[root#asterisk-14.6.1]# asterisk -r
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
Unable to connect to remote asterisk (does /usr/local/var/run/asterisk/asterisk.ctl exist?)
[root#asterisk-14.6.1]#
What does this means? I can't find anything about master config file. My asterisk.conf file is in /etc/asterisk
-rw-r--r-- 1 asterisk asterisk 5332 18 sep 12,15 asterisk.conf
not in '/usr/local/etc/asterisk/asterisk.conf'
Asterisk is 100% running
[root#asterisk-14.6.1]# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/rc.d/init.d/asterisk; bad; vendor preset: disabled)
Active: active (running) since mon 2017-09-18 12:36:16 EEST; 3s ago
Docs: man:systemd-sysv-generator(8)
Process: 33977 ExecStop=/etc/rc.d/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 34000 ExecStart=/etc/rc.d/init.d/asterisk start (code=exited, status=0/SUCCESS)
Main PID: 34025 (asterisk)
CGroup: /system.slice/asterisk.service
├─34023 /bin/sh /usr/sbin/safe_asterisk
└─34025 /usr/sbin/asterisk -f -vvvg -c
sep 18 12:36:16 systemd[1]: Starting LSB: Asterisk PBX...
sep 18 12:36:16 asterisk[34000]: Starting asterisk:
sep 18 12:36:16 systemd[1]: PID file /var/run/asterisk/asterisk.pid not readable (yet?) after start.
sep 18 12:36:16 systemd[1]: asterisk.service: Supervising process 34025 which is not our child. We'll most likely not notice when it exits.
sep 18 12:36:16 systemd[1]: Started LSB: Asterisk PBX.
I have changed also this permissions to asterisk user
[root#asterisk-14.6.1]# ls -l /var/run/asterisk/asterisk.ctl
srwxr-xr-x 1 asterisk asterisk 0 18 sep 12,36
/var/run/asterisk/asterisk.ctl
I was able to log into CLI with asterisk -vvvvc and I can see few errors
Unable to open specified master config file '/usr/local/etc/asterisk/asterisk.conf', using built-in defaults
[Sep 18 12:40:24] ERROR[34584]: logger.c:1823 init_logger: Errors detected in logger.conf. Default console logging is being used.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
[Sep 18 12:40:24] WARNING[34584]: loader.c:1293 load_modules: No 'modules.conf' found, no modules will be loaded.
You did install with /usr/local/ prefix.
Now you have 2 choices
reinstall, do configure with --prefix=/
or do symlink
mkdir -p /usr/local/etc/
ln -s /etc/asterisk /usr/local/etc/
Running
make samples inside /usr/src/asterisk-<your version> resolved the issue for me
I am new to docker and currently struggling with the following problem:
After starting the command in the docker terminal:
OAUTH_CLIENT_ID=<...> OAUTH_CLIENT_SECRET=<...>
OAUTH_URL_CALLBACK=http://192.168.99.100/api/v1/auth/login docker-compose --
file test/docker-compose.yml up
I get the following error message:
ERROR: for platform Cannot start service platform: invalid header field
value "oci runtime error: container_linux.go:247: starting container process
caused \"process_linux.go:359: container init caused \\\"rootfs_linux.go:53:
mounting \\\\\\\"/c/users/m_konk01/documents/GitHub/o2r-
platform/test/nginx.conf\\\\\\\" to rootfs
\\\\\\\"/mnt/sda1/var/lib/docker/aufs/mnt/29c14c514916cf09070c6dd084bee55fa899d9
79b3f7b9521f1ab25e3a8232a0\\\\\\\" at
\\\\\\\"/mnt/sda1/var/lib/docker/aufs/mnt/29c14c514916cf09070c6dd084bee55fa899d9
79b3f7b9521f1ab25e3a8232a0/etc/nginx/nginx.conf\\\\\\\" caused \\\\\\\"not
a directory\\\\\\\"\\\"\"\n" [31mERROR[0m: Encountered errors while bringing up the project.
The docker-compose.yml starts several docker containers and contains the following platform settings:
platform:
image: nginx:latest
depends_on:
- container1
- container2
- container3
- container4
volumes:
- "./nginx.conf:/etc/nginx/nginx.conf:ro"
- "../client:/etc/nginx/html"
ports:
- "80:80"
Docker version
$ docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 23:26:11 2016
OS/Arch: windows/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 23:26:11 2016
OS/Arch: linux/amd64
Would be happy for any ideas. My search was not successful so far.
it seems like you want to mount a file to a file. i remember on your docker-version its not allowed. you have to move your nginx.conf inside of your Dockerfile
Dockerfile:
....
ADD nginx.conf /tmp/
RUN mv /tmp/nginx.conf /etc/nginx/nginx.conf && \
....
this should work for you. if not show me your next error code
I faced similar issue due to volume mount was not worked properly.
So docker default behavior consider this /nginx.conf as directory and gives this error.
To confirm this, you can ssh into your image and go to shared directory and check the files exist or not.
Example: docker exec -it nginx sh and go to /etc/nginx/html you won't see your local files. Then you can confirm volume share was not working. you need to fix that.
If you are using windows 10 (hyper-v), first you need to share your drive and check.
However you need to find the solution to mound your shared directory first.
After installing the Elastix 4.0 distro, I always have a broken web-admin panel. What am I doing wrong?
/var/log/httpd/ssl_error_log
[Fri Oct 07 22:34:08.636204 2016] [:error] [pid 4510] [client 192.168.88.88:50414] PHP Fatal error: Uncaught --> Smarty: unable to write file /var/www/html/var/templates_c/wrt57f7eaa09b4319_91812285 <-- \n thrown in /usr/share/php/Smarty/sysplugins/smarty_internal_write_file.php on line 46
You'll need to make the /var/www/html/var/templates_c directory writable by the user the web server is running under. For example:
chmod -R +w /var/www/html/var/templates_c
Apache should work under asterisk user.
/var/www/html/ and /var/lib/php should be changed to same owner.
Going to my app produces a 502 gateway error. Found out that it was because my how_lit.service is failing. But I am having trouble finding out why.
Tried editing the application and the ini document. Cannot figure out whats wrong.
The Nginx and uWSGI services are up and running fine.
Service Status:
lit#digitalocean:~/howlit$ sudo service how_lit status
[sudo] password for lit:
● how_lit.service - uWSGI instance to serve how lit rest api
Loaded: loaded (/etc/systemd/system/how_lit.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2016-08-04 00:30:44 EDT; 5 days ago
Process: 14294 ExecStart=/home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini (code=exited, status=1/FAILURE)
Main PID: 14294 (code=exited, status=1/FAILURE)
Aug 04 00:30:44 digitalocean systemd[1]: Started uWSGI instance to serve how lit rest api.
Aug 04 00:30:44 digitalocean uwsgi[14294]: [uWSGI] getting INI configuration from /home/lit/howlit/howlit.ini
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Main process exited, code=exited, status=1/FAILURE
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Unit entered failed state.
Aug 04 00:30:44 digitalocean systemd[1]: how_lit.service: Failed with result 'exit-code'.
Directory and Permissions:
lit#digitalocean:~/howlit$ ls -l .
total 16
drwx---r-x 6 lit www-data 4096 Jul 29 11:47 env
-rwx---r-x 1 lit www-data 202 Aug 3 23:29 howlit.ini
-rwx---r-x 1 lit www-data 1203 Aug 3 23:01 how_lit_restapi.py
-rwxr-xr-x 1 lit www-data 72 Aug 3 23:27 wsgi.py
/etc/systemd/system/how_lit.service:
lit#digitalocean:~/howlit$ cat /etc/systemd/system/how_lit.service
[Unit]
Description=uWSGI instance to serve how lit rest api
After=network.target
[Service]
User=lit
Group=www-data
WorkingDirectory=/home/lit/howlit/
Environment="PATH=/home/lit/howlit/env/bin"
ExecStart=/home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini
[Install]
WantedBy=multi-user.target
howlit.ini file:
lit#digitalocean:~/howlit$ cat howlit.ini
[uwsgi]
module = wsgi:app
uid = lit
gid = www-data
master = true
processes = 5
socket = how_lit_restapi.sock
chmod-sock = 666
vacum = true
die-on-term = true
gto = /var/log/uwsgi/%n.log
Tried running it by hand:
lit#digitalocean:~/howlit$ /home/lit/howlit/env/bin/uwsgi --ini /home/lit/howlit/howlit.ini
[uWSGI] getting INI configuration from /home/lit/howlit/howlit.ini
*** Starting uWSGI 2.0.13.1 (64bit) on [Tue Aug 9 18:28:25 2016] ***
compiled with version: 5.4.0 20160609 on 29 July 2016 11:48:08
os: Linux-4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
nodename: digitalocean
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/lit/howlit
detected binary path: /home/lit/howlit/env/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your processes number limit is 1896
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Permission denied [core/socket.c line 230]
permission error again?
SOLVED IT: By sending my socket into tmp, but still getting bad gateway error when I navigate to my site :(
Solved my own problem.
First I checked my services.
sudo service nginx status
sudo service uwsgi status
sudo service how_lit status
then I saw them all running and up but was still getting the bad gateway error. Well after checking the logs had no errors. I had to assume my configs.
Then I realized my mistake....I never restarted all of it, just certain parts at certain times. So I restarted every single one as such:
sudo service nginx restart
sudo service uwsgi restart
sudo service how_lit restart
now it works.
About the permission issue I tried it by putting the socket into the /tmp directory that way www-data group users can access it as well as root. I learned that you need to be able to create the socket and allow access to the system for it.
I moved it out of tmp btw later for production as I was told that was not best practice.
I have installed Ubuntu 14.04 and Apache2.4.7 But when I tried to create the vhost it start giving me the error. after that I have put my project in the /var/www/html directory its still not accessible.
[Thu Apr 16 09:56:38.559161 2015] [core:error] [pid 3412] (13)Permission denied: [client 127.0.0.1:59566] AH00035: access to /cls/web/app_dev.php denied (filesystem path '/var/www/html/cls/web') because search permissions are missing on a component of the path
I have fixed the issue i just have changed the permissions of the directory to 755 and it worked for me.
sudo chmod 755 /to/directory