- First you need to set up your Google Cloud Instance
- When you set up a cloud account you will get $300 credit!
- You will need to go to Google Cloud Platform
- Then to console where you can set up your compute engine
- Watch this video for help with inital setup video
- You should only need machine-type f1-micro (1 vCPU, 0.6 GB memory)
- This will help make your $300 credit last longer
- I prefer to do this on my local machine but you can also do it in browser within a shell
- Install gcloud sdk on your local machine.. steps are here
- There will be a generated ssh that you can copy and paste into your terminal to ssh into your vm instance using gcloud
- Once you're inside your instance within your terminal it should look something like this
- Awesome instructions here
- Very easy and can be completed in < 10 minutes
- Be sure to create a secure password if you choose to configure remote access (recommended >= 32 characters)
- Find your external IP on your VM console (needed for the HOST env variable)
- Awesome instructions here
- My tl;dr instructions are below
- Note that you will likely need to add sudo infront of each command
- Quickest way to fix this when you get the permission denied error
- $ sudo !!
- This is a shortcut to run previous command but with super user permissions
# SCRIPT FOR CPUs ONLY
apt-get -y update
# If you have issues with this command, omit python-software-properties
apt-get -y --no-install-recommends install \
curl \
apt-utils \
python-software-properties \
software-properties-common
add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# If you need to add sudo as prefix to these commands be sure to add sudo in front of the "apt-key add -"
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-get update
apt-get install -y docker-ce
Check that install worked
- $ docker --version
- If this shows your docker version then you've successfully installed docker on your vm instance
- First check that git is installed
- $ git --version
- $ git clone https://github.com/abspen1/twitter-bot.git
- $ ls (check that the repo cloned into your instance)
- cd into twitter-bot directory
- $ sudo docker build -t bot .
$ sudo docker image ls
$ sudo docker run -d \
--name bot_name \
--restart unless-stopped \
-e CONSUMER_KEY="some consumer ID" \
-e CONSUMER_SECRET="some consumer secret KEY" \
-e KEY="some key ID" \
-e SECRET="some secret key ID" \
-e HOST="external ip address" \
-e REDIS_PASS="some password" \
-v $PWD:/work \
bot
- $ sudo docker container ls
- $ sudo docker logs bot_name