The super easy guide to running Steemit.com on your own machine! (Using Docker)

in #steemit8 years ago (edited)

Update: I have a github now, see https://steemit.com/steemit/@neoxian/running-steemit-locally-update

Hey Steemit! Do you want to post and use the steemit blockchain, but you don't want to browse to steemit.com ? Well with this guide, you'll be able to run steemit.com on your own machine and interact with the Steem blockchain that way.

And it's pretty easy! The only thing you need to know is how to run Docker.

Step 1: Get Docker

I wrote a guide here on Docker:
https://steemit.com/programming/@neoxian/neoxian-s-guide-to-docker

Step 2: Save this docker file:

#Version: 0.1.0

FROM ubuntu:16.04
LABEL maintainer "Neoxian"

RUN apt-get update

# some tools I like

RUN apt-get -y install vim
RUN apt-get -y install curl
RUN apt-get -y install git 

# grab steemit.com

WORKDIR "/root"

RUN git clone https://github.com/steemit/steemit.com
 

EXPOSE 3001 3002 3301 3306

WORKDIR "/root/steemit.com"

RUN mkdir tmp

RUN apt-get -y install nodejs
RUN apt-get -y install npm
RUN apt-get -y install build-essential libssl-dev

WORKDIR "/root"

RUN curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh

RUN bash install_nvm.sh

# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

WORKDIR "/root/steemit.com"

RUN source /root/.nvm/nvm.sh \
    && nvm install v6 \
    && npm install \
    && npm install -g babel-cli


WORKDIR "/root/steemit.com/config"

RUN cp steem-example.json steem-dev.json
RUN debconf-set-selections <<< 'mysql-server mysql-server/root_password password bob'
RUN debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password bob'
RUN apt-get -y install mysql-server

RUN service mysql start; mysql -u root --password=bob -e "create database steemit_dev;DROP USER 'root'@'localhost';CREATE USER 'root'@'%' IDENTIFIED BY '';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';FLUSH PRIVILEGES;"

RUN npm install -g sequelize sequelize-cli pm2 mysql

WORKDIR "/root/steemit.com/db"

RUN source /root/.nvm/nvm.sh \
    && service mysql start \
    && sequelize db:migrate 

WORKDIR "/root/steemit.com/config"

RUN source /root/.nvm/nvm.sh \
    && node -p "crypto.randomBytes(32).toString('base64')" > key.txt

RUN sed -ie "s#somelongsecretstring#$(cat key.txt)#g" steem-dev.json

Use this to create "Dockerfile" and place it in a new directory.

Step 3: Build an image using the dockerfile

Go to the directory you put the dockerfile in and run this:

docker build -t="neoxian/steemweb" .

It will take around 5-10 minutes to build the image...

Step 4

Run your new image!

docker run --name steemweb -it -p 3001:3001 -p 3002:3002 -p 3306:3306 neoxian/steemweb /bin/bash

Step 5

Start up your own personal steemit.com webserver! (Takes a few minutes to start up)

cd /root/steemit.com
npm start

Step 6

Browse to localhost:3002

That's it! You're in. You can sign in normally and do everything normally.
The only thing that doesn't seem to work are user icons.


Why would you want to do this?

  • Could be more secure to use your own website
  • Don't like the interface, you can change it!
  • Don't like censorship? You can make your own version that shows everything, no matter what!
  • Like porn? You can make a version that shows you nothing but the non-work safe posts!

Oh the possibilities...

Sort:  
RUN source /root/.nvm/nvm.sh \
   && node -p "crypto.randomBytes(32).toString('base64')" > key.txt

#RUN sed -ie "s/somelongsecretstring/$(cat key.txt)/g" steem-dev.json

## Warning, big hack, if you can figure out how to get that sed command above to work
# let me know
RUN sed -ie 's/somelongsecretstring/KrddWYj8wPonvIpjfNvNyJiw8RfVyOfvEaeXcWeOMHI=/g' steem-dev.json

I guess the tricky part is that / is a valid character in a base64 string, so if there is a / is in key.txt, the sed command sometimes won't work. Try this:

RUN sed -ie "s#somelongsecretstring#$(cat key.txt)#g" steem-dev.json

It worked brilliantly.

Thanks! I'll try it.

You don't need to build it yourself... we provide official docker images for all branches:

https://hub.docker.com/r/steemit/steemit.com/

Can you build containers for bitshares and windows too?

There is a version of docker for windows, so you could run the above container in windows. A container could be made for bitshares. Can you run windows inside of a container? That I'm not sure about.

I know docker is running under windows.
But as far as I know a linux docker container cannot be run in a windows docker.
and no you cannot run the whole windows OS in a container.
so basically my question is if you could provide windows docker containers for BitShares and Steemit too?

But as far as I know a linux docker container cannot be run in a windows docker.

I just tried it now. It works. I am able to run my steemweb linux container in Windows. I did notice a little strangeness, so maybe it's not bug free, but it does seem to work.

You might not need nvm to install node 6.. Have a look around, it is working under this setup:

https://github.com/steemit/imagehoster/blob/a8bba5463a1c55a25f7be10f64d90835a8ec02cb/imagehoster/Dockerfile#L1

Cool thanks for the pointer.

how about hosting one's on website on the steem blockchain, how does that work?

Hmm, I'm not too sure how that would work.

This is awesome! Any idea what it would take to get this running for a proper steem wallet so we could create POW accounts?

This is fantastic.

Now to find some time to try it out ... :)

There is already a Dockerfile in the master branch of https://github.com/steemit/steemit.com - in fact, steemit.com is running off of it right now. :)

Your best bet is to use that one, overriding the config anywhere you diverge from ours. The defaults baked in should be good for most use cases, and tons is configurable via environment variables.

PS: It's on :8080 (main) and :8081 (webpack) now for compatibility with Google Cloud Shell development.

Thanks! Yes I did spot that. I'll definitely try to make use of that one.

How does this post have such a low payout.. ? This is GREAT info!

Thanks for this

Heh, thanks, I did work hard on this one. And i've posted songs that have made 7 dollars, that's Steemit for ya!

I can tell you put effort into this. Doing tutorial / walkthrough type posts can take a damn long time.

Bookmarked this and followed you.. Which I should have done a while ago. Cheer man.

Yea it a shame, this is fantastic, I was just going to see how to get Steemit.com working locally very soon to try out some tweaks, you've saved me a lot of time @neoxian ! 😆 👍 💯

you done flagging my shit too, or do you want some of this too bro. Because i've had enough ok. If your cool, cool. But there is going to be no more bullshit from anyone without backlashes in massive degree. I will not hold back anymore on anything. So do we got us a problem, or do we have us a truce. I leave your shit alone, you leave mine the fuck alone.

Hi, there is no need for me to flag you any more, seeing that you have an extremely low reputation now. If you read my post above, you will see that it is possible to run an un-censored version of steemit locally on your own machine.

i saw, i like your posts and work. I dont like how you stalked my list and above all i dont like how you made a call to make it harder for new users to grow. A better decision could have been made neoxian. I abused it only to have a voice after attacked. I don't see a rash pattern, nor was it something I enjoyed. Maybe look more into that man and make the right choice. Change weight limits per insert type man, but newcomers not having @ mentions to grow is wrong. Help me fix that please.

Understand that I only flag spam and plagiarism. I don't flag posts just because I don't like them. I'll accept your truce if there is any chance this will lead to better behavior from you. However, if I see anyone spamming or plagiarizing and their rep is above 2, I'm likely to flag them. I do this to help protect a system that I have a heavy investment in (check my wallet).

Dude, make that fair for them ill leave these behind. I will log out and the server will not hear from these 4 accounts again or the nonsense from them. Just wish me luck in a new one. It's a hardcore chain here. It's time for this to end for me, too. It's very tiring.

This was never about accounts neoxian. To any paying attention until now. I could have made 100 by now and done way more damage. It's about learning. It's also about moral points. And again, I could have left them and faded away into a new. This was a choice made and is made. You see flaws in the system, you change them. But do not change them in a manner where others can't grow. Remember this is a chain man. I know no one makes promises lately. But if you get that changed, I'll leave these accounts and this mess behind and won't speak of it. But make that fair decision for the people. DOn't take @ mentions away from them. Just make it so that they can only insert like 10 per post. Give them a chance before no chance leads to zero.

Regarding the @ mentions. My suggestion was to hide it for rep less then 0, not 40. It was implemented by someone else at 40. If it was done my way, then new people (with rep 25) would still be able to @ mention.

How can we influence the change of that to be fair? I know your a reputable person ok. I know why you followed. I know who the good guys are and the bad guys. But fixing this for everyone is my main concern right now. Things are getting very heated between me and klye and berni, I would like to focus on this as quick as we can if possible. You said you have influence, I'm asking your help. I saw you did suggest zero rep. Where from here...

Please do, as soon as I see the post, I will clean up and delete a "few perm" files, log out, and see you on the other side my friend. I know a lot about this blockchain, and I want to be a reputable contributing member now. In time you will know who I am. Until then, ty ~ Your the most honest, moral person I know on this server.

Just give me your word at least you will work on it, and try to make it fair again please. I trust you, and I know there is no instant fix.

Ok, if you like I can make a post about the @ mention issue. I don't have too much influence though.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.031
BTC 63422.01
ETH 2688.96
USDT 1.00
SBD 2.58