Skip to content

very-meanly/vc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VC

VC ("virtual content") is a tiny JEMSCI app that generates explorable dream worlds. It's built on top of the following machine vision libraries:

Set-up

  1. Spin up a g4dn.xlarge EC2 instance from the Deep Learning Base AMI (Ubuntu 18):
aws ec2 run-instances \
   --image-id ami-0bdd0109e841ac9fc \
   --count 1 \
   --instance-type g4dn.xlarge \
   --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=vc}]' \
   --key-name MyKeyPair

Bear in mind this costs more than 50c an hour, i.e. £9 a day or £270 per month, as long as the instance is running. All you need to do is stop the instance when you're not using it. It's a good idea to associate an Elastic IP to your instance.

To stop/start your instance, simply:

make start
make stop
  1. Create an S3 bucket for your results (the bucket name must be universally unique):
aws s3api create-bucket \
   --bucket unique-bucket-name \
   --region eu-west-1 \
   --create-bucket-configuration LocationConstraint=eu-west-1
  1. Add your new box to ~/.ssh/config:
Host vc
    HostName static.ip.goes.here
    User ubuntu
    IdentityFile path/to/your/key.pem
  1. SSH into the box:
ssh vc
  1. Set up your work dir:
sudo mkdir /opt/vc
sudo chown ubuntu:ubuntu /opt/vc

echo >> ~/.bashrc
echo "cd /opt/vc" >> ~/.bashrc
echo "source venv/bin/activate" >> ~/.bashrc
echo "export FLASK_APP=vc.app:app" >> ~/.bashrc
echo >> ~/.bashrc

cd /opt/vc
git clone https://github.com/alex-moon/vc.git .
./build.sh
  1. This will prompt you for a database password. You can make this whatever you'd like. Whatever you choose, cp .env.example .env and then edit .env appropriately, e.g. if you chose 5up3r53cr37 as your DB password, the relevant line in your .env would look like this:
SQLALCHEMY_DATABASE_URI=postgresql://vc:5up3r53cr37@127.0.0.1:5432/vc
  1. Don't forget to update the rest of your .env appropriately with your AWS credentials and unique bucket name.

  2. Move your nginx conf into place:

sudo cp nginx.unsecure.conf /etc/nginx/sites-enabled/vc.conf
sudo service nginx restart
  1. Move your supervisor conf into place:
sudo cp supervisor.conf /etc/supervisor/conf.d/vc.conf
sudo service supervisor restart
  1. Visit http://static.ip.goes.here in your browser

SSL

It's advisable to set up SSL certificates for your server. This requires you to have DNS set up and some familiarity with configuring nginx.

  1. Set up your SSL certs:
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot certonly --nginx
  1. Copy the secure conf into place:
sudo cp nginx.conf /etc/nginx/sites-enabled/vc.conf
  1. Modify /etc/nginx/sites-enabled/vc.conf to match your hostname and certificate filepaths. This should be as straightforward as replacing vc.ajmoon.uk with your domain name.

  2. Restart nginx:

sudo service nginx restart

Local development

If you want to work on the front-end locally, simply install node:

brew update
brew install node
npm install

And then run webpack:

make serve

And visit http://localhost:8000/ in your browser.

The typescript file that interacts with the API is app/ts/manager.ts - you'll notice a variable useDummyData defined at the top. If this is false, you'll need use a local proxy. To do so, simply replace vc.ajmoon.uk with your own domain name (as above) in webpack.config.js in the project root.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 82.2%
  • TypeScript 5.0%
  • Shell 3.1%
  • HTML 3.0%
  • SCSS 2.7%
  • Cuda 2.6%
  • Other 1.4%