rocu.de
About me Archive Replies Imprint Privacy Also on Micro.blog
  • How to install your SSH key on a remote server

    1. Nice way

    You can install an SSH key by executing

    ssh-copy-id user@servername.com
    

    Now you can log in to the remote server with your password and ssh-copy-id will do the rest.

    2. Manual way

    Append your public ssh key to the authorized_key file on the server.

    As a one-liner:

    cat ~/.ssh/id_rsa.pub | ssh user@servername.com 'cat>> ~/.ssh/authorized_keys' 
    

    Conclusion

    Both commands pretty much do the same. The first way is way easier though.

    The next time you can connect to the server using your SSH key.

    ssh user@servername.com    
    
    → 7:00 PM, Oct 26
  • Rails: Preview your emails with MailCatcher

    Do you know the feeling of copy and pasting the signup-link from this development.log? There’s a better way to do this.

    For our development environment, we use MailCatcher.

    MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run MailCatcher, set your favorite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that’s arrived so far.

    In this blogpost, I show you how we set it up in our projects.

    MailCatcher is a wonderful way to preview all the mails your Rails App sends in the development environment.

    Installation

    Add MailCatcher and Foreman to your Gemfile :

    group :development do
      gem 'mailcatcher'
      gem 'foreman'
    end
    

    Run bundle install.

    Create a file named Procfile. This is used to start Rails and MailCatcher together with one simple command.

    web: rails s
    mail: mailcatcher -f
    

    The last step is to configure Rails to send emails to MailCatcher:

    Add these 2 lines to your config/environments/development.rb.

    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
    

    Now you can run foreman start every time you want to start Rails.

    This will start Rails and MailCatcher (which listens on port 1080).

    Using MailCatcher

    Every time Rails sends an email, MailCatcher will receive it and display it on at http://localhost:1080/.

    You can toggle between the HTML and the text portion of the email, and even inspect the source.

    And what if I do not use Rails?

    Good news for you. You can also use MailCatcher without Rails.

    1. Just install MailCatcher via gem install mailcatcher
    2. Point your application to send mails via SMTP to port 1025.
    3. Run mailcatcher.
    4. Go to http://localhost:1080/.

    Conclusion

    MailCatcher is one of these tools that we end up using whenever we start to send emails in a new project. I hope you like it as well.

    → 8:00 PM, Oct 22
  • Host your emails with Mail-in-a-Box

    At our cooperative (TechGenossen) we used Gmail as our Email-Provider at first. But we found Gmail to be too expensive for our many members.

    So, we decided to self-host our emails.

    Setting up your email server can be quite hard and involves many moving parts. Fortunately, we found Mail-in-a-Box, a fantastic open-source project, which helps you set up a mail server in no time.

    Mail-in-a-Box lets you become your mail service provider in a few easy steps. It’s somewhat like making your own Gmail, but one you control from top to bottom.

    Technically, Mail-in-a-Box turns a fresh cloud computer into a working mail server. But you don’t need to be a technology expert to set it up.

    Source: mailinabox.email

    Mail-in-a-Box features an

    • IMAP-Server
    • An easy to use Control-Panel
    • Nextcloud for contacts
    • Roundcube for webmail

    It is easy to set up on fresh Ubuntu 14.04. machine.

    curl -s https://mailinabox.email/setup.sh | sudo bash

    The software will guide you through the installation.

    All you have to do is change some DNS-Records and voilà — it works out of the box.

    As the admin of the server, you regularly receive emails about how to maintain the box.

    I am pleased with the mail server and with the project.

    → 8:00 AM, Oct 22
  • RSS
  • JSON Feed
  • Surprise me!