You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.7 KiB
2.7 KiB
Steps to Create and Deploy
Set up local app
Install Composer
-
Make sure you have MAMP and Postgres installed and running
-
Download comopser: https://getcomposer.org/composer-stable.phar
-
In Terminal, run:
mv ~/Downloads/composer-stable.phar /usr/local/bin/composerchmod 755 /usr/local/bin/composerecho 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bash_profilels /Applications/MAMP/bin/phpand take note of the most recent versionecho 'export PATH="/Applications/MAMP/bin/php/php7.4.2/bin:$PATH"' >> ~/.bash_profilesubstituting your latest version of php forphp7.4.2
-
close terminal window and open a new one
Forking/Cloning This Repo
After forking and cloning this repo to your local machine:
cdto repo dir- run
composer install - run
cp .env.example .env
Connect to db
Connect to psql and
CREATE DATABASE contacts;
\c contacts
CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);
INSERT INTO people (name, age) VALUES ('matt', 40);
Run whoami and take note over your computer's username (mine is matthuntington)
In .env file, adjust the following code block:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
so it is:
DB_CONNECTION=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=contacts
DB_USERNAME=matthuntington
DB_PASSWORD=
Instead of matthuntington insert your computer's username (what you found when running whoami)
Start App
- run
php artisan serve - go to http://localhost:8000/
- if browser asks you to generate key, click the button
- go to http://localhost:8000/index.html
set up heroku
in your terminal
- run
heroku create(take note of the app name for later) - run
heroku config:set LOG_CHANNEL=errorlog - run
heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)
in your browser
- go to heroku.com in your browser and sign in
- find this newly created heroku app in your list of available apps and click on it
- go to resources
- search for postgres and choose Heroku Postgres
- choose "Hobby Dev - Free"
- click provision
in your terminal
- in your terminal, if running
psqlgives you "command not found", runln -s /Applications/Postgres.app/Contents/Versions/latest/bin/psql /usr/local/bin/psql - run
heroku pg:psql - once inside heroku's psql, run
CREATE TABLE people (id SERIAL, name VARCHAR(16), age INT);INSERT INTO people ( name, age ) VALUES ( 'Matt', 38 );INSERT INTO people ( name, age ) VALUES ( 'Sally', 54 );INSERT INTO people ( name, age ) VALUES ( 'Zanthar', 4892 );
- exit heroku psql with
\q