diff --git a/documentation/docs/Developers_and_Administrators/Codabench-Installation.md b/documentation/docs/Developers_and_Administrators/Codabench-Installation.md index 1f100a571..c0a23f418 100644 --- a/documentation/docs/Developers_and_Administrators/Codabench-Installation.md +++ b/documentation/docs/Developers_and_Administrators/Codabench-Installation.md @@ -23,7 +23,9 @@ cd codabench cp .env_sample .env ``` -Then edit the necessary settings inside. The most important are the database, storage, and Caddy/SSL settings. For a quick local setup, you should not need to edit this file. +Then edit the necessary settings inside. The most important are the database, storage, and Caddy/SSL settings. For a quick **local** setup, you should not need to edit this file. For a [public server deployment](How-to-deploy-Codabench-on-your-server.md), you will have to modify some settings. + +!!! warning "It is important to change the default passwords if you intend for the instance to be public" If you are using `AWS_S3_ENDPOINT_URL=http://minio:9000/` in your `.env`, edit your `/etc/hosts` file by adding this line `127.0.0.1 minio` @@ -79,6 +81,8 @@ To enable SSL: - If you already have a DNS for your server that is appropriate, in the `.env` simply set `DOMAIN_NAME` to your DNS. Remove any port designation like `:80`. This will have Caddy serve both HTTP and HTTPS. +!!! warning "For a public instance, HTTPS is strongly recomended" + ### Validate user account on local instance When deploying a local instance, the email server is not configured by default, so you won't receive the confirmation email during signup. @@ -135,6 +139,12 @@ To set up remote compute workers, you can follow the steps described in our ## Troubleshooting -Read the following guide for troubleshooting: [How to deploy Codabench](How-to-deploy-Codabench-on-your-server.md). +Read the following guide for troubleshooting: [How to deploy Codabench](How-to-deploy-Codabench-on-your-server.md#frequently-asked-questions-faqs). + +Also, adding `DEBUG=True` to the `.env` file can help with troubleshooting the deployment. + +Open a [Github issue](https://github.com/codalab/codabench/issues) to find help with your installation + +## Online Deployement -Also, adding `DEBUG=True` to the `.env` file can help with troubleshooting the deployment. \ No newline at end of file +For information about online deployment of Codabench, go to the [following page](How-to-deploy-Codabench-on-your-server.md) \ No newline at end of file diff --git a/documentation/docs/Developers_and_Administrators/How-to-deploy-Codabench-on-your-server.md b/documentation/docs/Developers_and_Administrators/How-to-deploy-Codabench-on-your-server.md index 266e0261f..7825ad297 100644 --- a/documentation/docs/Developers_and_Administrators/How-to-deploy-Codabench-on-your-server.md +++ b/documentation/docs/Developers_and_Administrators/How-to-deploy-Codabench-on-your-server.md @@ -1,37 +1,35 @@ ## Overview This document focuses on how to deploy the current project to the local machine or server you are on. -## Pull codabench develop branch code locally +## Preliminary steps -You need to complete the following steps +As for the [minimal local installation](Codabench-Installation.md), you first need to: -- Generate ssh keys on your machine. -- Add the ssh key into the Github account. -- Cloning the repository locally. - - git clone [https://github.com/codalab/codabench.git](https://github.com/codalab/codabench.git) +1. Install docker and docker-compose (see [instructions](Codabench-Installation.md#pre-requisites)) -## Installing docker and common docker commands +2. Clone Codabench repository: + +```sh +git clone https://github.com/codalab/codabench +``` -- Install the [official](https://docs.docker.com/engine/install/ubuntu/) version of docker (preferably not the `snap` version) ## Modify .env file configuration -- Go to the folder where codabench is located then run the following command to generate an `.env` file to set the environment variables required by the service +Then you need to modify the `.env` file with the relevant settings. This step is critical to have a working and secure deployment. + +- Go to the folder where codabench is located (`cd codabench`) ```bash cp .env_sample .env ``` -In the `.env` file, edit the following variables. +Then edit the variables inside the `.env` file. -a) For a local deployment it looks like this: +### Submissions endpoint +For an online deployment, you'll need to fill in the IP address or domain name in some environment variables. -```ini title=".env" -SUBMISSIONS_API_URL=localhost -#SUBMISSIONS_API_URL=http://django:8000/api -DOMAIN_NAME=localhost:80 -AWS_S3_ENDPOINT_URL=http://minio:9000 -``` +#### Using an IP address b) For an online deployment using IP address: !!! note @@ -51,16 +49,41 @@ DOMAIN_NAME=:80 AWS_S3_ENDPOINT_URL=http:/// ``` -c) For an online deployment using domain name: +#### Using a domain name (DNS) ```ini title=".env" -SUBMISSIONS_API_URL=https://codabench-test.yourdomain.com/api -DOMAIN_NAME=codabench-test.yourdomain.com -AWS_S3_ENDPOINT_URL=https://minio-test.yourdomain.com +SUBMISSIONS_API_URL=https://yourdomain.com/api +DOMAIN_NAME=yourdomain.com +AWS_S3_ENDPOINT_URL=https://yourdomain.com ``` !!! tip "If you are deploying on an azure machine, then AWS_S3_ENDPOINT_URL needs to be set to an IP address that is accessible on the external network" + +### Change default usernames and passwords + +Set up new usernames and passwords: + +``` +DB_USERNAME=postgres +DB_PASSWORD=postgres +[...] +RABBITMQ_DEFAULT_USER=rabbit-username +RABBITMQ_DEFAULT_PASS=rabbit-password-you-should-change +[...] +FLOWER_BASIC_AUTH=root:password-you-should-change +[...] +#EMAIL_HOST_USER=user +#EMAIL_HOST_PASSWORD=pass +[...] +MINIO_ACCESS_KEY=testkey +MINIO_SECRET_KEY=testsecret +# or +AWS_ACCESS_KEY_ID=testkey +AWS_SECRET_ACCESS_KEY=testsecret +``` +!!! warning "It is very important to set up an SSL certificate for Public deployement" + ## Open Access Permissions for following port number If you are deploying on a Linux server, which usually has a firewall, you need to open access permissions to the following port numbers @@ -79,9 +102,37 @@ If you are deploying on a Linux server, which usually has a firewall, you need t - `DEBUG = os.environ.get("DEBUG", True)` !!! note "If DEBUG is not set to true, then you will not be able to load to the static resource file" - Comment out the following code - - ![image](../_attachments/112937133-b59cc880-9159-11eb-8bc8-06a11e63b293_17528513110527873.png) - +```py +# ============================================================================= +# Debug +# ============================================================================= +#if DEBUG: +# INSTALLED_APPS += ('debug_toolbar',) +# MIDDLEWARE = ('debug_toolbar.middleware.DebugToolbarMiddleware', +# 'querycount.middleware.QueryCountMiddleware', +# ) + MIDDLEWARE # we want Debug Middleware at the top +# # tricks to have debug toolbar when developing with docker +# +# INTERNAL_IPS = ['127.0.0.1'] +# +# import socket +# +# try: +# INTERNAL_IPS.append(socket.gethostbyname(socket.gethostname())[:-1]) +# except socket.gaierror: +# pass +# +# QUERYCOUNT = { +# 'IGNORE_REQUEST_PATTERNS': [ +# r'^/admin/', +# r'^/static/', +# ] +# } +# +# DEBUG_TOOLBAR_CONFIG = { +# "SHOW_TOOLBAR_CALLBACK": lambda request: True +# } +``` ## Start service - Execute command `docker compose up -d` diff --git a/documentation/docs/_attachments/112937133-b59cc880-9159-11eb-8bc8-06a11e63b293_17528513110527873.png b/documentation/docs/_attachments/112937133-b59cc880-9159-11eb-8bc8-06a11e63b293_17528513110527873.png deleted file mode 100644 index 875848133..000000000 Binary files a/documentation/docs/_attachments/112937133-b59cc880-9159-11eb-8bc8-06a11e63b293_17528513110527873.png and /dev/null differ