Skip to content

Commit

Permalink
Merge pull request #2208 from iotaledger/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
karimodm authored May 16, 2022
2 parents 80d5713 + 029c622 commit 5a98797
Show file tree
Hide file tree
Showing 33 changed files with 12,410 additions and 2,798 deletions.
40 changes: 9 additions & 31 deletions .github/workflows/test-docs-build.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
name: Test Docs Wiki Build
name: Test Docs Build

on:
pull_request:
branches:
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Install dependencies
run: |
cd documentation
npm ci
- name: Setup Wiki and Test Build
- uses: actions/checkout@v3
- name: Test Build
run: |
# Move into the documentation folder
cd documentation
# Export this projects configuration as a variable
export config=$(cat EXTERNAL_DOCS_CONFIG)
# Set up the wiki using iota wiki cli. This will clone the wiki repository as well the current repository
npm run setup
# Sync the PRs static content with the freshly created wiki instance
rsync -av --progress ./static/img/ ./local-wiki/iota-wiki/static/img/
cd ../
# Sync the PR content with the freshly created wiki instance
rsync -av --progress ./ ./documentation/local-wiki/iota-wiki/external/goshimmer --exclude .git --exclude node_modules --exclude local-wiki
# Change directory into the wiki
cd documentation/local-wiki/iota-wiki
# Install docusaurus and it's dependencies
yarn
# Replace the configuration placeholder with the configuration variable text
export replace_string='/\* AUTO GENERATED EXTERNAL DOCS CONFIG \*/'
perl -0pe 's#$ENV{replace_string}#$ENV{config}#' docusaurus.config.js > docusaurus.config.js.cpy
# Replace the existing configuration file with the edited one
rm -f docusaurus.config.js && mv docusaurus.config.js.cpy docusaurus.config.js
sed -i "s+baseUrl: '/',+baseUrl: '/goshimmer/',+g" docusaurus.config.js
# Run the build process to test for any errors
yarn install --immutable
yarn build
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.8.14 - 2022-05-16

> Minor revision introducing small docker changes.
The snapshot has been taken at 2022-05-07 16:30 UTC.
- Fix several Docker discrepancies (#2201, #2206)

# v0.8.13 - 2022-05-06

> This release introduces serix, a reflection-based serialization library that enables us to automatically serialize all models.
Expand Down
34 changes: 19 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ RUN if [ "$DOWNLOAD_SNAPSHOT" -gt 0 ] && [ "$CUSTOM_SNAPSHOT_URL" = "" ] ; then
touch /tmp/snapshot.bin ; \
fi

RUN mkdir -p /tmp/db/mainnetdb /tmp/db/peerdb
# 65532:65532 is the UID:GUID of nonroot user of distroless image
RUN chown 65532:65532 /tmp/db/mainnetdb /tmp/db/peerdb

############################
# Image
############################
Expand All @@ -100,7 +104,7 @@ FROM gcr.io/distroless/cc-debian11:nonroot as prepare-runtime
# Gossip
EXPOSE 14666/tcp
# AutoPeering
#EXPOSE 14626/udp
EXPOSE 14626/udp
# Pprof Profiling
EXPOSE 6061/tcp
# Prometheus exporter
Expand All @@ -112,32 +116,32 @@ EXPOSE 8081/tcp
# DAGs Visualizer
EXPOSE 8061/tcp

# Copy configuration
COPY --from=build /tmp/snapshot.bin /snapshot.bin
COPY config.default.json /config.json
# Default directory and drop privileges
WORKDIR /app
USER nonroot

# Copy the Pre-built binary file from the previous stage
COPY --chown=nonroot:nonroot --from=build /go/bin/goshimmer /run/goshimmer
COPY --chown=nonroot:nonroot --from=build /go/bin/goshimmer /app/goshimmer

# Fix permission issue when mounting volumes.
COPY --chown=nonroot:nonroot --from=build /tmp/ /tmp/mainnetdb/
COPY --chown=nonroot:nonroot --from=build /tmp/ /tmp/peerdb/
# Copy configuration and snapshot from the previous stage
COPY config.default.json /app/config.json
COPY --from=build /tmp/snapshot.bin /app/snapshot.bin

WORKDIR /tmp
USER nonroot
# Fix permission issue when mounting volumes
COPY --chown=nonroot:nonroot --from=build /tmp/db/ /app/

# We execute this stage only if debugging is disabled, i.e REMOTE_DEBUGGIN==0.
# We execute this stage only if debugging is disabled, i.e REMOTE_DEBUGGIN==0
FROM prepare-runtime as debugger-enabled-0

ENTRYPOINT ["/run/goshimmer", "--config=/config.json"]
ENTRYPOINT ["/app/goshimmer", "--config=/app/config.json"]

# We execute this stage only if debugging is enabled, i.e REMOTE_DEBUGGIN==1.
# We execute this stage only if debugging is enabled, i.e REMOTE_DEBUGGIN==1
FROM prepare-runtime as debugger-enabled-1
EXPOSE 40000

# Copy the Delve binary
COPY --chown=nonroot:nonroot --from=build /go/bin/dlv /run/dlv
ENTRYPOINT ["/run/dlv","--listen=:40000", "--headless" ,"--api-version=2", "--accept-multiclient", "exec", "--continue", "/run/goshimmer", "--", "--config=/config.json"]
COPY --chown=nonroot:nonroot --from=build /go/bin/dlv /app/dlv
ENTRYPOINT ["/app/dlv", "--listen=:40000", "--headless", "--api-version=2", "--accept-multiclient", "exec", "--continue", "/app/goshimmer", "--", "--config=/app/config.json"]

# Execute corresponding build stage depending on the REMOTE_DEBUGGING build arg.
FROM debugger-enabled-${REMOTE_DEBUGGING} as runtime
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ services:
--node.enablePlugins=dashboard,remotelog,networkdelay,prometheus{% if faucet|default(false) %},faucet{% endif %},activity,snapshot,WebAPIToolsDRNGEndpoint,WebAPIToolsMessageEndpoint,"WebAPI tools Endpoint"{% if spammer|default(false) %},spammer{% endif %}
--prometheus.bindAddress=0.0.0.0:9311
--activity.broadcastInterval=1s
--messageLayer.snapshot.file=/snapshot.bin
{% if faucet|default(false) %}
--faucet.seed={{ faucetSeed }}
--faucet.tokensPerRequest=1000000
Expand Down
2 changes: 1 addition & 1 deletion deploy/ansible/roles/metrics/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
- name: Stop existing services gracefully
community.general.docker_compose:
project_src: /opt/metrics
timeout: 180
timeout: 10
state: present
stopped: yes

Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ services:
# make sure to give read/write access to the folder ./mainnetdb (e.g., chmod -R 777 ./mainnetdb)
# optionally, you can mount a config.json into the container
volumes:
- "goshimmer-db-volume:/tmp/mainnetdb:rw"
- "goshimmer-peerdb-volume:/tmp/peerdb:rw"
- "goshimmer-db-volume:/app/mainnetdb:rw"
- "goshimmer-peerdb-volume:/app/peerdb:rw"
- "/etc/localtime:/etc/localtime:ro"
ports:
# AutoPeering
Expand All @@ -43,8 +43,8 @@ services:
--autoPeering.entryNodes=2PV5487xMw5rasGBXXWeqSi4hLz7r19YBt8Y1TGAsQbj@analysisentry-01.devnet.shimmer.iota.cafe:15626,5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entry-0.devnet.tanglebay.com:14646,CAB87iQZR6BjBrCgEBupQJ4gpEBgvGKKv3uuGVRBKb4n@entry-1.devnet.tanglebay.com:14646
--node.disablePlugins=portcheck
--node.enablePlugins=remotelog,networkdelay,spammer,prometheus
--database.directory=/tmp/mainnetdb
--node.peerDBDirectory=/tmp/peerdb
--database.directory=/app/mainnetdb
--node.peerDBDirectory=/app/peerdb
--logger.level=info
--logger.disableEvents=false
--logger.remotelog.serverAddress=metrics-01.devnet.shimmer.iota.cafe:5213
Expand Down Expand Up @@ -95,4 +95,4 @@ volumes:
goshimmer-db-volume:
goshimmer-peerdb-volume:
grafana-data-volume:
prometheus-data-volume:
prometheus-data-volume:
13 changes: 10 additions & 3 deletions documentation/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Dependencies
/node_modules
node_modules

# Yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Production
/build
Expand All @@ -18,5 +27,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

/local-wiki
785 changes: 785 additions & 0 deletions documentation/.yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions documentation/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.2.0.cjs
9 changes: 0 additions & 9 deletions documentation/EXTERNAL_DOCS_CONFIG

This file was deleted.

91 changes: 8 additions & 83 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,103 +9,28 @@ The documentation is built using [Docusaurus 2](https://docusaurus.io/). The dep

## Installation

```shell
npm i
npm run setup
```console
yarn
```

This command checks out a local copy of the wiki and creates links to the content.
This command installs all needed dependencies.

## Local Development

```shell
npm start
```console
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Tear Down

```shell
npm run clean
```

This command deletes the local wiki and local links.

This command starts a local, wiki themed, development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Including .md file

```shell
```console
{@import <file path>}
```

Example:

```shell
```console
{@import ../../../../bindings/wasm/docs/api-reference.md}
```

# Adding content

## Docs

All the project documentation should be placed in the `docs` folder. If you wish to create a new document, you should create a new `.md` file in the corresponding folder. For example, if you wanted to add a new tutorial, you should create a new `.md` file in `docs/tutorials`:

```
documentation # Root directory of your site
└── blog
└── docs
├── welcome.md
└── tutorials
└── your_new_tutorials_name.md
```

You can find more information on docs in the [official docusaurus documentation](https://docusaurus.io/docs/docs-introduction).

## Blog

You should store all your blog posts in the `blog` directory. When creating a new blog post, please make sure to respect the file name structure which includes the posts date in YYYY_MM_DD format. For example, if you wanted to add a post dated July 28th, 2021, your new `.md` file should be prefixed with `2021_07_28`.

You can find more information on blog posts in the [official docusaurus documentation](https://docusaurus.io/docs/blog).

## Sidebar

As the project has multiple documentation pages and sections, these need to be organized. This is handled by the `sidebars.js` file. The `sidebars.js` file contain an ordered JSON formatted object which will be used to generate the project sidebar.

### Documents

You can add a new doc by adding a new object with type `doc` to the sidebar object:

```json
{
type: 'doc',
label: 'FAQ',
id: 'tutorials/your_new_tutorials_name',
}
```
where

* `type` should always be 'doc'.
* `label` should be your desired sidebar item's label.
* `id` is the item's identifier. The ID field should contain the parent folder/s, if any.

### Categories

You can add a new category by adding a new object with type `category` to the sidebar object:

```json
{
type: 'category',
label: 'Tutorials',
items: []
}
```

where

* `type` should always be 'category'.
* `label` should be your desired sidebar category's label.
* `items` is an array of [documents](#documents).

You can find more information on the sidebar and its components in the [official docusaurus documentation](https://docusaurus.io/docs/sidebar).
6 changes: 0 additions & 6 deletions documentation/config.json

This file was deleted.

2 changes: 1 addition & 1 deletion documentation/docs/tooling/docker_private_network.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ A node that is used to expose ports via the host and to have a single attachment

##### Volumes

Docker Compose creates a `shimmerdb` volume to maintain a tangle even after tearing down the containers. Run `docker-compose down -v` to clear the volume.
Docker Compose creates a `mainnetdb` volume to maintain a tangle even after tearing down the containers. Run `docker-compose down -v` to clear the volume.

##### Ports

Expand Down
16 changes: 8 additions & 8 deletions documentation/docs/tutorials/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ docker-compose version 1.26.0, build d4451659
First, lets create a user defined bridged network. Unlike the already existing `bridge` network, the user defined one will have container name DNS resolution for containers within that network. This is useful if later we want to setup additional containers which need to speak with the GoShimmer container.

```shell
docker network create --driver=bridge shimmer
docker network create --driver=bridge goshimmer
c726034d295c3df66803b92c71ca517a0cf0e3c65c1c6d84ee5fa34ae76cbcd4
```

Expand All @@ -174,8 +174,8 @@ Lets create a folder holding our database:

```shell
cd /opt/goshimmer
mkdir db
chmod 0777 db
sudo mkdir mainnetdb && sudo chown 65532:65532 mainnetdb
sudo mkdir peerdb && sudo chown 65532:65532 peerdb
```

Finally, lets create our `docker-compose.yml`:
Expand All @@ -191,7 +191,7 @@ version: '3.3'
networks:
outside:
external:
name: shimmer
name: goshimmer

services:
goshimmer:
Expand All @@ -200,8 +200,8 @@ services:
hostname: goshimmer
stop_grace_period: 2m
volumes:
- "./db:/tmp/mainnetdb:rw"
- "./peerdb:/tmp/peerdb:rw"
- "./db:/app/mainnetdb:rw"
- "./peerdb:/app/peerdb:rw"
- "/etc/localtime:/etc/localtime:ro"
ports:
# Autopeering
Expand All @@ -228,8 +228,8 @@ services:
--autoPeering.entryNodes=2PV5487xMw5rasGBXXWeqSi4hLz7r19YBt8Y1TGAsQbj@analysisentry-01.devnet.shimmer.iota.cafe:15626,5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entry-0.devnet.tanglebay.com:14646,CAB87iQZR6BjBrCgEBupQJ4gpEBgvGKKv3uuGVRBKb4n@entry-1.devnet.tanglebay.com:14646
--node.disablePlugins=portcheck
--node.enablePlugins=remotelog,networkdelay,spammer,prometheus
--database.directory=/tmp/mainnetdb
--node.peerDBDirectory=/tmp/peerdb
--database.directory=/app/mainnetdb
--node.peerDBDirectory=/app/peerdb
--logger.level=info
--logger.disableEvents=false
--logger.remotelog.serverAddress=metrics-01.devnet.shimmer.iota.cafe:5213
Expand Down
Loading

0 comments on commit 5a98797

Please sign in to comment.