Skip to content

Instantly share code, notes, and snippets.

@miguelbalparda
Last active July 8, 2020 17:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelbalparda/3ef22403edd6410eeba33d7a6eac9d80 to your computer and use it in GitHub Desktop.
Save miguelbalparda/3ef22403edd6410eeba33d7a6eac9d80 to your computer and use it in GitHub Desktop.
Carpoolear local dev env
git clone https://github.com/STS-Rosario/carpoolear_backend.git
Create vhost www.carpoolear-dev.com.ar pointing to carpoolear_backend/public
Add AllowOverride All between </Directory> inside the created vhost
Point www.carpoolear-dev.com.ar to 127.0.0.1 in hosts file.
composer install
cp .env.example .env
Change DB credentials
Change MAIL_DRIVER=smtp to MAIL_DRIVER=log for local development
chmod -R ugo+rw storage/
php artisan key:generate
php artisan migrate
git clone https://github.com/STS-Rosario/carpoolear.git
npm install
Edit dev.env.js and prod.env.js and change the api endpoint to the local domain.
cd cordova && cordova platform add android
cordova build browser --release
Symlink resulting dir (carpoolear/cordova/platforms/browser/www/) to carpoolear_backend/app
@miguelbalparda
Copy link
Author

Vhost:

<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	ServerName www.carpoolear-dev.com.ar

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html/car
	<Directory "/var/www/html/car">        
		AllowOverride All
	</Directory>
	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/car-error.log
	CustomLog ${APACHE_LOG_DIR}/car-access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

@miguelbalparda
Copy link
Author

Some issues I faced: Imagick was not installed, it's needed for the profile image. Installing php7.1-imagick did the trick.

@miguelbalparda
Copy link
Author

Response for /api/users was 404. Adding AllowOverride All and enabling mod_rewrite fixed this.

@miguelbalparda
Copy link
Author

Creating users was not working. The error was a timeout while trying to connect to mailtrap.io. Changing the driver to log allowed me to see the emails inside carpoolear_backend/storage/logs/ i.e to activate the account.

@miguelbalparda
Copy link
Author

miguelbalparda commented Aug 3, 2018

michael@michael-HP-Laptop-15-bs0xx:~/carpoolear$ php -v
PHP 7.1.17-0ubuntu0.17.10.1 (cli) (built: May  9 2018 17:28:01) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.17-0ubuntu0.17.10.1, Copyright (c) 1999-2018, by Zend Technologies
michael@michael-HP-Laptop-15-bs0xx:~/carpoolear$ php -m
[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
imagick
json
libxml
mbstring
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

@miguelbalparda
Copy link
Author

michael@michael-HP-Laptop-15-bs0xx:~/carpoolear$ mysql -V
mysql  Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using  EditLine wrapper
michael@michael-HP-Laptop-15-bs0xx:~/carpoolear$ apache2 -v
Server version: Apache/2.4.27 (Ubuntu)
Server built:   2018-04-18T14:20:05

@00xkhaled
Copy link

00xkhaled commented Jul 12, 2019

when i put the directory to /var/www/carpoolear_backend/public the website and API works not the app and when i point it to /var/www/carpoolear_backend/app the /app work but the normal API and web app don't work any suggestions?

@miguelbalparda
Copy link
Author

miguelbalparda commented Jul 12, 2019

I think you are missing a step, probably this one.

@raditha
Copy link

raditha commented Jul 8, 2020

Do you have any pointers when enabling https for the app. I am getting /api/trips 404 when accessing over https. I have a self signed certificate configured and the app is running on apache2 in ubuntu 18 env.

EDIT- http works without any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment