From 0969da9ef911d4f61f892d2c31bf8b61fa9e244f Mon Sep 17 00:00:00 2001 From: Maygician Date: Sat, 3 Oct 2020 11:53:45 +0700 Subject: [PATCH] swap on ssd on GCP --- docker/docker-compose.yaml | 4 +++- docs/GCP deploy | 28 ++++++++++++++++++++++++++++ docs/deployment | 0 docs/dev env | 6 ++---- docs/notes | 2 ++ 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 docs/deployment create mode 100644 docs/notes diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 9f537ef..f15852d 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -5,4 +5,6 @@ services: build: context: ./elixir_dev ports: - - 4000:4000 \ No newline at end of file + - 4000:4000 + volumes: + - "./volumes/elixir:/elixir" \ No newline at end of file diff --git a/docs/GCP deploy b/docs/GCP deploy index e69de29..5e22113 100644 --- a/docs/GCP deploy +++ b/docs/GCP deploy @@ -0,0 +1,28 @@ +# commands from dev env should work. +# you'd need to add prod database to env, like this (don't use this exact one) +# export DATABASE_URL=ecto://postgres:postgres@localhost/gclp_dev +# and gen a secret: +export SECRET_KEY_BASE=`mix phx.gen.secret` +# open ports you want to use for prod in firewall rules(instance settings) +# then add port you want to env: +# export PORT=80085 #this one won't work, obviously. put proper one here +# as I'm using micro instance with ssd, let's add swap :c +# use blkid to get uuid +# add the folloving line: +# UUID=XXXX-XXXX-XXXX-XXXX-XXXX /gssd ext4 errors=remount-ro 0 1 +# to /etc/fstab +#sudo sed -e '2iUUID=XXXX-XXXX-XXXX-XXXX-XXXX \/gssd ext4 errors=remount-ro 0 1' -i /etc/fstab +#sudo sed -e '2iUUID=ba0f9619-0a64-4e35-9de0-0cd63af25c0c \/gssd ext4 errors=remount-ro 0 1' -i /etc/fstab +sudo mkfs.ext4 /dev/sdb +sudo mount -t ext4 /dev/sdb /gssd +sudo fallocate -l 4G /gssd/swapfile +sudo chmod 600 /gssd/swapfile +sudo mkswap /gssd/swapfile +sudo sed -e '2i\/gssd\/swapfile swap swap defaults 0 0' -i /etc/fstab +git clone https://github.com/GameCult/GCLP.git +cd GCLP +# git checkout pet # for now +cd lp +mix deps.get +mix deps.compile +mix ecto.create diff --git a/docs/deployment b/docs/deployment new file mode 100644 index 0000000..e69de29 diff --git a/docs/dev env b/docs/dev env index 9285d47..6baf850 100644 --- a/docs/dev env +++ b/docs/dev env @@ -4,14 +4,12 @@ # after that, just use ubuntu commands. # might use this, for skipping prompts during installation -export DEBIAN_FRONTEND=noninteractive +export DEBIAN_FRONTEND=noninteractive #not really helping # sudo apt-get install wget ca-certificates wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb sudo apt-get update -sudo apt-get install esl-erlang -sudo apt-get install elixir -sudo apt-get install inotify-tools nodejs npm yarn python git +sudo apt-get install esl-erlang elixir inotify-tools nodejs npm yarn python git mix local.hex --force mix local.rebar --force mix archive.install hex phx_new 1.5.5 diff --git a/docs/notes b/docs/notes new file mode 100644 index 0000000..410d552 --- /dev/null +++ b/docs/notes @@ -0,0 +1,2 @@ + in production, you would usually deal with static assets at application server layer, possibly not hitting Phoenix at all. + \ No newline at end of file