We installed these open source services/tools as a part of the ethical network. We spent some time getting these two up and running on a single Ubuntu server (which is ideal if you are just starting up) using Docker. We wanted to share these codes so that others can benefit. All code in this Gist are covered by the MIT License.
- A machine running Ubuntu 18.04 that you have root access to
- with Docker Engine and Docker Compose installed
- Domain names (or subdomains) for the Mastodon and Shlink instances pointing to this machine.
- An e-mail delivery service or other SMTP server.
-
Setting up
nginx-proxy
withdocker-letsencrypt-nginx-proxy-companion
:-
Create
/var/nginx-proxy
directory andcd
into it:sudo mkdir /var/nginx-proxy cd /var/nginx-proxy
-
Create a new file named
docker-compose.yml
and paste in content fromnginx-proxy.docker-compose.yml
file in this gist. -
Download
nginx.tmpl
usingwget
:sudo wget https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl
-
Get
nginx-proxy
up and runningdocker-compose up -d
The process will start by downloading a few Docker images, and if things finish successfully, the output will end with the following:
Creating nginx-proxy ... Creating nginx-proxy ... done Creating nginx-proxy-gen ... Creating nginx-proxy-gen ... done Creating nginx-proxy-le ... Creating nginx-proxy-le ... done
-
-
Installing Mastodon:
-
Create
/var/mastodon
directory andcd
into it:sudo mkdir /var/mastodon cd /var/mastodon
-
Create a new file named
docker-compose.yml
and paste in content frommastodon.docker-compose.yml
file in this gist. -
Create a new file named
nginx.conf
and paste in content frommastodon.nginx.conf
file in this gist. -
Create empty
.env.production
file and set Mastodon as the ownersudo touch .env.production sudo chown 991:991 .env.production
-
Run mastodon interactive setup wizard:
docker-compose run --rm -e RAILS_ENV=production web bundle exec rake mastodon:setup
This will:
- Create a configuration file
- Run asset precompilation
- Create the database schema
The configuration file is saved as
.env.production
. You can review and edit it to your liking. Refer to the documentation on configuration. -
Getting Mastodon up and running
docker-compose up -d
The process will start by downloading a few Docker images, and if things finish successfully, the output will end with the following:
Creating mastodon_db_1 ... done Creating mastodon_redis_1 ... done Creating mastodon_sidekiq_1 ... done Creating mastodon_streaming_1 ... done Creating mastodon_web_1 ... done Creating mastodon_nginx_1 ... done
You should now be able to access your mastodon instance from browser using your domain.
-
-
Setting up Shlink
-
Create
/var/shlink
directory andcd
into it:sudo mkdir /var/shlink cd /var/shlink
-
Create a new file named
docker-compose.yml
and paste in content fromshlink.docker-compose.yml
file in this gist. -
Create a new file named
nginx.conf
and paste in content fromshlink.nginx.conf
file in this gist. -
Get Shlink up and running
docker-compose up -d
The process will start by downloading a few Docker images, and if things finish successfully, the output will end with the following:
Creating network "shlink_internal_network" with the default driver Creating shlink_redis ... done Creating shlink_postgres ... done Creating shlink_container ... done Creating shlink_nginx ... done
That's it. Learn more about using Shlink.
-
great work Raj!