![]() |
||
---|---|---|
assets | ||
config | ||
lib | ||
priv | ||
rel/overlays/bin | ||
test | ||
.dockerignore | ||
.formatter.exs | ||
.gitignore | ||
CODE_OF_CONDUCT.md | ||
Dockerfile | ||
LICENSE | ||
Procfile | ||
README.org | ||
ROADMAP.org | ||
compile | ||
elixir_buildpack.config | ||
fly.toml | ||
mix.exs | ||
mix.lock | ||
package-lock.json | ||
phoenix_static_buildpack.config |
README.org
Swanye
A tumblelog in the style of Tumblr.
Swanye is still incredibly pre-alpha software; it is highly unrecommended to run Swanye in anything other than a local setup, at this point in time.
Getting started
Swanye relies on a few dependencies:
In order to run Swanye, make sure you have these installed; basic,
out-of-the-box configuration should suffice to get Swanye working. Do
remember to create a user, in your database, for the username
and
password
defined under config/dev.exs.
With those installed, – to start your Phoenix server –:
- Install dependencies with
mix deps.get
- Create and migrate your database with
mix ecto.setup
-
Install Node.js dependencies with
npm install
inside theassets
directory- this is primarily to run the SASS monitor when developing which will build the CSS files we need for production
- JavaScript will be handled by Phoenix's
esbuild
- Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000">localhost:4000
from your
browser.
Ready to run in production? Please check Phoenix's deployment guides.
For Guix Users
Because mix
will try to build certain dependencies locally, you will
need the packages make
and gcc-toolchain
; you will also need to
prefix CC=gcc
for mix
commands as it will look for cc
before
gcc
, as well.
In order for Elixir to monitor the system as it runs, it will complain
about a lack of inotify-tools
and the RsaEx
dependency will expect
for openssl
to be executable for it.
For now, running guix shell elixir node mariadb make gcc-toolchain
inotify-tools openssl
should be sufficient to get you up and running,
I think (without polluting your profile with dependencies you probably
don't want to keep).
I am hoping to create a Guix file so you can just run guix shell
from the root of the project and not worry about the details but
haven't found the time, yet.
Production Deployment
Currently, I've been deploying this code via Heroku. I've been using the buildpacks Heroku Buildpack Elixir and Phoenix Static Buildpack.
The relevant files for the first buildpack are Procfile
and elixir_buildpack.config. Procfile
sets which environment is being used and holds the command to start
the project. elixir_buildpack.config
's most relevant bits are
setting the versions of both Erlang and Elixir.
The relevant files for the second buildpack is compile, overwriting
the default compile
script of Phoenix Static Buildpack. The main
difference from the default script is using mix "assets.deploy"
instead of mix "${phoenix_ex}.digest"
.
The SASS and JavaScript files under assets (in /css and /js, respectively) need to be generated so the processes handled by the files, above, need to be ensured if you try to run this code outside of a Heroku (with the aforementioned buildpacks) environment/situation.
Environment Variables
While MariaDB variables are already hardcoded so that the don't need to
be provided to connect to a database when running locally, the variables
MAILGUN_API_KEY
and MAILGUN_DOMAIN
must be provided for E-mail
functionality. Currently, Swanye is setup to use Mailgun to send
E-mails; obviously, providing greater choice (and, hopefully, more libre
options) is a desire, for the future.
DREAM_OBJECTS_ACCESS_KEY_ID
and DREAM_OBJECTS_SECRET_ACCESS_KEY
can
be provided to test image uploading and storage usage; you must have a
DreamObjects account for this, however.
Production environment variables in use are:
DREAM_OBJECTS_ACCESS_KEY_ID
– DreamObjects ID, for image storageDREAM_OBJECTS_SECRET_ACCESS_KEY
– DreamObjects Secret, for image storageMARIADB_USERNAME
– MariaDB username for database accessMARIADB_PASSWORD
– MariaDB password for database accessMARIADB_HOST
– MariaDB host/domain for database accessMARIADB_DATABASE
– MariaDB database name for database accessSECRET_KEY_BASE
– Used by Phoenix; generate withmix phx.gen.secret
MAILGUN_API_KEY
– Your Mailgun-given API keyMAILGUN_DOMAIN
– The Mailgun domain of your Mailgun accountPHX_HOST
(for Prod.) – The domain of your sitePORT
(optional) – The port you need your application to connect to, if not4000
Other places to find us
If you want to follow for updates about the development progress, general updates (including my thoughts about new features and how development is going) can be found at our Mastodon account.
If you're interested in helping support me so I can work on Swanye, the project also has a Liberapay.
Learn more about Phoenix
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix