Rough outline of setting up a Ubuntu server for deploying an Elixir app with Distillery.
ssh into server
ssh [email protected]
update packages
import fs from 'fs' | |
import path from 'node:path' | |
import process from 'node:process' | |
import micromatch from 'micromatch' | |
import type { Plugin } from 'vite' | |
export interface VitePluginTouchFileOptions { | |
touchFile: string | |
watchFiles: string | string[] | |
glob?: boolean |
Rough outline of setting up a Ubuntu server for deploying an Elixir app with Distillery.
ssh into server
ssh [email protected]
update packages
files: | |
"/etc/init/sidekiq.conf": | |
mode: "120400" | |
content: "/opt/elasticbeanstalk/support/conf/sidekiq.conf" | |
commands: | |
reload_initctl_for_sidekiq: | |
command: "initctl reload-configuration" |
files: | |
"/opt/elasticbeanstalk/support/conf/sidekiq.conf": | |
mode: "000755" | |
content: | | |
description "Elastic Beanstalk Sidekiq Upstart Manager" | |
start on runlevel [2345] | |
stop on runlevel [06] | |
# explained above | |
respawn | |
respawn limit 3 30 |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/pre/03_mute_sidekiq.sh": | |
mode: "000755" | |
content: | | |
#!/bin/bash | |
. /opt/elasticbeanstalk/support/envvars | |
PIDFILE=/var/app/containerfiles/pids/sidekiq.pid | |
if [ -f ${PIDFILE} ] | |
then | |
kill -USR1 `cat ${PIDFILE}` |
web: MIX_ENV=prod mix phoenix.server |
transport :websocket, Phoenix.Transports.WebSocket, timeout: 45_000 |
# ... | |
config :sling, Sling.Endpoint, | |
http: [port: {:system, "PORT"}], | |
url: [scheme: "https", host: "nameless-reaches-32969.herokuapp.com", port: 443], # substitute your app's name | |
cache_static_manifest: "priv/static/manifest.json", | |
secret_key_base: System.get_env("SECRET_KEY_BASE"), | |
check_origin: ["http://sling-chat.s3-website-us-west-2.amazonaws.com"] # substitute you frontend's domain | |
# ... |
// @flow | |
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { connectToChannel, leaveChannel, createMessage, loadOlderMessages } from '../../actions/room'; // add loadOlderMessages | |
import MessageList from '../../components/MessageList'; | |
import MessageForm from '../../components/MessageForm'; | |
import RoomNavbar from '../../components/RoomNavbar'; | |
import RoomSidebar from '../../components/RoomSidebar'; | |
type MessageType = { |
defmodule Sling.MessageView do | |
use Sling.Web, :view | |
def render("index.json", %{messages: messages, pagination: pagination}) do | |
%{ | |
data: render_many(messages, Sling.MessageView, "message.json"), | |
pagination: pagination | |
} | |
end |