Coder Social home page Coder Social logo

gigalixir-run's Introduction

GIGALIXIR's app run environment. The Dockerfile here describes what is running on each container in a GIGALIXIR app.

Development

virtualenv grun
source grun/bin/activate
docker build --rm -t gigalixir-run .
# for heroku-16, use
docker build --rm -t gigalixir-run-16 . -f Dockerfile.heroku-16
export APP_KEY=""
export LOGPLEX_TOKEN=""

for mix app

gigalixir rollback -r 330 -a bar
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar gigalixir-run init bar foreground
# for heroku-16, use
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar gigalixir-run-16 init bar foreground
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar gigalixir-run job mix help
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar --entrypoint="" gigalixir-run /usr/bin/dumb-init -- gigalixir_run job -- mix --version

then exec into the container and run

docker exec -it $(docker ps | awk '/gigalixir-run/ { print $1 }') /bin/bash

gigalixir_run run -- remote_console 
gigalixir_run run -- mix help
gigalixir_run run -- mix --version # flags?

for distillery app

gigalixir rollback -r 334 -a bar
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN gigalixir-run init bar foreground
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN gigalixir-run distillery_job command Elixir.Task migrate

then exec into the container and run

docker exec -it $(docker ps | awk '/gigalixir-run/ { print $1 }') /bin/bash

gigalixir_run run -- remote_console 
gigalixir_run run -- command Elixir.Task migrate
# TODO: use distillery_eval instead?
gigalixir_run run -- eval "'Elixir.Ecto.Migrator':run(lists:nth(1, 'Elixir.Application':get_env(gigalixir_getting_started, ecto_repos)), 'Elixir.Application':app_dir(gigalixir_getting_started, <<\"priv/repo/migrations\">>), up, [{all, true}])"
gigalixir rollback -r 335 bar
gigalixir_run upgrade 0.0.2 # 3f336 -> dba65a

for distillery 2.0

gigalixir rollback -r 376 -a bar
docker run --rm -P -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN gigalixir-run init bar foreground
gigalixir_run distillery_eval -- "Ecto.Migrator.run(List.first(Application.get_env(:gigalixir-getting-started, :ecto_repos)), Application.app_dir(:gigalixir-getting-started, \"priv/repo/migrations\"), :up, all: true)"

then exec into the container and run

docker exec -it $(docker ps | awk '/gigalixir-run/ { print $1 }') /bin/bash

gigalixir_run run -- remote_console 

for bootstrap

docker run --rm -p 4000:4000 -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar -e [email protected] -e MY_COOKIE=123 -e REPLACE_OS_VARS=true gigalixir-run bootstrap gigalixir_getting_started "REDACTED" foreground

# for api

export SECRET_KEY_BASE=
export SLUG_URL=
docker run --rm -p 4000:4000 -e APP_KEY=$APP_KEY -e MY_POD_IP=127.0.0.1 -e ERLANG_COOKIE=123 -e LOGPLEX_TOKEN=$LOGPLEX_TOKEN -e REPO=bar -e SECRET_KEY_BASE=$SECRET_KEY_BASE -e REPLACE_OS_VARS=true gigalixir-run api bar gigalixir_getting_started "$SLUG_URL" foreground

Deploy

docker build --rm -t us.gcr.io/gigalixir-152404/run .
gcloud docker -- push us.gcr.io/gigalixir-152404/run
 
# for heroku-16, use
docker build --rm -t us.gcr.io/gigalixir-152404/run-16 . -f Dockerfile.heroku-16
gcloud docker -- push us.gcr.io/gigalixir-152404/run-16

# for heroku-18, use
docker build --rm -t us.gcr.io/gigalixir-152404/run-18 . -f Dockerfile.heroku-18
gcloud docker -- push us.gcr.io/gigalixir-152404/run-18

gigalixir-run's People

Contributors

jesseshieh avatar tomconroy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.