diff --git a/README.md b/README.md index cc62cdaa..b25d05c3 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,13 @@ This is a *new implementation*, [merged](https://github.com/tosdr/edit.tosdr.org Phoenix, when used, also connects to two other services: Atlassian, which runs [the widget](https://status.tosdr.org) that helps us to monitor the application's health, and jrbit.de, which is where our databases live as well as our system for reporting errors. +## Deploy + +To deploy this code to https://do-staging.tosdr.org: +* get an Ubuntu 24.04 server +* ssh into it as root +* download the `./staging/deploy.sh` script from this repo, and run it + ## Development Requirements: @@ -103,6 +110,8 @@ H is the Hypothesis web service and api. 1. To use it with Phoenix, clone [our fork of H](https://github.com/tosdr/h) into the same directory as the Phoenix clone, and `cd h/`. **The correct branch to work from is the *phoenix-integration* branch.** + **ATTENTION**: Due to [an issue with pip-tools](https://github.com/tosdr/edit.tosdr.org/issues/1156) you might need to use the *staging-deploy* branch instead. + **ATTENTION**: The official documentation for installing H is [here](https://h.readthedocs.io/en/latest/developing/install/). Please also consult these docs as needed. Note the prerequisites: @@ -127,8 +136,8 @@ H is the Hypothesis web service and api. **If pyenv has trouble finding the python binary**, you may need to add configuration to `.zshrc`, as documented [here](https://stackoverflow.com/questions/51863225/pyenv-python-command-not-found). -5. `make services`, which launches the docker services needed to run H. -7. `make dev` +2. `make services`, which launches the docker services needed to run H. +3. `make dev` If this is your first time, `make dev` will install the dependencies. To do so, it requires both *node* and *yarn*. @@ -141,12 +150,12 @@ H is the Hypothesis web service and api. You will have to exit and restart `tox` whenever changes are made to the code. Additionally, in debug mode, certain functionalities may be restricted. You will not be able to create and persist annotations from the client if H is running in debug mode, for example. To launch the shell and poke around in the database, run `make shell`. -9. Create an admin user from the shell +4. Create an admin user from the shell You will need an admin user to set up OAuth between H and the Hypothesis client. Follow [these instructions](https://h.readthedocs.io/en/latest/developing/administration/). -7. Log in as admin, and configure OAuth +5. Log in as admin, and configure OAuth Instructions [here](https://h.readthedocs.io/en/latest/developing/integrating-client/). diff --git a/.gitpod/crawler.docker-compose.yml b/disabled.gitpod/crawler.docker-compose.yml similarity index 100% rename from .gitpod/crawler.docker-compose.yml rename to disabled.gitpod/crawler.docker-compose.yml diff --git a/staging/deploy.sh b/staging/deploy.sh new file mode 100644 index 00000000..a1c39cb2 --- /dev/null +++ b/staging/deploy.sh @@ -0,0 +1,62 @@ +# Docker +sudo apt-get update +sudo apt-get -yq install ca-certificates curl +sudo install -m 0755 -d /etc/apt/keyrings +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc +sudo chmod a+r /etc/apt/keyrings/docker.asc +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update +sudo apt-get install -yq docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +sudo service docker start +sudo docker run hello-world + +# pyenv +apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev +curl https://pyenv.run | bash +echo -e 'export PYENV_ROOT="$HOME/.pyenv"\nexport PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc +echo -e 'eval "$(pyenv init --path)"\neval "$(pyenv init -)"' >> ~/.bashrc +source ~/.bashrc + +# Node.js +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +source ~/.bashrc +nvm install 20 +nvm use 20 +corepack enable +yarn --version -q + +# Postgres +apt install -q libpq-dev + +# Phoenix +git clone https://github.com/tosdr/edit.tosdr.org.git +cd edit.tosdr.org +git checkout staging-deploy +docker compose build +docker network create elasticsearch +docker network create dbs +docker compose up -d +docker exec -it edittosdrorg-web-1 rails db:seed +docker compose down +cd ~ + +# Hypothesis +git clone https://github.com/tosdr/h +cd h +git checkout do-staging +echo Note this will take several minutes... +pyenv install 3.11.7 +pyenv init +pyenv shell 3.11.7 +python -m pip install -rrequirements/dockercompose.txt +make services +make dev +cd ~ + +# Nginx Proxy Manager +cd edit.tosdr.org/staging/nginx-proxy-manager +docker compose up -d +cd ~ \ No newline at end of file diff --git a/staging/nginxproxymanager/docker-compose.yml b/staging/nginxproxymanager/docker-compose.yml new file mode 100644 index 00000000..a7b4bbd6 --- /dev/null +++ b/staging/nginxproxymanager/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' +services: + app: + image: 'jc21/nginx-proxy-manager:latest' + restart: unless-stopped + ports: + - '80:80' + - '81:81' + - '443:443' + volumes: + - ./data:/data + - ./letsencrypt:/etc/letsencrypt \ No newline at end of file