Month: October 2017

Development Environment

Development Environment

Setting up a development environment can be a pain. Sometimes it can be harder than writing the app. Some resources can help you develop faster, but you need to learn how to configure it for what you know, and it’s worth it in the long run.

Gulp is one of those tools that speed up your development, and I’ve been using it for a few months. Gulp is excellent, but Webpack seems to be better and more straightforward to configure. There are still a few other node packages that you will need, such as Babel if you want to write your JavaScript in ES6.

I would like to create a boilerplate for future projects. It would need to contain some automation for PHP, JavaScript, and SCSS. And it would need to be able to test each of those. I’ve started building this boilerplate a couple of times, but I keep starting over. Hopefully, I will finish it soon.

It is worth taking the time to learn about each tool; it’s advantages and disadvantages. Spending a little bit of time planning will save you more time later.

Mounting DigitalOcean Spaces

Mounting DigitalOcean Spaces

I assume you have already created a Space and Droplet on DigitalOcean. If you haven’t, do that now, then come back to this post. In this example I’m using Ubuntu 16.04. I’ve also pointed a domain to this Droplet and put it behind Cloudflare, so Spaces can act as my file repository for my assets, and Cloudflare will deliver them.

Mounting Spaces on your Droplet

  1. SSH into your Droplet and run the following commands:
    • sudo apt-get install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config
    • git clone https://github.com/s3fs-fuse/s3fs-fuse.git
    • cd s3fs-fuse
    • ./autogen.sh
    • ./configure
    • make
    • sudo make install
  2. Next you need to create a file with your Spaces API Key and Secret Key
    • echo 'KEY:SECRET_KEY' > ~/.passwd-s3fs
    • chmod 600 ~/.passwd-s3fs
  3. Create a mountpoint for Spaces by running mkdir /spaces
  4. Then you need to append the following to your /etc/fstab file
    s3fs#BUCKET_NAME /spaces fuse allow_other,_netdev,nosuid,nodev,url=https://nyc3.digitaloceanspaces.com 0 0
    Be sure to replace BUCKET_NAME with your actual Spaces name
  5. After saving that file, run sudo mount -a .

Now you have unlimited storage capabilities on that Droplet. You could also install nginx and point the root directory to your Spaces mount point. Doing that would allow you to host as many assets as you want, without worrying about space. Maybe you can create the next Imgur.