diff --git a/.travis.yml b/.travis.yml index 05a3b61..457a464 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ language: php php: - 7.0 + - 7.1 addons: postgresql: "9.4" diff --git a/app.json b/app.json new file mode 100644 index 0000000..ac3e1cf --- /dev/null +++ b/app.json @@ -0,0 +1,75 @@ +{ + "name": "JobsToMail", + "description": "Your personal job-search assistant.", + "repository": "https://github.com/jobapis/jobs-to-mail", + "logo": "https://www.jobstomail.com/img/logo.png", + "keywords": [ + "job boards", + "emails" + ], + "addons": [ + "heroku-postgresql:hobby-dev", + "scheduler:standard" + ], + "env": { + "APP_ENV": "production", + "APP_KEY": { + "description": "Generate a unique key after deployment by running `php artisan key:generate`", + "value": "base64:Pqfff+YzQZNkTHm6pkgmNm2gdpLxBZ3VXhdpWAkIzNI=" + }, + "APP_DEBUG": { + "description": "Debug mode", + "value": "false" + }, + "APP_URL": { + "required": true + }, + "CACHE_DRIVER": "file", + "QUEUE_DRIVER": "database", + "SESSION_DRIVER": "file", + "DB_CONNECTION": { + "description": "Use Heroku's Postgresql by default", + "value": "pgsql_heroku" + }, + "MAIL_DRIVER": "sendgrid", + "SENDGRID_API_KEY": { + "description": "Required for email delivery", + "required": true + }, + "GA_TRACKING_ID": { + "description": "Google Analytics ID for your app", + "required": false + }, + "CAREERBUILDER_KEY": { + "required": false + }, + "CAREERJET_KEY": { + "required": false + }, + "INDEED_KEY": { + "required": false + }, + "JUJU_KEY": { + "required": false + }, + "USAJOBS_KEY": { + "required": false + }, + "ZIPRECRUITER_KEY": { + "required": false + } + }, + "formation": { + "web": { + "quantity": 1, + "size": "hobby" + }, + "queue": { + "quantity": 1, + "size": "hobby" + } + }, + "scripts": { + "postdeploy": "echo Done" + } +} \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ada6f79..934f22a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,6 +1,5 @@ app->bind('League\Csv\Writer', function ($app) { + $this->app->bind('League\Csv\Writer', function () { return Writer::createFromString(''); }); } diff --git a/changelog.md b/changelog.md index c737a5a..a2567a0 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,8 @@ All Notable changes to `jobs-to-mail` will be documented in this file. - Premium interest page and form. - Added images of providers on home page. - Upgraded to [JobsMulti v1.0](https://github.com/jobapis/jobs-multi). +- Support for PHP 7.1. +- One-click Heroku deploy. ### Fixed - Plaintext email job listings were showing up as blank. diff --git a/readme.md b/readme.md index 272d500..2c5927d 100644 --- a/readme.md +++ b/readme.md @@ -23,6 +23,7 @@ Installation requires the following: - [Composer](https://getcomposer.org/) - [Node 6.0+](https://nodejs.org/en/blog/release/v6.0.0/) - [NPM](https://www.npmjs.com/) +- [Gulp](https://github.com/gulpjs/gulp-cli) - A web server ([Nginx](https://nginx.org/en/) recommended) ### Local installation @@ -46,31 +47,60 @@ composer create-project jobapis/jobs-to-mail ### Heroku installation -1. Run `heroku create` to create a new app on Heroku +1. Use the one-click Deploy to Heroku button: [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) -2. Run `heroku buildpacks:set heroku/php` to declare it as a PHP application +2. After it's deployed, you should be able to visit your app and see the home page. -3. Set Laravel encryption key with: `heroku config:set APP_KEY=$(php artisan --no-ansi key:generate --show)` +3. Set an application key by running `heroku run "php artisan key:generate --show" --app=j2m` and adding the key that is displayed to your app's config variables. -4. Add Postgres to Heroku with: `heroku addons:add heroku-postgresql:hobby-dev` +4. Add a job in Heroku Scheduler to run `php artisan jobs:email` every night. This will ensure that users receive their emails. -5. Set the appropriate database config with: `heroku config:set DB_CONNECTION="pgsql_heroku"` +### Server installation + +#### Additional Requirements +- A server running [Linux Ubuntu 16.04+](http://releases.ubuntu.com/16.04/) +- [PHP-FPM](https://php-fpm.org/) +- [NGINX](https://www.nginx.com/resources/wiki/) + +1. Use composer to [create a new project](https://getcomposer.org/doc/03-cli.md#create-project): + +``` +composer create-project jobapis/jobs-to-mail +``` -6. Push the code to Heroku with: `git push heroku master` +2. Copy `.env.example` to `.env` and customize it with your environmental variables. -7. Run `heroku run php artisan migrate` to perform database migrations +3. Run `npm install && gulp` to build the frontend. -8. Run the job collection/email job: `heroku run php artisan jobs:email`. This can be run via [Scheduler](https://elements.heroku.com/addons/scheduler) in order to send emails at regular intervals. +4. Point NGINX to serve to the `/public` directory. Your NGINX config block should look something like this: -9. Run `heroku config:set QUEUE_DRIVER="database"` to queue up jobs and perform them asynchronously. This is optional, but since Heroku limits your process time it's pretty helpful if you want to process more than a couple records. +```conf +server { + listen 80; + server_name yourdomain.com; + + root /home/user/jobs-to-mail/public; + index index.html index.htm index.php; -9. Launch the app on Heroku by running `heroku open` + charset utf-8; -### Server installation -``` -Coming soon. + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } +} ``` +5. Ensure that PHP-FPM is running, and ensure that your site is running at your domain. + +6. Create a [cron job](https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/) to run the job collection and notification process nightly: `php artisan jobs:email`. + ## Command Line After users sign up for a job search, the only thing needed to collect jobs and send them emails is the following command: