mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-08 08:22:48 +00:00
added docker support
This commit is contained in:
22
.dockerignore
Executable file
22
.dockerignore
Executable file
@@ -0,0 +1,22 @@
|
||||
# App artifacts
|
||||
/_build
|
||||
/db
|
||||
/deps
|
||||
/*.ez
|
||||
|
||||
# Generated on crash by the VM
|
||||
erl_crash.dump
|
||||
|
||||
# Files matching config/*.secret.exs pattern contain sensitive
|
||||
# data and you should not commit them into version control.
|
||||
#
|
||||
# Alternatively, you may comment the line below and commit the
|
||||
# secrets files as long as you replace their contents by environment
|
||||
# variables.
|
||||
/config/dev.secret.exs
|
||||
/config/*.secret.json
|
||||
|
||||
uploads
|
||||
|
||||
/priv/static/*
|
||||
/client/node_modules
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,7 +13,7 @@ erl_crash.dump
|
||||
# Alternatively, you may comment the line below and commit the
|
||||
# secrets files as long as you replace their contents by environment
|
||||
# variables.
|
||||
/config/*.secret.exs
|
||||
/config/dev.secret.exs
|
||||
/config/*.secret.json
|
||||
|
||||
uploads
|
||||
|
||||
76
Dockerfile
Normal file → Executable file
76
Dockerfile
Normal file → Executable file
@@ -1,52 +1,36 @@
|
||||
# TODO: start of a docker file for build on a centos image
|
||||
FROM quay.io/concur_platform/centos:7.3.1611-4390ad7
|
||||
MAINTAINER https://github.com/concur/docker-centos-elixir
|
||||
LABEL Description="Build image with Erlang 20.2 | Elixir 1.5.2"
|
||||
FROM node:8.12-alpine
|
||||
|
||||
ENV LANG=en_US.UTF-8 ELIXIR_VERSION=1.5.2 ERLANG_VERSION=20.2
|
||||
WORKDIR /root
|
||||
WORKDIR /home/client
|
||||
ADD ./client .
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
RUN yum -y install epel-release && \
|
||||
yum -y install gcc gcc-c++ glibc-devel make ncurses-devel wget \
|
||||
openssl-devel autoconf java-1.8.0-openjdk-devel \
|
||||
git wxBase.x86_64 unzip which && \
|
||||
yum clean all && \
|
||||
localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
RUN curl -OLS --compressed https://raw.githubusercontent.com/kerl/kerl/master/kerl && \
|
||||
chmod a+x /root/kerl && \
|
||||
/root/kerl update releases && \
|
||||
/root/kerl build $ERLANG_VERSION $ERLANG_VERSION && \
|
||||
/root/kerl install $ERLANG_VERSION /usr/lib/erlang && \
|
||||
/root/kerl cleanup all && \
|
||||
ln -s /usr/lib/erlang/bin/ct_run /usr/bin/ct_run && \
|
||||
ln -s /usr/lib/erlang/bin/dialyzer /usr/bin/dialyzer && \
|
||||
ln -s /usr/lib/erlang/bin/epmd /usr/bin/epmd && \
|
||||
ln -s /usr/lib/erlang/bin/erl /usr/bin/erl && \
|
||||
ln -s /usr/lib/erlang/bin/erlc /usr/bin/erlc && \
|
||||
ln -s /usr/lib/erlang/bin/escript /usr/bin/escript && \
|
||||
ln -s /usr/lib/erlang/bin/run_erl /usr/bin/run_erl && \
|
||||
ln -s /usr/lib/erlang/bin/start /usr/bin/start && \
|
||||
ln -s /usr/lib/erlang/bin/start_erl /usr/bin/start_erl && \
|
||||
ln -s /usr/lib/erlang/bin/to_erl /usr/bin/to_erl && \
|
||||
ln -s /usr/lib/erlang/bin/typer /usr/bin/typer
|
||||
FROM elixir:1.7.3-alpine
|
||||
|
||||
RUN curl -OLS --compressed https://github.com/elixir-lang/elixir/releases/download/v$ELIXIR_VERSION/Precompiled.zip && \
|
||||
unzip -o -d /usr/lib/elixir Precompiled.zip && \
|
||||
rm Precompiled.zip && \
|
||||
ln -s /usr/lib/elixir/bin/elixir /usr/bin/elixir && \
|
||||
ln -s /usr/lib/elixir/bin/mix /usr/bin/mix && \
|
||||
ln -s /usr/lib/elixir/bin/elixirc /usr/bin/elixirc && \
|
||||
ln -s /usr/lib/elixir/bin/iex /usr/bin/iex && \
|
||||
mix local.hex --force && \
|
||||
mix local.rebar --force && \
|
||||
mix hex.info
|
||||
WORKDIR /home
|
||||
|
||||
# TODO: install yarn
|
||||
# RUN curl -OLS --compressed https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz && \
|
||||
# tar xpvf node-v6.10.3-linux-x64.tar.xz && \
|
||||
# mv /root/node-v6.10.3-linux-x64 /usr/lib/node && \
|
||||
# ln -s /usr/lib/node/bin/node /usr/bin/node && \
|
||||
# ln -s /usr/lib/node/bin/npm /usr/bin/npm
|
||||
ADD . .
|
||||
COPY --from=0 /home/priv/static /home/priv/static
|
||||
|
||||
CMD "/bin/bash"
|
||||
RUN apk add alpine-sdk
|
||||
|
||||
ENV MIX_ENV=prod
|
||||
ENV REPLACE_OS_VARS=true
|
||||
|
||||
RUN mix local.hex --force
|
||||
RUN mix local.rebar --force
|
||||
RUN mix deps.get
|
||||
RUN mix deps.compile
|
||||
RUN mix release --env=prod
|
||||
|
||||
FROM alpine:3.8
|
||||
|
||||
RUN apk update
|
||||
RUN apk add bash openssl-dev
|
||||
|
||||
ENV REPLACE_OS_VARS=true
|
||||
|
||||
WORKDIR /home
|
||||
|
||||
COPY --from=1 /home/_build /home/_build
|
||||
|
||||
22
README.md
22
README.md
@@ -45,28 +45,6 @@ Made with:
|
||||
docker run --name postgres1 -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
|
||||
```
|
||||
|
||||
# Postgres setup
|
||||
[Setup on Centos7](https://linode.com/docs/databases/postgresql/how-to-install-postgresql-relational-databases-on-centos-7/)
|
||||
|
||||
Change password to postgres user
|
||||
```
|
||||
sudo -u user_name psql db_name
|
||||
|
||||
or
|
||||
|
||||
ALTER USER postgres WITH PASSWORD 'new_password';
|
||||
```
|
||||
|
||||
Edit /var/lib/pgsql/data/pg_hba.conf
|
||||
|
||||
```
|
||||
local all all trust
|
||||
```
|
||||
|
||||
```
|
||||
systemctl restart postgresql
|
||||
```
|
||||
|
||||
# Battlenet API
|
||||
Battlenet required https for a redirect for authentication. I use caddy for https proxy during development.
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ use Mix.Config
|
||||
# kept out of version control and might be hard to recover
|
||||
# or recreate for your teammates (or yourself later on).
|
||||
config :myapp, MyAppWeb.Endpoint,
|
||||
secret_key_base: "TODO:"
|
||||
secret_key_base: "${SECRET_KEY_BASE}"
|
||||
|
||||
# Configure your database
|
||||
config :myapp, MyApp.Repo,
|
||||
adapter: Ecto.Adapters.Postgres,
|
||||
hostnamae: "localhost",
|
||||
username: "postgres",
|
||||
password: "postgres",
|
||||
hostname: "${DB_HOST}",
|
||||
username: "${DB_USER}",
|
||||
password: "${DB_PASS}",
|
||||
database: "myapp_prod",
|
||||
template: "template0",
|
||||
pool_size: 15
|
||||
@@ -24,20 +24,20 @@ config :myapp, MyApp.Repo,
|
||||
# Secret key. You can use `mix guardian.gen.secret` to get one
|
||||
config :myapp, MyApp.Guardian,
|
||||
issuer: "myapp",
|
||||
secret_key: "TODO:"
|
||||
secret_key: "${GUARDIAN_SECRET}"
|
||||
|
||||
config :myapp,
|
||||
bnet_client_id: "",
|
||||
bnet_client_secret: "",
|
||||
bnet_redirect_uri: "",
|
||||
bnet_client_id: "${BNET_CLIENT_ID}",
|
||||
bnet_client_secret: "${BNET_CLIENT_SECRET}",
|
||||
bnet_redirect_uri: "${BNET_REDIRECT_URI}",
|
||||
|
||||
# admin login credentials for site
|
||||
admin_accounts: [
|
||||
%{
|
||||
"username" => "",
|
||||
"password" => "",
|
||||
"character_name" => "",
|
||||
"character_avatar" => "",
|
||||
"permissions" => ""
|
||||
"username" => "${ADMIN_USERNAME}",
|
||||
"password" => "${ADMIN_PASSWORD}",
|
||||
"character_name" => "${ADMIN_CHAR_NAME}",
|
||||
"character_avatar" => "${ADMIN_CHAR_AVATAR}",
|
||||
"permissions" => "${ADMIN_PERMISSIONS}"
|
||||
},
|
||||
]
|
||||
@@ -1,11 +0,0 @@
|
||||
# this script is to copy the built project to a production server
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
ssh -i prod_ssh_key root@10.1.96.4 "mkdir /home/$1";
|
||||
scp -i prod_ssh_key -pr ./_build root@10.1.96.4:/home/$1/_build;
|
||||
scp -i prod_ssh_key ./run_prod.sh root@10.1.96.4:/home/$1/run_prod.sh;
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo 'Please add version number as an argument'
|
||||
|
||||
4
docker-build.sh
Executable file
4
docker-build.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
version=$(git describe --tags)
|
||||
|
||||
docker build -t mgerb/classic-wow-forums:latest .
|
||||
docker tag mgerb/classic-wow-forums:latest mgerb/classic-wow-forums:$version
|
||||
22
docker-compose.yml
Executable file
22
docker-compose.yml
Executable file
@@ -0,0 +1,22 @@
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
cwf:
|
||||
image: mgerb/classic-wow-forums:latest
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
- DB_HOST=
|
||||
- DB_USER=
|
||||
- DB_PASS=
|
||||
- SECRET_KEY_BASE=
|
||||
- GUARDIAN_SECRET=
|
||||
- BNET_CLIENT_ID=
|
||||
- BNET_CLIENT_SECRET=
|
||||
- BNET_REDIRECT_URI=
|
||||
- ADMIN_USERNAME=
|
||||
- ADMIN_PASSWORD=
|
||||
- ADMIN_CHAR_NAME=
|
||||
- ADMIN_CHAR_AVATAR=
|
||||
- ADMIN_PERMISSIONS=
|
||||
command: sh -c "_build/prod/rel/myapp/bin/myapp migrate && _build/prod/rel/myapp/bin/myapp seed && _build/prod/rel/myapp/bin/myapp foreground"
|
||||
4
docker-push.sh
Normal file
4
docker-push.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
version=$(git describe --tags)
|
||||
|
||||
docker push mgerb/classic-wow-forums:latest
|
||||
docker push mgerb/classic-wow-forums:$version
|
||||
2
mix.exs
2
mix.exs
@@ -5,7 +5,7 @@ defmodule MyApp.Mixfile do
|
||||
[
|
||||
app: :myapp,
|
||||
version: "1.1.0",
|
||||
elixir: "~> 1.5.2",
|
||||
elixir: "~> 1.7.3",
|
||||
elixirc_paths: elixirc_paths(Mix.env),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers,
|
||||
start_permanent: Mix.env == :prod,
|
||||
|
||||
14
mix.lock
14
mix.lock
@@ -1,4 +1,5 @@
|
||||
%{"argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
%{
|
||||
"argon2_elixir": {:hex, :argon2_elixir, "1.2.14", "0fc4bfbc1b7e459954987d3d2f3836befd72d63f3a355e3978f5005dd6e80816", [], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [], [], "hexpm"},
|
||||
"cachex": {:hex, :cachex, "2.1.0", "fad49b4e78d11c6c314e75bd8c9408f5b78cb065c047442798caed10803ee3be", [], [{:eternal, "~> 1.1", [hex: :eternal, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [], [], "hexpm"},
|
||||
@@ -6,10 +7,10 @@
|
||||
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [], [], "hexpm"},
|
||||
"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [], [], "hexpm"},
|
||||
"db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
|
||||
"decimal": {:hex, :decimal, "1.4.1", "ad9e501edf7322f122f7fc151cce7c2a0c9ada96f2b0155b8a09a795c2029770", [], [], "hexpm"},
|
||||
"db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
|
||||
"decimal": {:hex, :decimal, "1.5.0", "b0433a36d0e2430e3d50291b1c65f53c37d56f83665b43d79963684865beab68", [:mix], [], "hexpm"},
|
||||
"dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [], [], "hexpm"},
|
||||
"distillery": {:hex, :distillery, "1.5.2", "eec18b2d37b55b0bcb670cf2bcf64228ed38ce8b046bb30a9b636a6f5a4c0080", [], [], "hexpm"},
|
||||
"distillery": {:hex, :distillery, "1.5.5", "c6132d5c0152bdce6850fb6c942d58f1971b169b6965d908dc4e8767cfa51a95", [:mix], [], "hexpm"},
|
||||
"ecto": {:hex, :ecto, "2.2.7", "2074106ff4a5cd9cb2b54b12ca087c4b659ddb3f6b50be4562883c1d763fb031", [], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.4.0", "992f38fabe705bb45821a728f20914c554b276838433349d4f2341f7a687cddf", [], [], "hexpm"},
|
||||
"eternal": {:hex, :eternal, "1.2.0", "e2a6b6ce3b8c248f7dc31451aefca57e3bdf0e48d73ae5043229380a67614c41", [], [], "hexpm"},
|
||||
@@ -30,8 +31,9 @@
|
||||
"plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [], [], "hexpm"},
|
||||
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], [], "hexpm"},
|
||||
"postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"postgrex": {:hex, :postgrex, "0.13.5", "3d931aba29363e1443da167a4b12f06dcd171103c424de15e5f3fc2ba3e6d9c5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"},
|
||||
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [], [], "hexpm"},
|
||||
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [], [], "hexpm"},
|
||||
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [], [], "hexpm"},
|
||||
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [], [], "hexpm"}}
|
||||
"uuid": {:hex, :uuid, "1.1.8", "e22fc04499de0de3ed1116b770c7737779f226ceefa0badb3592e64d5cfb4eb9", [], [], "hexpm"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user