Skip to content

Instantly share code, notes, and snippets.

View mikolajprzybysz's full-sized avatar

Mikołaj Przybysz mikolajprzybysz

View GitHub Profile
@mikolajprzybysz
mikolajprzybysz / gcloud-dns-record-add-cname-gstorage.sh
Created October 28, 2019 21:17
How to add CNAME record to redirect www subdomain to google storage
gcloud dns record-sets transaction start --zone=samplewebsite
gcloud dns record-sets transaction add -zone=samplewebsite --name="www.samplewebsite.pl" --ttl=300 --type=CNAME "c.storage.googleapis.com."
gcloud dns record-sets transaction execute --zone samplewebsite
@mikolajprzybysz
mikolajprzybysz / gcloud-dns-records-add.sh
Last active October 26, 2019 23:53
How to add DNS records in Google Cloud DNS Zone with google cloud sdk
gcloud dns record-sets transaction start --zone=samplewebsite
# Transaction started [transaction.yaml].
gcloud dns record-sets transaction add --zone=samplewebsite --name="samplewebsite.pl" --ttl=21600 --type TXT "google-site-verification=H6H-AdAqZBMUwopsm5T89oEALZdU5z751rLBd-j3jhM"
# Record addition appended to transaction at [transaction.yaml].
gcloud dns record-sets transaction execute --zone=samplewebsite
# Executed transaction [transaction.yaml] for managed-zone [samplewebsite].
# Created [https://dns.googleapis.com/dns/v1/projects/staticwebsitehosting/managedZones/samplewebsite/changes/1].
# ID START_TIME STATUS
@mikolajprzybysz
mikolajprzybysz / gcloud-dns-zone.sh
Last active October 26, 2019 23:34
How to create Google Cloud DNS Zone with google cloud sdk
gcloud dns managed-zones create samplewebsite --dns-name="samplewebsite.pl." --description="samplewebsite.pl"
# Created [https://dns.googleapis.com/dns/v1/projects/staticwebsitehosting/managedZones/samplewebsite].
@mikolajprzybysz
mikolajprzybysz / index.js
Created January 28, 2019 22:55
JavaScript Node Express Rest Api Hello World example
const app = require('express')();
app.get('/', (req, res) => {
res.send('Hello world!');
});
app.listen(80, () => {
console.log('App listening on port 80!');
});
@mikolajprzybysz
mikolajprzybysz / docker-compose.yml
Last active January 28, 2019 23:19
host os agnostic, docker-compose example to run node image interactively with one command
# To run interactive mode run
# docker-compose run --rm --entrypoint sh tutorial-app
# in order to run the up run
# docker-compose up
version: '3.7'
services:
tutorial-app:
image: node:11-alpine
ports:
- 80:80
<?php
class ApiCest
{
public function tryApi(ApiTester $I)
{
$I->sendGET('/');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
}
}
# for mac
docker run -it -v $PWD:/app -w /app composer:1.7 require "codeception/codeception" --dev
docker run -it -v $PWD:/app -w /app php:7.2-alpine ./vendor/bin/codecept init api
# Use the following answers. Important! There is no trailing slash!
# > ? Where tests will be stored? (tests) tests/api
# > ? Start url for tests (http://localhost/api) http://localhost
# or alternatively if you are not yet fun of docker
# composer require "codeception/codeception" --dev
# ./vendor/bin/codecept init api
#!/usr/bin/bash env
# for mac
docker network create testnet
docker run -d -p 8080:8080 --net testnet --name wiremock -v $PWD/tests/wiremock/mappings:/wiremock/mappings ekino/wiremock:2.7.1
docker run -it -v $PWD:/app -w /app --net testnet php:7.2-alpine ./vendor/bin/codecept run
# Codeception PHP Testing Framework v2.4.5
# Powered by PHPUnit 7.3.5 by Sebastian Bergmann and contributors.
#
#!/usr/bin/env bash
# For mac
docker run -it -v $PWD:/app -w /app composer:1.7 require "codeception/codeception" --dev
docker run -it -v $PWD:/app -w /app php:7.2-alpine ./vendor/bin/codecept init api
# Use the following answers. Important! There is no trailing slash!
> ? Where tests will be stored? (tests) tests/api
> ? Start url for tests (http://localhost/api) http://wiremock:8080
# At point we will create some bootstrap files, since we have one particular endpoint we would like to test simply edit
curl -v http://localhost:8080/book/123
curl -v http://localhost:8080/book/non-existing