-
Notifications
You must be signed in to change notification settings - Fork 129
Google Cloud setup
NOTE: This is a very simple setup
From a fresh VM...
Setup docker
, you can do this quickly with:
$ curl https://get.docker.com | sudo sh
$ sudo usermod -aG docker $USER
# and then re-login
Checkout the repo on the google-cloud-storage
branch and prepare configuration:
$ sudo apt-get install git python-pip -y
$ sudo pip install docker-compose
$ git clone https://github.com/codalab/codalab-competitions.git
$ cd codalab-competitions
$ git checkout google-cloud-storage
$ cp .env_sample .env
Make sure your VM has the relevant ports open:
SSL_PORT
-
RABBITMQ_PORT
(if you will have remote workers connect to this queue) -
FLOWER_PORT
(if you want to view Flower logs to debug queues)
Create 2 buckets, 1 public and 1 private, for example:
coda-private
coda-public
Set bucket permissions so it is not publicly readable.
Set this CORS configuration:
[
{
"origin": ["*"],
"responseHeader": ["Content-Type"],
"method": ["GET", "PUT", "OPTIONS", "HEAD"],
"maxAgeSeconds": 3600
}
]
Set the public to publicly readable by all users:
Configure these lines in your .env
# Google Cloud Storage
DEFAULT_FILE_STORAGE=apps.web.storage.CodalabGoogleCloudStorage
GS_PUBLIC_BUCKET_NAME=coda-public
GS_PRIVATE_BUCKET_NAME=coda-private
GOOGLE_APPLICATION_CREDENTIALS=/app/certs/google-storage-api.json
This assumes your google-storage-api.json
api credentials are in the <project root>/certs
directory.
docker-compose up -d
You now have a compute worker and website all in one box. You probably want to disable the compute worker for production.
If there are any problems, try a restart:
docker-compose restart
To administrate the server, you can create a superuser:
$ docker exec -it django python manage.py createsuperuser