#PHOENIX IN CLOUD9
##Every now and then "maintenance":
Depending on how acitve you are, your Cloud 9 virtual instance may go to sleep from time to time. When this happens, couple things will go down with it too. Fret not, here is how to put them all back again:
- Reinitialize the environment(system) variables. In the console, make sure you are in the folder that holds your ".env" file and type:
source .env
. You can then check your system variables with the following console command:printenv
- You may also need to restart the DB service (if you installed on the same instance). For Postgresql, type the following in the console to do so:
sudo service postgresql start
To sum up:
source .env
sudo service postgresql start
##After creating any new project (or cloning one):
By default, Cloud9 blocks port 4000, so you'll need to change it (e.g. to port 8080). There is also a problem with the default encoding (UTF8 vs SQL_ASCII), but that can be fixed by changing the db "template" line (if you are using Postgresql).
In other words, make these changes in your config files (e.g. config/dev.exs):
# Configure your endpoint
config :what, What.Endpoint,
http: [port: 8080],
debug_errors: true,
...
# Configure your database
config :what, What.Repo,
adapter: Ecto.Adapters.Postgres,
...
template: “template0”,
...
##Cloud 9 Setup:
The original guide was made by Andres Perez and is here
- Install all dependencies:
sudo touch /etc/init.d/couchdb
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install -y elixir
mix local.hex
sudo apt-get install -y erlang
nvm install stable
nvm alias default stable
sudo apt-get install -y erlang-base-hipe erlang-dev erlang-eunit erlang-parsetools
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
sudo apt-get install -y inotify-tools
- Start the Postgres DB service:
sudo service postgresql start
- Change the Postgres password if needed:
sudo -u postgres psql
- That's it. You are ready to go.