Run your own Steemit locally with TESTNET Condenser

in #steemdev7 years ago

TestNet

Here is how to setup the condenser (the code that Steemit runs on) on your computer using the Steem testnet so you can make changes and debug the code without affecting real accounts on Steemit.

If you don't care about debugging locally then you can use the hosted testnet condenser here. https://condenser.steem.vc/

You can find the condenser here https://github.com/steemit/condenser follow the instructions to download the source code.

Refer to my previous post Understanding Steemit source code with Chrome DevTools for instructions how to run the source code in debug mode.

We're going to make an additional change before running the docker container to get it to connect to the testnet.

In package.json find the line

"start": "node scripts/check_translations.js; NODE_ENV=development ./node_modules/babel-cli/bin/babel-node.js ./webpack/dev-server.js",

and change it to

"start": "node scripts/check_translations.js; NODE_ENV=development SDC_ADDRESS_PREFIX=\"STX\" SDC_CHAIN_ID=\"79276aea5d4877d9a25892eaa01b0adf019d3e5cb12a97478df3298ccdd01673\" SDC_SERVER_STEEMD_URL=\"wss://testnet.steem.vc\" SDC_CLIENT_STEEMD_URL=\"wss://testnet.steem.vc\" ./node_modules/babel-cli/bin/babel-node.js ./webpack/dev-server.js",

We have now added the testnet connection strings. Notice how we escape the quotes in the environment var with \ so we don't break the string.

That's it. Now build the docker container again like i mentioned in the previous post.

docker build -t condenser .

And run it.

docker run -it -p 8080:8080 condenser

Now open Chrome and go to http://localhost:8080/

You will Steemit running on the testnet.

Testnet condenser

See nothing is trending because its the testnet.

You normal Steemit account wont work on the testnet. Account creation is disabled trough it so you still need to use the testnet API to create accounts, see here for instructions.

Now you can test what ever code you like locally and it wont affect Steemit.

Remember to upvote if you like this post and follow me for more posts about developing on Steem

Sort:  

Thanks for this. One small point - I found I needed to give the full path to my local folder that holds my local version of condenser before it would run.

So the 2nd command becomes:

docker run -it -p 8080:8080 githubusername/localrepo:branch

Glad to hear you got it working

Thanks, reading back my post it looks so easy. I don't want to admit how long I spent trying to work out why the hell it was not logging in. At least it forced me to learn how login works. =D

Congratulations @codewithcheese! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @codewithcheese! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the total payout received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Thanks. It will be better if we use ENV command in Dockerfile like this.

# CMD [ "yarn", "run", "production" ]

# uncomment the lines below to run it in development mode
ENV NODE_ENV development
ENV SDC_ADDRESS_PREFIX STX
ENV SDC_CHAIN_ID 79276aea5d4877d9a25892eaa01b0adf019d3e5cb12a97478df3298ccdd01673
ENV SDC_SERVER_STEEMD_URL "wss://testnet.steem.vc" 
ENV SDC_CLIENT_STEEMD_URL "wss://testnet.steem.vc"
CMD [ "yarn", "run", "start" ]

Hello, I have just setup a small local private TESTNET and am looking to setup Condenser as well to play around with. Your article is good, but I did not see any information on how to setup the database so that you have create logins on a local private TESTNET. Is this mainly geared towards the public TESTNET?