Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Yongzhi Yang sgyyz

🎯
Focusing
Block or report user

Report or block sgyyz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-compose.yml
version: '3'
services:
mysql:
image: mysql:5.7
ports:
- "3306:3306"
command: "mysqld --character-set-server=utf8 --collation-server=utf8_unicode_ci"
volumes:
- mysql-dataset:/var/lib/mysql
@sgyyz
sgyyz / docker-compose.yml
Created Jan 20, 2020
OpenLdap & Phpldapadmin docker-compose.yml
View docker-compose.yml
version: '3'
services:
openldap:
image: osixia/openldap:1.3.0
ports:
- '389:389'
- '636:636'
phpldapadmin:
@sgyyz
sgyyz / docker-compose.yml
Last active Jan 20, 2020
Postgres & PgAdmin docker-compose.yml
View docker-compose.yml
version: '3'
services:
postgres:
image: postgres
ports:
- "5432:5432"
volumes:
- pg-dataset:/var/lib/postgresql/data
environment:
@sgyyz
sgyyz / base_calculator.ex
Last active May 7, 2019
Elixir Abstract and Extends
View base_calculator.ex
defmodule BaseCalculator do
@moduledoc """
Define the base calculator and provide public API.
Define the callback to implement specific logic in child module.
"""
# it should be implemented by child module
@callback do_calculate(num1 :: Integer.t(), num2 :: Integer.t()) :: {:ok, Integer.t()} | {:error, any()}
defmacro __using__(_opts) do
View rel_config.ex
## ....
environment :prod do
set include_erts: true
set include_src: false
set cookie: :"8[^a{lsZs|em/)Xg^pI}m2hXlmbzuuioM|[6mB6Pbno9MFuzWCNN{9TvK}(%]D<S"
set vm_args: "rel/vm.args"
set pre_start_hooks: "rel/hooks/pre_start"
set post_start_hooks: "rel/hooks/post_start"
end
View dockerize_elixir_migrate_db.sh
#!/usr/bin/env bash
### Comment below block if it's a command ###
set +e
while true; do
nodetool ping
EXIT_CODE=$?
if [[ ${EXIT_CODE} -eq 0 ]]; then
echo "Application is up!"
View dockerize_elixir_create_db.sh
#!/usr/bin/env bash
echo "Running database creation"
bin/dockerize_elixir command Elixir.Release.Tasks create_db
echo "DB created successfully"
View release.ex
defmodule Release.Tasks do
@start_apps [
:postgrex,
:ecto,
:ecto_sql
]
@app_mods [
DockerizeElixir
]
View build_elixir_docker_image.sh
$ docker build --build-arg APP_NAME=dockerize_elixir --build-arg APP_VSN=0.1.0 --build-arg SKIP_PHOENIX=true -t app:0.1.0 .
View elixir_dockerfile
# The version of Alpine to use for the final image
# This should match the version of Alpine that the `elixir:1.7.2-alpine` image uses
ARG ALPINE_VERSION=3.8
FROM elixir:1.7.2-alpine AS builder
# The following are build arguments used to change variable parts of the image.
# The name of your application/release (required)
ARG APP_NAME
# The version of the application we are building (required)
You can’t perform that action at this time.