Manual Deploy
In your development machine:
Open your production env file with
amber encrypt
then edit the database URL, and disable or enable logs. Also see Encrypt.If you have assets and you're using NPM, use
npm install . && npm run release
to compile/minify.css
and.js
files.
In your production machine:
Install
crystal
andshards
commands (See installation guide). You can compilebin/amber
tool usingshards build amber
in your production project to migrate your database.Then copy your project repository and ensure to setup
AMBER_ENCRYPTION_KEY
andAMBER_ENV=production
in your environments variables. You can get your encryption key from.encryption_key
file in your development machine. Then inside your project's folder, install your shards dependencies withshards install --production
and compile your executable withshards build <your-app> --release
.Finally run your project executable with
bin/<your-app>
.
Also you can try to cross-compile to avoid install these dependencies but this feature is a bit buggy on most OS.
Alpine Linux is great to use crystal build --static
flag, though.
Compilation may take a while because --release
enables compiler optimizations. You can avoid --release
if you server is low end (less 256 RAM)
Amber performance is still acceptable on non-release mode
You may need sudo permission if you're using port 80 or ports < 1000
You can use iptables
to redirect port 80 to 8080 or whatever port are you using in production.
Optionally you can setup a system service to monitor your app very easy, and configure a .git/hook/post-receive
to deploy like Heroku using git push production
. Amber Team is already using a systemd service to manage Amber Framework Website and thepost-receive
hook below to manage deployment using git.
Then add your production repository to your development machine using git remote add
<user>
is a valid user with your public ssh key inside~/.ssh/authorized_keys
<ip>
is your production machine IP (you can use a domain as well).<repository>
is your project with your.git
folder inside.
Last updated