starting and using spanner

Feb 5, 01:30 PM

1) create new project https://console.cloud.google.com/projects

2) https://console.developers.google.com/iam-admin/
- create IAM and add “cloud spanner admin “ (added all options under “cloud spanner)

3) be SURE billing is installed in project !

4) https://console.cloud.google.com/spanner/ – initialize spanner (dont skip this step)

https://console.developers.google.com/apis/api/spanner.googleapis.com/overview?project=marks-spanner-project-2&duration=P30D (???)

IF NOT USING GOOGLE-VPS:
https://cloud.google.com/sdk/docs/quickstart-redhat-centos
(use the yum option) gcloud init;

IF USING GOOGLE-VPS:
in terminal window:

sudo yum -y update; ## of course!

gcloud config set account marks-spanner-project-2; ## this is PROJECT-ID, not PROJECT-NAME!
gcloud config set project PROJECT_ID ;

gcloud config list ; gcloud auth list ; ### confirm everything.

  1. BE SURE PROJECT NAME MATCHES – this had been a problem!

gcloud auth application-default login; ## will create a temporary “login-link”
gcloud auth login;

gcloud auth list; ## auth list

========================

gcloud spanner instances create test-instance-next \ —config=regional-us-central1 \ —description=“Test Instance” \ —nodes=1 ;
gcloud spanner instances delete test-instance-next ; ## deletes instance

gcloud spanner instances list ;

======================

https://cloud.google.com/spanner/docs/getting-started/nodejs/

git clone https://github.com/googleapis/nodejs-spanner.git ;
cd /nodejs-spanner/samples ;
npm install ;

cool command:
gcloud spanner databases execute-sql example-db \ —instance=test-instance \ —sql=‘SELECT SingerId, AlbumId, AlbumTitle FROM Albums’;

Mark Edwards

,

---

lets encrypt certs

Jan 24, 07:15 AM

### LETS-ENCRYPT ON VIRTUALMIN (2-18-02-04)

1 – use virtualmin to turn website into a https site
2 – edit-virtual-server, enabled-features, check “Apache SSL website enabled?” ## no more certbot-auto! its the same as regular certbot:

dnf —assumeyes —enablerepo=epel-testing install certbot ;

####3 – ./certbot-auto, enter number of domains to be certified (stand ready to scroll since we have many names)
####4 – certbot-auto will “edit” httpd.conf file to point to the new names.
5 – manually start https: apachectl configtest ; systemctl restart httpd ; systemctl stop httpd ; systemctl start httpd ;

6) certbot-auto renew; renews all certbot certs

NOTE: answering the question “2: Redirect – Make all requests redirect to secure HTTPS access.” will put the new 443 ssl site into a separate file at “/etc/httpd/conf/httpd-le-ssl.conf” and add an “Include” at the bottom of “/etc/httpd/conf/httpd.conf”. it will also add the “RewriteCond/RewriteRule” directly into the httpd.conf file rather than put it into (dot)htaccess.

### INITIAL STUFF TO GET APACHE WORKING: (2018-01-24)

sudo yum —assumeyes update ; ## always a good idea!
sudo yum —assumeyes install httpd ; ## install apache
sudo systemctl start httpd.service; ## start running apache
sudo systemctl enable http.service ; ## (optional) start at boot

### ESTABLISHING A VIRTUAL HOST:

## we first have to create a virtual host: (wow godaddy has something useful, surprisingly….)
## https://www.godaddy.com/help/configure-apache-virtual-hosts-centos-7-17338

## ERROR!
https://unix.stackexchange.com/questions/229192/apache-wont-restart-after-configuring-virtual-hosts
QUOTE: I had a similar issue and it turns out that Apache didn’t like the ErrorLog and CustomLog lines ### in the VirtualHost container. I commented them out and service started without a problem.

1) commend out ErrorLog and CustomLog: /etc/httpd/sites-available/canyonverde.church.conf

2) add this line to every virtual host:
SSLProtocol all -SSLv2 -SSLv3

## OPTIONAL FIREWALL:
sudo firewall-cmd —zone=public —add-port=80/tcp —permanent; sudo firewall-cmd —reload ;
sudo firewall-cmd —zone=public —add-port443/tcp —permanent; sudo firewall-cmd —reload ;
sudo systemctl restart httpd.service ; ## is this really necessary?

### lets encrypt stuff

sudo yum -y install yum-utils ;
sudo yum-config-manager —enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional ;
sudo yum —assumeyes install certbot-apache ;

sudo certbot —version ;

optionally: https://certbot.eff.org/all-instructions/#web-hosting-service-none-of-the-above

sudo yum —assumeyes install wget;
sudo wget https://dl.eff.org/certbot-auto ;
sudo chmod a+x certbot-auto ; mv ./certbot-auto /usr/local/bin ; ## 2020-10-15

./certbot-auto —test-cert ; ## notice —test-cert option!

Mark Edwards

,

---

CRUD platforms to consider

Oct 4, 10:50 AM

- feathers-sequelize (coming tutorial one) — https://github.com/feathersjs/feathers-sequelize

- sails-waterline — http://waterlinejs.org/ https://kev.inburke.com/kevin/dont-use-sails-or-waterline/

- vue-sequelize https://codeburst.io/building-a-feature-complete-bookmarking-app-with-vue-js-express-and-sequelize-orm-b36506ebcb4c

- adonisJS — https://adonisjs.com/docs/3.2/database-setup

— trailsJS – supports ORM’s https://trailsjs.io/start (see ‘choose ORM’ )

- deepstream-sequelize (i still am convinced i can get this working successfully)

sails vs trails:
https://medium.com/jsbot/trails-vs-sails-1-89e2be2bce73

negative sails/waterline article:
https://kev.inburke.com/kevin/dont-use-sails-or-waterline/

Mark Edwards

,

---

deepstream OO Class definition to save recordname

Mar 27, 04:37 AM

from wolfram:

class User{ constructor( recordName ) { this.record = ds.record.getRecord( recordName ); this.record.subscribe( this._processUpdate.bind( this ) ); }

_processUpdate( data ) { if( this.record.name === ‘…’) { // do stuff } } }
Mark Edwards

,

---

promises including async-2-sync conversion

Mar 15, 10:27 AM

(async () => { try { let result = await feathersApp.logout(); console.log(‘the result is: ‘ + result) } catch (e) { console.log(e); } } ) () ;
(async () => let logoutResult = await feathersApp.logout(); console.log(logoutResult); })().catch(e => { console.log(e) });

https://stackoverflow.com/questions/70883305/best-way-to-make-a-knex-request-from-inside-a-promise

from grokling slack:

return sequelizeTable.create({‘column1’:‘data one’,‘column2’:‘data two’}) // Chain on .create .then(result => sequelizeTable.count( { ‘where’ : { ‘id’ : result.id } } ) // Chain on .count .then(count => console.log(count)) // Here we return result to be used after this .then(() => result) ) .then(result => console.log(result.id)) .catch(err => console.log(‘ERROR ‘ + err))

If you don’t want to make smaller functions to make your code more readable, you’d do it something like this:

return table.create(…..)
.then( result => { return table.count( { ‘where’‘ : {‘id’: result.id }})); .then (count => { console.log(count)); return count; }) .then (count => { if ( count > 123 ) console.log(” > 123: “ + result.id) else console.log ( “<= 123: “ + result.id ); return something; })
})
.catch( …….)

NODE:

‘use strict’

/*
function connect() { return new Promise( (resolve, reject) => { client.rpc.make (‘promise’, ‘provide data passed in – abcde’, (err, reply) => { resolve(reply) }); })
}

connect() .then( (result1) => { return(‘RESULT1: ‘ + result1); }) .then( (result2) => { return(‘RESULT2: ‘ + result2); }) .then( (result3) => { console.log(‘RESULT 3: ‘ + result3); }) ;
*/

Mark Edwards

,

---

« Older Newer »

Manage