Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Default Domain To peatio.tech #1453

Merged
merged 1 commit into from Jul 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -26,7 +26,7 @@ addons:
packages:
- nginx
hosts:
- peatio.io
- peatio.tech

# Execute all of the commands which need to be executed before installing dependencies.
before_install:
Expand All @@ -44,7 +44,7 @@ install:
# Pull existing layers from Docker Hub to skip building them. The speeds up Travis build a lot.
- docker pull peatioexchange/peatio:latest || true # In case image doesn't exist.
- docker pull rubykube/peatio-trading-ui:1.7.1
- docker run -d -p 4000:3000 -e "RAILS_ENV=production" -e "SECRET_KEY_BASE=secret" -e "PLATFORM_ROOT_URL=http://peatio.io" -e "RAILS_SERVE_STATIC_FILES=1" --add-host=peatio.io:$(ip addr show eth0 | grep -Po 'inet \K[\d.]+') --name=peatio-trading-ui rubykube/peatio-trading-ui:1.7.0
- docker run -d -p 4000:3000 -e "RAILS_ENV=production" -e "SECRET_KEY_BASE=secret" -e "PLATFORM_ROOT_URL=http://peatio.tech" -e "RAILS_SERVE_STATIC_FILES=1" --add-host=peatio.tech:$(ip addr show eth0 | grep -Po 'inet \K[\d.]+') --name=peatio-trading-ui rubykube/peatio-trading-ui:1.7.0

# Execute all of the commands which need to be executed before running actual tests.
before_script:
Expand All @@ -56,7 +56,7 @@ before_script:

# Execute all of the commands which should make the build pass or fail.
script:
URL_HOST=peatio.io LOG_LEVEL=warn xvfb-run --auto-servernum --server-args="-screen 0 1280x800x16" bundle exec rspec &&
URL_HOST=peatio.tech LOG_LEVEL=warn xvfb-run --auto-servernum --server-args="-screen 0 1280x800x16" bundle exec rspec &&
docker build --tag peatioexchange/peatio:latest --cache-from peatioexchange/peatio:latest .

# Execute all of the commands which need to be executed after the build passed.
Expand Down
6 changes: 3 additions & 3 deletions ci/nginx/server.conf
Expand Up @@ -3,13 +3,13 @@
#
# Make sure to add the next line to /etc/hosts.
#
# 127.0.0.1 peatio.io
# 127.0.0.1 peatio.tech
#

server {
server_name peatio.io;
server_name peatio.tech;
listen 80;
proxy_set_header Host peatio.io;
proxy_set_header Host peatio.tech;

location ~ ^/(?:trading|trading-ui-assets)\/ {
proxy_pass http://127.0.0.1:4000;
Expand Down
4 changes: 2 additions & 2 deletions config/templates/application.yml.erb
Expand Up @@ -9,7 +9,7 @@ defaults: &defaults
ADMIN: 'admin@peatio.tech'

# Application URL configuration variables.
URL_HOST: peatio.io
URL_HOST: peatio.tech
URL_SCHEME: http
FORCE_SECURE_CONNECTION: 'false' # Set to "true" to disable access via unsecured HTTP, send HSTS headers and use secure cookies.

Expand Down Expand Up @@ -161,7 +161,7 @@ defaults: &defaults
# Capybara configuration variables.
TEST_SERVER_HOST: 127.0.0.1
TEST_SERVER_PORT: '3000'
TEST_APP_HOST: peatio.io
TEST_APP_HOST: peatio.tech
TEST_APP_PORT: '80'

# Specify the code of currency which is used to display the equivalent of the amounts of other currencies.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/authenticating_in_management_api_v1.md
Expand Up @@ -78,7 +78,7 @@ The example JWT is available at [jwt-multisig source code](https://github.com/ru
## Step 6: Make requests to API.

```
curl -v -H "Accept: application/json" -H "Content-Type: application/json" -d "JWT" http://peatio.io/management_api/v1/deposits
curl -v -H "Accept: application/json" -H "Content-Type: application/json" -d "JWT" http://peatio.tech/management_api/v1/deposits
```

Where `JWT` is the result from previous step (serialized JWT).
6 changes: 3 additions & 3 deletions docs/releases/1.5.0.md
Expand Up @@ -18,16 +18,16 @@

The patch moves trading UI assets and views to separate component called `peatio-trading-ui`. The extracted component lives at [GitHub repository](https://github.com/rubykube/peatio-trading-ui) and is based on Rails 5.1.

Migration steps include (we assume your Peatio is deployed at `peatio.io`):
Migration steps include (we assume your Peatio is deployed at `peatio.tech`):

* You will need to add NGINX to your stack.
* Review NGINX configuration which can be found at `ci/nginx/server.conf`.
* The trick is that both Peatio and Trading UI are deployed on the same domain but are served conditionally by NGINX reverse proxy depending on the request path.
* Another trick is that both apps share the same cookies because they live on the same domain (however, trading UI doesn't do any decode/encode operations so there is not need for sharing `SECRET_KEY_BASE` between two apps).
* Trading UI app has separate asset prefix: `/trading-ui-assets`. So all requests which match `/\A\/trading-ui-assets\//` must be routed to trading UI app.
* The path to page with markets has also been changes from `/markets/:id` to `/trading/:market_id`. All requests which satisfy `/\A\/trading\//` must be routed to trading UI app.
* The trading UI app will first download variables for specified `market_id` (like `btcusd`) from Peatio by issuing `HTTP GET https://peatio.io/markets/btcusd.json`, and then render Rails views according to received variables.
* The member is kept authenticated because trading UI app sends cookies via HTTP header to `https://peatio.io/markets/btcusd.json`.
* The trading UI app will first download variables for specified `market_id` (like `btcusd`) from Peatio by issuing `HTTP GET https://peatio.tech/markets/btcusd.json`, and then render Rails views according to received variables.
* The member is kept authenticated because trading UI app sends cookies via HTTP header to `https://peatio.tech/markets/btcusd.json`.
* The variable which controls Peatio root URL is called `PLATFORM_ROOT_URL`. Check more trading UI configuration variables at [`config/templates/application.yml.erb`](https://github.com/rubykube/peatio-trading-ui/blob/master/config/templates/application.yml.erb).
* We updated `.travis.yml` at Peatio so it automatically deploys trading UI locally with Docker and runs Selenium specs. Study `.travis.yml` for detailed examples on how to run & use trading UI.

Expand Down