Setting up Dokku with DigitalOcean and Namecheap
..or how I made my own heroku in a few hours for $3.98.
| # vi: ft=dosini | |
| [user] | |
| name = Pavan Kumar Sunkara | |
| email = [email protected] | |
| username = pksunkara | |
| [core] | |
| editor = nvim | |
| whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
| pager = delta | |
| [column] |
| <?xml version="1.0" encoding="utf-8"?> | |
| <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <CodeSnippet Format="1.0.0"> | |
| <Header> | |
| <Title>Arrange Act Assert</Title> | |
| <Author>Chris</Author> | |
| <Description>Adds an arrange, act, assert to a test</Description> | |
| <HelpUrl /> | |
| <Keywords /> | |
| <SnippetTypes /> |
Located in alphabetical order (not prefer)
Cab), also designed as a more modern replacement, written in Cgolang)| #!/bin/bash | |
| # | |
| # Example using getopt (vs builtin getopts) that can also handle long options. | |
| # Another clean example can be found at: | |
| # http://www.bahmanm.com/blogs/command-line-options-how-to-parse-in-bash-using-getopt | |
| # | |
| aflag=n | |
| bflag=n |
| ############################################################################### | |
| # Helpful Docker commands and code snippets | |
| ############################################################################### | |
| ### CONTAINERS ### | |
| docker stop $(docker ps -a -q) #stop ALL containers | |
| docker rm -f $(docker ps -a -q) # remove ALL containers | |
| docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
| # exec into container |
| <?php | |
| use GuzzleHttp\Client; | |
| use GuzzleHttp\Exception\ConnectException; | |
| use GuzzleHttp\Exception\RequestException; | |
| use GuzzleHttp\Handler\CurlHandler; | |
| use GuzzleHttp\HandlerStack; | |
| use GuzzleHttp\Psr7\Request as Psr7Request; | |
| use GuzzleHttp\Psr7\Response as Psr7Response; | |
| use Psr\Log\LoggerInterface; | |
| const MAX_RETRIES = 2; |
| <?php | |
| class MyRepository extends EntityRepository | |
| { | |
| public function whereInSubQuery(User $user) | |
| { | |
| $queryBuilder = $this->createQueryBuilder('my_repository'); | |
| $queryBuilder | |
| ->where( | |
| $queryBuilder->expr()->in( |
Pre-Conditions: https://docs.docker.com/engine/swarm/swarm-tutorial/#/three-networked-host-machines For distributed Minio to run, you need 4 networked host machines.
Create a new swarm and set the manager. SSH to one of the host machine, which you want to set as manager and run: docker swarm init --advertise-addr <MANAGER-IP>
Current node should become the manager. Check using: docker node ls
Open a terminal and ssh into the machine where you want to run a worker node.
Run the command as output by the step where master is created. It will add the current machine (as a worker) to the swarm. Add all the workers similarly.
Check if all the machines are added as workers, SSH to the master and run: docker node ls
| # Pass the env-vars to MYCOMMAND | |
| eval $(egrep -v '^#' .env | xargs) MYCOMMAND | |
| # … or ... | |
| # Export the vars in .env into your shell: | |
| export $(egrep -v '^#' .env | xargs) |