Skip to content

Instantly share code, notes, and snippets.

@makasim
makasim / dump-db.sh
Last active February 1, 2019 14:28
Dump any mongo database and restore it with only Docker. restore-local-db could restore a dump to mongo running in a container
if (( "$#" != 1 ))
then
echo Host is required!
exit
fi
PROJECT_NAME=${PWD##*/}
mkdir -p dump
@makasim
makasim / docker-compose.yml
Last active March 20, 2020 11:23
Auto update telegram webhook url on docker compose up
version: '3.4'
services:
app:
image: 'formapro/nginx-php-fpm:latest-all-exts'
working_dir: '/app'
volumes:
- './:/app:cached'
env_file: '.env'
networks:
@makasim
makasim / traefik.toml
Created November 10, 2018 12:01
Secure Docker Registry with Traefik and LetsEncrypt 2
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[acme]
email = "[email protected]"
@makasim
makasim / docker-compose.yml
Last active January 1, 2024 11:24
Secure Docker Registry with Traefik and LetsEncrypt
version: '3.1'
services:
registry:
restart: always
image: registry:2
volumes:
- registry:/var/lib/registry
environment:
- REGISTRY_HTTP_ADDR=0.0.0.0:5000
<?php
namespace Ecom\Price\Model;
use Makasim\Values\ValuesTrait;
class Price
{
use ValuesTrait;
/**
@makasim
makasim / pvm_context.json
Last active July 17, 2018 07:10
pvm_context.json
{
"process": {
"schema": "http:\/\/pvm.forma-pro.com\/schemas\/Process.json",
"id": "749d7410-e1b0-4f27-aa35-97d09018754e",
"companyId": "12356692-eaac-4893-8e5d-9c2059fb4689",
"campaignId": "3569b06f-2210-48f4-853d-9a0d35c08182",
"nodes": {
"ad2fcc3c-ee83-40cc-9d76-cdb21d573098": {
"schema": "http:\/\/pvm.forma-pro.com\/schemas\/Node.json",
"id": "ad2fcc3c-ee83-40cc-9d76-cdb21d573098",
@makasim
makasim / pvm_ui.html
Created July 16, 2018 09:31
PVM UI example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<title>PVM UI</title>
</head>
@makasim
makasim / Dockerfile
Last active July 2, 2018 12:44
server static files such as prod version of react.js app.
FROM nginx:1.15
WORKDIR /var/www
COPY /nginx.conf /etc/nginx/conf.d/app.conf
ADD ./public /var/www
@makasim
makasim / create-do-droplet.sh
Last active May 12, 2018 18:09
create digital ocean droplet
#!/usr/bin/env bash
set -x
set -e
if [[ -z "$DOTOKEN" ]]; then
# get it from https://cloud.digitalocean.com/settings/security
echo "Must provide DOTOKEN in environment" 1>&2
exit 1
fi
@makasim
makasim / an_efficient_way_to_treat_mongodb_in_symfony_4.php
Last active April 10, 2018 20:17
an_efficient_way_to_treat_mongodb_in_symfony_4
<?php
use Symfony\Component\DependencyInjection\ContainerInterface;
use App\Model\Order;
use function Makasim\Yadm\get_object_id;
use function Makasim\Values\get_values;
/** @var ContainerInterface $container */
$storage = $container->get('yadm')->getStorage(Order::class);