I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do| 'use strict' | |
| /** | |
| * A sample controller that stores data in the $rootScope | |
| */ | |
| angular.module('sample').controller('usingRootScopeController', ['$rootScope', '$scope', function ($rootScope, $scope) { | |
| // Resets the list of items. | |
| $scope.reset = function () { | |
| $rootScope.someList = []; | |
| } |
| class MyController { | |
| editor: any; | |
| grapesJsConfig: { | |
| //whatever | |
| } | |
| constructor(private readonly $scope: ng.IScope) {} |
I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api
Rails.application.routes.draw do
constraints subdomain: "api" do
scope module: "api" do| 'use strict'; | |
| const path = require('path') | |
| exports.handler = (event, context, callback) => { | |
| //get request object | |
| const { request } = event.Records[0].cf | |
| const url = request.uri; |
| /* | |
| * decaffeinate suggestions: | |
| * DS102: Remove unnecessary code created because of implicit returns | |
| * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md | |
| */ | |
| const OldHttpRequest = Turbolinks.HttpRequest; | |
| Turbolinks.CachedHttpRequest = class CachedHttpRequest extends Turbolinks.HttpRequest { | |
| constructor(_, location, referrer) { | |
| super(); |
| sudo apt install build-essential autoconf automake autopoint chrpath cm-super-minimal debhelper dh-autoreconf dh-strip-nondeterminism doxygen doxygen-latex gir1.2-rsvg-2.0 graphviz libbz2-dev libcairo-script-interpreter2 libcairo2-dev libcdt5 libcgraph6 libclang1-3.6 libdjvulibre-dev libexif-dev libfftw3-bin libfftw3-dev libfftw3-long3 libfftw3-quad3 libfile-stripnondeterminism-perl libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev libgvc6 libgvpr2 libharfbuzz-dev libharfbuzz-gobject0 libice-dev libilmbase-dev libjasper-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjs-jquery liblcms2-dev libllvm3.6v5 liblqr-1-0-dev liblzma-dev libobjc-5-dev libobjc4 libopenexr-dev libpango1.0-dev libpathplan4 libpcre3-dev libpcre32-3 libpcrecpp0v5 libperl-dev libpixman-1-dev libpng12-dev libpotrace0 libptexenc1 libpthread-stubs0-dev librsvg2-bin librsvg2-dev libsigsegv2 libsm-dev libsynctex1 libtexlua52 libtexluajit2 libtiff5-dev libtiffxx5 libwmf-dev libx11-dev li |
This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.
No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!
I chose [pgloader][1] because it's extremely fast. YMMV.
mysql2 gem with pg in Gemfile.config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
File locations:
nginx.conf to /usr/local/etc/nginx/default and default-ssl to /usr/local/etc/nginx/sites-availablehomebrew.mxcl.nginx.plist to /Library/LaunchDaemons/| http { | |
| ... | |
| proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m; | |
| ... | |
| } |
| #!/bin/bash | |
| if [ $(uname -s) == "Darwin" ]; then | |
| brew install graphicsmagick | |
| brew install poppler | |
| brew install ghostscript | |
| brew install tesseract | |
| wget -o ~/Downloads/pdftk_server-1.45-mac_osx-10.6-setup.pkg http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-1.45-mac_osx-10.6-setup.pkg | |
| open ~/Downloads/pdftk_server-1.45-mac_osx-10.6-setup.pkg | |
| else |