• This repository has been archived on 14/Oct/2019
  • Stars
    star
    135
  • Rank 269,297 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This bot can help you invest in memes and make a fortune out of it!

THIS IS A LEGACY CODEBASE

IMPORTANT: This is a legacy codebase for MIB. The deployment of this version has been discontinued since October 2019. Final versions can be submitted but this projects will be or is archived. Any regarding this, contact @thecsw

Welcome to meme investments!

Welcome to the source code repository of /u/MemeInvestor_bot. This bot has been developed exclusively for /r/MemeEconomy. It allows users to create investment accounts with fictional MemeCoins, invest those MemeCoins in specific memes, and automatically evaluate meme performance resulting in positive or negative returns.

1 Contributing

We welcome contributions from the public! If you'd like to help improve the bot, please fork our project and feel free to tackle any Issues. We also welcome feedback in the form of new issues, so feel free to create new ones for discussion.

2 Overview

The bot is implemented as a set of loosely-connected microservices written in Python and deployed with Docker. Each component handles a single job, such as:

  • Monitoring /r/MemeEconomy for new meme submissions
  • Monitoring /r/MemeEconomy for new commands to the bot
  • Running the database of investor and investment data
  • Monitoring the database for matured investments
  • Serving the website
  • Serving the REST API that provides data to the website

The following instructions will get a copy of the project up and running on your local machine for development and testing purposes.

3 Prerequisites

In order to run the bot, you'll need to install Docker. You may also need to generate Reddit API credentials for the bot (see below).

4 Configuration

After installing the prerequisites and cloning the project, you'll need to configure the bot. To do so, copy the .env.example file to .env and open it in the editor of your choice:

git clone https://github.com/MemeInvestor/memeinvestor_bot.git
cd memeinvestor_bot
cp .env.example .env
nano .env

Follow the instructions in .env to configure your test deployment. The instructions include steps for generating Reddit bot credentials, which are necessary for clients to fully access the Reddit API.

Once you've finished, save .env and exit. You're now ready to deploy the bot locally.

5 Deployment

From the root of the project directory, use docker-compose build to build all the microservices described above. Then use docker-compose up -d to launch them. This will spawn an empty investors database, spin up agents to monitor Reddit, and begin serving the informational website.

You should be able to view the website at http://localhost:2015. By default the stats will be boring (no investors and no investments) but you can interact with your test bot on Reddit to populate the database. Alternatively you can manually set up investor accounts by modifying the database with Python or a database manager like adminer.

6 Maintenance

Backing up the database

With the setup dockerized environment should work autonomously and non-stop. However, I would highly recommend to make regular database backups with our backup.sh script. The best way to do it is to install a cron job and make it run daily.

Here is the cron job that is running on our production server with crontab

0 0 * * * /path/to/memeinvestor_bot/backup.sh /path/to/memeinvestor_bot/backups

This job will be triggered every day at exactly 0 minutes and 0 hours.

Updating the deployment

Important thing is how you update the production database with the git repository. Here is the general way to do it.

git pull
docker-compose build
docker-compose up -d

It pulls the git repository, please make sure that you have the origin remote pointing to https://github.com/MemeInvestor/memeinvestor_bot After that it rebuilds all images and replaces the currently running ones with the freshly built. All the database data and other running containers' data will be safe in docker volumes. Do not forget to get rid of orphan images by docker image prune

And after that you can start tailing logs to see if everything is working smoothly with docker-compose logs -f --tail 10 Also, you can build individual modules by appending their alias to the docker-compose commands.

Working with the website container

Warning! When you rebuild your containers all the logs are lost. If you want to save them and especially the HTTP logs to track the website's stats, please follow the steps below to update HTTP separately and you can just append all other containers' names to the build procedure above

docker logs memeinvestor_bot_http_1 | tee -a ./http.log
docker-compose build http
docker-compose up -d http

Logs are saved to http.log that you can visualize them with goaccess and our .goaccess.caddy.conf

goaccess -f ./http.log -p ~/.goaccess.caddy.conf -o html > /tmp/report.html

Feel free to open the produced html file with any compatible browser. Even Netscape.

7 Built with

  • praw, a Python package that allows for simple access to Reddit's API.
  • fastnumbers, super-fast and clean conversions to numbers.
  • mysqlclient, a MySQL database connector for Python (with Python 3 support).
  • SQLAlchemy, a Python SQL toolkit and Object Relational Mapper.

8 Contributions

MemeInvestor_bot is a community-driven and community-supported project. We need you to keep it live and well. Thank you for all your support!

9 Authors

Active contributors

  • Sagindyk Urazayev - Core developer. Founder. Server, database, and system maintainer. Wrote API in Go. - thecsw
  • Alberto Ventafridda - Main front-end and web developer. Made our beautiful website. - robalb
  • Matt Bell - Back-end developer. Implemented firms and unit tests. - mappum
  • Jacob Padley - Back-end developer. Worked on Go rewrite, MIRA and new API features. - JPadley18
  • lukenamop - Outside contributor. Worked on firms expansion and new commands. - lukenamop
  • Keanu C. - Outside contributor. Implemented fixes and breaking changes to API and DB. - Keanu73

Past contributors

  • Dimitris Zervas - Back-end developer. Introduced Docker and Caddy. - dzervas
  • jimbobur - Our maths guy. Can make really pretty graphs. - jimbobur
  • rickles42 - Back-end and infrastructure developer. Heavy new features and debugging. - rickles42
  • TwinProduction - Heavy outside contributor. - TwinProduction
  • Leo Wilson - Ported our calculator to locally executed javascript.- leomwilson
  • tcmal - Added the daily profit ticker to our website.- tcmal
  • Matthew Sanetra - Added suffixes support to the invest commands.- matthewsanetra
  • Dylan Hanson - Various contributions to the API module.- jovialis
  • Timendum - Made !active to deeplink to the user's comment. - timendem

10 License

This project is licensed under the The GNU General Public License (see the LICENSE file for details), it explains everything pretty well.

More Repositories

1

mira

The fantastic Golang Reddit API wrapper for gophers
Go
63
star
2

prequelmemes_bot

Repository for u/prequelmemes_bot. Apply OCR techniques to find quotes from familiar films and movies
Python
36
star
3

MemePolice_bot

This is a bot for r/PewdiepieSubmissions. Moderate harmful submissions by applying OCR on graphical content
Python
26
star
4

darkness

The noblest static site generator 🥬
Go
26
star
5

ProtocolZero

Protocol Zero, inspired by an episode from South Park. Swiftly and completely remove your online accounts, as in reddit, email, etc.
Go
8
star
6

VMAGI

Write a performant emulator in 24 hours!
Go
6
star
7

komi

Komi - subarashii go pooling 🍡
Go
6
star
8

katya-dev

Katya or The Liberated Corpus a text corpus that allows you to request and scrape any web resource!
Go
5
star
9

rjokes

Telegram bot to send the best jokes from r/Jokes
Python
4
star
10

haruhi

GO HTTP from SOS Brigade 🐰
Go
4
star
11

collatz

Telegram for Collatz Conjecture
Python
3
star
12

gana

Generic library for my go programs
Go
3
star
13

pid

Daemonize your go programs
Go
2
star
14

.emacs.d

My emacs config
Emacs Lisp
2
star
15

certificates

Scripts to generate CAs and server/client certificates
Shell
2
star
16

thecsw.github.io

Sandys Website
HTML
2
star
17

connect4

✊ ✋ Some quick and dirty connect4 I did in JS 🔴 🟡
JavaScript
2
star
18

ku_secret_santa

Just a small code I wrote for the first KU secret santa
Python
1
star
19

oneiros

A new way of logging in
Go
1
star
20

analysis

Writing code to do stastistics
Go
1
star
21

rei

small collection of go functions I like for personal use
Go
1
star
22

unitex

Convert some simple tex into unicode
Go
1
star
23

nagito

Talk to monokuma to shorten URLs
Go
1
star
24

config-files

My config files have moved to https://github.com/thecsw/dotfiles
Shell
1
star
25

najimi-jetbrains

Najimi theme for jetbrains (specifically intelliji and java)
1
star
26

rsa-ee

Some RSA with C for EE
C
1
star
27

time

Foundation-based Holoscene timestamp
JavaScript
1
star
28

sandyuraz-preview

This repository is solely for storing the preview GIMP file for sandyuraz.com
1
star
29

sequelmemes_bot

u/sequelmemes_bot. Copy of u/prequelmemes_bot, don't tell anyone.
Python
1
star
30

sandypi

My repository with raspberry pi stuff
Python
1
star
31

monokuma

Sandy's URL Shortener
Go
1
star
32

sandissa-dev

Root repository for Sandissa, an IoT Security Project for EECS 700
Shell
1
star
33

sentock

💇‍♀️ Sentimental Stocks or "Stocks vs. Twitter Sentiments"
Go
1
star