Skip to content

Instantly share code, notes, and snippets.

Avatar

Mikołaj Przybysz mikolajprzybysz

View GitHub Profile
@mikolajprzybysz
mikolajprzybysz / gcloud-dns-record-add-cname-gstorage.sh
Created Oct 28, 2019
How to add CNAME record to redirect www subdomain to google storage
View gcloud-dns-record-add-cname-gstorage.sh
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 Oct 26, 2019
How to add DNS records in Google Cloud DNS Zone with google cloud sdk
View gcloud-dns-records-add.sh
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 Oct 26, 2019
How to create Google Cloud DNS Zone with google cloud sdk
View gcloud-dns-zone.sh
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 Jan 28, 2019
JavaScript Node Express Rest Api Hello World example
View index.js
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 Jan 28, 2019
host os agnostic, docker-compose example to run node image interactively with one command
View docker-compose.yml
# 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
View ApiCest.php
<?php
class ApiCest
{
public function tryApi(ApiTester $I)
{
$I->sendGET('/');
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
}
}
View install_codeception_docker.sh
# 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
View run_it_all.sh
#!/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.
#
View install_codeception_with_docker.sh
#!/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
View test_wiremock.sh
curl -v http://localhost:8080/book/123
curl -v http://localhost:8080/book/non-existing