Creating New Instance, Looking for Advice

Greetings,

I had a box I wasn’t using anymore and converted it to an Ubuntu 18.04 LTS, because I wanted to try to create my own Mastodon Instance for my extended family.

I have been slowly trying to create a new instance using a few tutorials I found online. First I tried one using docker (https://www.howtoforge.com/how-to-install-mastodon-social-network-with-docker-on-ubuntu-1804/amp/) and when that failed I thought I’d try following a few, mostly identical, tutorials for setting up without docker. No luck on either end, and, although I’m learning a lot, I think I’m going to have to start over from scratch.

Any pointers on how to start, whether to go with docker or not, and a good guide (written for a newb)?

Huge thanks!
dp

It would be good to say something about the problems you are having setting them up. Error messages can be very helpful in getting you going.

Thanks for the response. I have started from scratch using this code from github -GitHub - shleeable/mastodon_guide - but I am going line by line to make sure I dont miss any error messages. This approach uses docker and appears to be working better than my previous attempts.

I did run into a series of errors when I got to this line

docker-compose run --rm web rails assets:precompile

But when I manually entered the VAPID_PUBLIC_KEY and VAPID_PRIVATE_KEY, from the line of code I used from the howtoforge guide that worked out:

docker-compose run --rm web bundle exec rake mastodon:webpush:generate_vapid_key

Unfortunately, I ran into errors on the next line:

docker-compose run --rm web rails db:migrate

This was the start of the error output:

Starting live_redis_1 … done
Starting live_db_1 … done
rails aborted!
PG::ConnectionBad: could not translate host name “db” to address: Name or servic e not known

From what I can tell, I think this means I have an issue with postgresql, the .env.production file, or more likely both. Here is what I have for .env.production (the defaults):

DB_HOST=db
DB_USER=postgres
DB_NAME=postgres
DB_PASS=
DB_PORT=5432

Thank you. Any help is appreciated.

dp

Seems to be a networking config issue in docker. The container cannot resolve “db” into an IP address to connect. Docker networking seems like black magic to me.

Couple of things I would do starting from scratch though:

  1. I would use the official documentation starting from https://docs.joinmastodon.org/admin/prerequisites/ which I found pretty decent.

  2. I would not use docker if you have a dedicated VM or physical machine at your disposal. It really is a misapplication of docker and seems to handle any system issues with a sledgehammer. I ran into issues causing it to repeatedly terminate and restart my db container, which I believe led to index corruption on my database. I fixed the obvious corruption and moved totally off docker and everything runs way WAY better.

Hope you make progress… The more new instances out there the better!

I decided to grind on a little bit more with docker-compose, and I modified the .yml file to the following:

db:
restart: always
image: “postgres” # :9.6-alpine
env_file:
- database.env # configure postgres
networks:
- internal_network
healthcheck:
test: [“CMD”, “pg_isready”, “-U”, “postgres”]
volumes:
- ./postgres:/var/lib/postgresql/data

this is what I put it in database.env:

POSTGRES_USER=mastodon
POSTGRES_PASSWORD=mastodon_P@$$
POSTGRES_DB=mastodon_database

Then I modified .env.production to match it

DB_HOST=db
DB_USER=mastodon
DB_NAME=mastodon_database
DB_PASS=mastodon_P@$$
DB_PORT=5432

Following that I took docker-compose down and then built it again, and this time the db:migrate command worked with no errors.

So with that and another little tweek. The instance is running and when I log in (both internally and externally) I get the log in page.

I’m still not up and running, because I still haven’t received the authorization email. However, I’ll search the forum for an answer and maybe start a new post with the problem if I can’t figure it out.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.