Skip to content

Commit

Permalink
Added devcontainer and readme details with elixir 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
matreyes committed Jun 18, 2022
1 parent 0ce3bdd commit 1e3556a
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 21 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM elixir:1.13.4

RUN apt update
RUN apt install -y nodejs npm
RUN apt install -y inotify-tools

RUN mix local.hex --force

RUN npm install --global yarn

WORKDIR /workspace
19 changes: 19 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "rauversion-phx",
"dockerComposeFile": [
"./docker-compose.yml"
],
"extensions": [
"jakebecker.elixir-ls"
],
"service": "rauversion-phx",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
"settings": {
"editor.formatOnSave": true,
"search.exclude": {
"**/doc": true
},
"elixirLS.dialyzerEnabled": false
}
}
34 changes: 34 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.7"
services:
db:
image: postgres:14.3
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
rauversion-phx:
environment:
PORT: 4000
DB_HOST: db
MIX_BUILD_ROOT: /opt/elixir-artifacts/_build
MIX_DEPS_PATH: /opt/elixir-artifacts/deps
build:
context: .
dockerfile: Dockerfile
ports:
- 4000:4000
volumes:
- ..:/workspace:delegated
- ~/.gitconfig:/root/.gitconfig
- ~/.gitignore:/root/.gitignore
- ~/.ssh:/root/.ssh
- elixir-artifacts:/opt/elixir-artifacts
command: sleep infinity

volumes:
elixir-artifacts: {}
db: {}
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
# Rauversion

To start your Phoenix server:

## setup

You can develop directly in a container with [vscode devcontainer](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) or [neovim devcontainer](https://github.com/jamestthompson3/nvim-remote-containers)

* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.setup`
* Create some fake accounts `mix fake_accounts`
* Compile assets `cd assets && yarn install & cd ..`
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.


# setup:

### fake accounts

iex -S mix fake_accounts


### images
## images

https://unsplash.com/photos/eXVd7gDPO9A
https://unsplash.com/photos/mbGxz7pt0jM
5 changes: 4 additions & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"@hotwired/stimulus": "^3.0.1",
"@rails/activestorage": "^6.0.5",
"stimulus-dropdown": "^2.0.0",
"wavesurfer": "^1.3.4"
"wavesurfer": "^1.3.4",
"phoenix": "^1.6.10",
"phoenix_html": "^3.2.0",
"phoenix_live_view": "^0.17.10"
},
"scripts": {
"deploy": "cd .. && mix assets.deploy"
Expand Down
15 changes: 15 additions & 0 deletions assets/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ hotkeys-js@>=3:
resolved "https://registry.yarnpkg.com/hotkeys-js/-/hotkeys-js-3.9.4.tgz#ce1aa4c3a132b6a63a9dd5644fc92b8a9b9cbfb9"
integrity sha512-2zuLt85Ta+gIyvs4N88pCYskNrxf1TFv3LR9t5mdAZIX8BcgQQ48F2opUptvHa6m8zsy5v/a0i9mWzTrlNWU0Q==

phoenix@^1.6.10:
version "1.6.10"
resolved "https://registry.yarnpkg.com/phoenix/-/phoenix-1.6.10.tgz#6a5d0a330b32070fb7f90b96efa1244ba7c4da08"
integrity sha512-KfYAJrrw95JGaOlvmZ+lFJZhSfQmo4SVOj6s175/V8YxqhYGO5EGacdrJxQmJ6uhaK4H3S6b0wkC1T33qU/d8Q==

phoenix_html@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/phoenix_html/-/phoenix_html-3.2.0.tgz#4a30e5c331a72abababa1f3b81a9fe2c0e5a43d7"
integrity sha512-zv7PIZk0MPkF0ax8n465Q6w86+sGAy5cTem6KcbkUbdgxGc0y3WZmzkM2bSlYdSGbLEZfjXxos1G72xXsha6xA==

phoenix_live_view@^0.17.10:
version "0.17.10"
resolved "https://registry.yarnpkg.com/phoenix_live_view/-/phoenix_live_view-0.17.10.tgz#ea8f849d9b49dd00f2f9a1468038d225c184279a"
integrity sha512-oHSoH0IdJ1I5uAYjH2A1KlBmwra6LgcUrHlAP3EEorrZyMpbhBJjNNhXxhBu6dmcxqnaAbwsIXMQRLi6KjJZIg==

spark-md5@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/spark-md5/-/spark-md5-3.0.2.tgz#7952c4a30784347abcee73268e473b9c0167e3fc"
Expand Down
4 changes: 2 additions & 2 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ config :rauversion, Rauversion.Repo,
username: "postgres",
password: "postgres",
database: "rauversion_phx_dev",
hostname: "localhost",
hostname: System.get_env("DB_HOST", "localhost"),
show_sensitive_data_on_connection_error: true,
pool_size: 10

Expand All @@ -18,7 +18,7 @@ config :rauversion, Rauversion.Repo,
config :rauversion, RauversionWeb.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: {127, 0, 0, 1}, port: 4000],
http: [ip: {0, 0, 0, 0}, port: 4000],
check_origin: false,
code_reloader: true,
debug_errors: true,
Expand Down
2 changes: 1 addition & 1 deletion config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ config :rauversion, Rauversion.Repo,
username: "postgres",
password: "postgres",
database: "rauversion_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: "localhost",
hostname: System.get_env("DB_HOST", "localhost"),
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10

Expand Down
10 changes: 4 additions & 6 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

defmodule Rauversion.MixProject do
use Mix.Project

def project do
[
app: :rauversion,
version: "0.1.0",
elixir: "~> 1.12",
elixir: "~> 1.13",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
Expand Down Expand Up @@ -54,15 +55,12 @@ defmodule Rauversion.MixProject do
{:faker, "~> 0.17", only: [:test, :dev]},
{:ecto_autoslug_field, "~> 3.0"},
{:dotenv, "~> 3.0.0", only: [:dev, :test]},
{:active_job, "0.1.1"},
{
:active_storage,
git: "https://github.com/chaskiq/ex-rails.git", sparse: "apps/active_storage"
},
{
:active_job,
"0.1.1"
}
# {:active_storage,
# {:active_storage,
# path: "/Users/michelson/Documents/chaskiq/chaskiq-phoenix/ex_rails/apps/active_storage"},
# {:active_job,
# path: "/Users/michelson/Documents/chaskiq/chaskiq-phoenix/ex_rails/apps/active_job"}
Expand Down

0 comments on commit 1e3556a

Please sign in to comment.