I have been working on a long-running personal Phoenix project since Phoenix 1.0.2.Over the past year and a half or so, Phoenix and Elixir have undergone numerous changes,and some of them (okay most of them) broke my application code. Things really went southafter I found myself working on multiple different projects that were built on differentPhoenix versions. This reminded me a lot of the early Ruby and Rails days (and fightingrbenv and bundle).
This project was conceived to deal with the issues of running different Elixir and Phoenixversions and supporting the development of apps built with different Elixir and Phoenix versions.
After cloning this repository, open the folder in Visual Studio Code's Remote Extension to get afull Development Environment (with PostgreSQL Database) spun up automatically.
See https://code.visualstudio.com/docs/remote/containersfor more details.
It's so simple: just clone this repository.
You can specify a particular Phoenix version by targeting the corresponding release tag of this repository.
For instance, for a dockerized development environment for Phoenix 1.6.0 you could run:
git clone -b v1.6.2 https://github.com/nicbet/docker-phoenix ~/Projects/hello-phoenix
Follow this Github Gistto prepare a minimal Docker release image based on Alpine Linux (about 38MB for a Phoenix Webapp).
Navigate the to where you cloned this repository, for example:
cd ~/Projects/hello-phoenix
Initialize a new phoenix application. The following command will create a new Phoenix application called hello
under the src/
directory, which is mounted inside the container under /app
(the default work dir).
./mix phx.new . --app hello
Why does this work? The docker-compose.yml
file specifies that your local src/
directory is mapped inside the docker container as /app
. And /app
in the container is marked as the working directory for any command that is being executed, such as mix phoenix.new
.
NOTE: It is important to specify your app name through the --app <name>
option, as Phoenix will otherwise name your app from the target directory passed in, which in our case is .
NOTE: It is okay to answer Y
when phoenix states that the /app
directory already exists.
NOTE: Starting from 1.3.0 the mix phoenix.new
command has been deprecated. You will have to use the phx.new
command instead of phoenix.new
or mix deps.get
will fail!
Copy your existing code Phoenix application code to the src/
directory in the cloned repository.
NOTE: the src/
directory won't exist so you'll have to create it first.
The docker-compose.yml
file defines a database service container named db
running a PostgreSQL database that is available to the main application container via the hostname db
. By default Phoenix assumes that you are running a database locally.
Modify the Ecto configuration src/config/dev.exs
to point to the DB container:
# Configure your database
config :test, Test.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "test_dev",
hostname: "db",
pool_size: 10
When you first start out, the db
container will have no databases. Let's initialize a development DB using Ecto:
./mix ecto.create
If you copied an existing application, now would be the time to run your database migrations.
./mix ecto.migrate
Starting your application is incredibly easy, you can either run:
docker-compose up
or
./mix phx.server
Once up, it will be available under http://localhost:4000.
You may need to update config/dev.exs
and set the endpoint listen address to 0.0.0.0
like so:
config :hello_world, HelloWorldWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
http: [ip: {0, 0, 0, 0}, port: 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: "rM/QJOrRiW+3WWLw+lHJ8kUFJK/LTrwakSG/ftGYl8jYN0FKqfgS50l2C9BdKMoK",
watchers: [
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
]
To run commands other than mix
tasks, you can use the ./run
script.
./run iex -S mix
下载地址 https://gitee.com/assad/docker-hbase.git 项目介绍 基于 big-data-europe 的仓库代码修改,主要升级了 HBase 版本到 2.X, 增加 Phoenix 的配置,增加 HBase 对 Hadoop 共享库的配置,同时修改 HBase 组件由 http 下载为本地二进制包拷贝,减少构建过程中键盘被砸坏的风险。 主要组件版本如下: Ha
下载好了redis的tar包,然后导入redis镜像是报错open /var/lib/docker/tmp/docker-import-743441288/redis-3.0.7/json: no such file or directory,如下信息: [master@instance-2m5iiamd Redis]$ docker load < redis-3.0.7.tar.gz open
docker load导入镜像报错:open /var/lib/docker/tmp/docker-import-970689518/bin/json: no such file or directory 今天将之前打包好的mysql5.7.19的tar包通过docker load命令导入到Docker环境中却报出了如下错误: [root@host-10-10-10-6 task]# docker
1. 下载镜像到本地 docker pull plumewhite/hue:v2 2. 启动容器 2.1 直接启动 docker run -it -p 宿主机端口:容器内部服务端口 镜像ID bash docker run -it -p 1012:8888 7bea914601b4 bash 2.2 docker-compose启动 version: "2.1" services:
一、 问题现象 使用 docker load 加载镜像包的时候出现如下错误: 1.open /var/lib/docker/tmp/docker-import-837327978/bin/json: no such file or directory 二、问题分析 查阅资料发现这个由于 docker load 和 docker import 的区别导致. 因为压缩包如果是用 docker save
一、解决的问题 二、与虚拟机的比较 三、优势 四、使用场景 五、镜像与容器 参考资料 一、解决的问题 由于不同的机器有不同的操作系统,以及不同的库和组件,在将一个应用部署到多台机器上需要进行大量的环境配置操作。 Docker 主要解决环境配置问题,它是一种虚拟化技术,对进程进行隔离,被隔离的进程独立于宿主操作系统和其它隔离的进程。使用 Docker 可以不修改应用程序代码,不需要开发人员学习特定环
我检查了垃圾箱,里面没有ping
第一章 Docker介绍1 1.1 docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的\[Linux\]机器上,也可以实现\[虚拟化\]。容器是完全使用\[沙箱\]机制,相互之间不会有任何接口。 1.2 Docker是什么? Docker是一个程序运行、测试、交付的开放平台,Docker被设计为能够使你快速地交
推荐使用 Swoole 官方 Docker:https://github.com/swoole/docker-swoole
Docker Commands Commands Notes docker ps -a Show all containers on the system docker ps Show only currently running containers docker run <NAME> Creates & runs a docker container via an image docker i
环境准备 1. 下载镜像及配置文件 链接: https://pan.baidu.com/s/1hw0h1KUlhSirFBId6kh8mw 提取码: 1wng $ ls backend-0.0.8.tar.gz env.list grpc-go-greeting-0.1.tar.gz nginx-lb.conf nginx-perf.conf nginxplus-23-r1.tar.