diff --git a/.env.example b/.env.example index d66a7e6..9c87309 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ +DISABLE_S3=false AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_S3_BUCKET= -DISABLE_S3=false MYSQL_USER= MYSQL_PASSWORD= @@ -16,5 +16,3 @@ GITHUB_CLIENT_SECRET= GITHUB_CALLBACK_URL=https://ceremony.tornado.cash/api/oauth_callback/github SESSION_SECRET= - -NUXT_HOST=0.0.0.0 diff --git a/README.md b/README.md index d1c9748..3c7fb8e 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,51 @@ -# trusted-setup-nuxt +# Tornado.cash Trusted Setup Ceremony app -> My supreme Nuxt.js project +> zk-SNARKs require a pre-existing setup between the prover and verifier. A set of public parameters define the “rules of the game” for the construction of zk-SNARKs. This app allows everyone to contribute with your source of entropy so that tornado.cash can be trustless. -## Build Setup +## Environment variables +The app can use `.env.development` and `.env.production`. What file will be used depends on `NODE_ENV` variable. +For command `yarn dev` the `.env.development` is used. The `yarn start` uses `.env.production`. + +| ENV_VAR | Description | +| --- | --- | +| DISABLE_S3 | Disable contributions uploading to AWS S3. `true` or `false` | +| AWS_ACCESS_KEY_ID | AWS access key | +| AWS_SECRET_ACCESS_KEY | AWS secret key | +| AWS_S3_BUCKET | AWS S3 bucket where the contributions will be uploaded | +| MYSQL_USER | Mysql user the app uses. Notice, you don't need mysql db for development. The app will use local sqlite db in dev mode. Local db is stored in `db.development.sqlite` file. | +| MYSQL_PASSWORD | Mysql password for MYSQL_USER | +| MYSQL_DATABASE | Mysql database | +| TWITTER_CONSUMER_KEY | Twitter consumer API key. [Twitter app](https://developer.twitter.com/en/apps) | +| TWITTER_CONSUMER_SECRET | Twitter consumer API secret | +| TWITTER_CALLBACK_URL | Twitter callback URL. The app handles the `/api/oauth_callback/twitter` endpoint. Feel free to change domain name and protocol though | +| GITHUB_CLIEND_ID | Github client id. [How to create Github OAuth app](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/) | +| GITHUB_CLIENT_SECRET | Github client secret | +| GITHUB_CALLBACK_URL | Github callback URL. The app handles the `/api/oauth_callback/github` endpoint. Feel free to change domain name and protocol though | +| SESSION_SECRET | A random string that will be used by [express-session](https://www.npmjs.com/package/express-session#secret) to sign the session ID cookie. | + +## Development setup ``` bash -# install dependencies $ yarn install +# Edit all necessary environment variables. See the explanation above. +$ cp .env.example .env.development + # serve with hot reload at localhost:3000 $ yarn dev - -# build for production and launch server -$ yarn build -$ yarn start - -# generate static project -$ yarn generate ``` -For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). +## Production setup +``` bash +# Edit all necessary environment variables. See the explanation above. +$ cp .env.example .env.production + +# Run Nginx + Letsencrypt containers to serve https requests to the app +$ cd frontend +$ docker-compose up -d +$ cd .. + +# Set VIRTUAL_HOST and LETSENCRYPT_HOST variables in the app's docker-compose.yml file +# Run the app and mysql database containers. It will use the MYSQL_USER, MYSQL_PASSWORD and MYSQL_DATABASE vars you specified in .env.production file. +$ docker-compose up -d +``` diff --git a/components/Form.vue b/components/Form.vue index 4429b13..6ee1a80 100644 --- a/components/Form.vue +++ b/components/Form.vue @@ -17,7 +17,7 @@ - +
diff --git a/nuxt.config.js b/nuxt.config.js index 139b2e8..1156ee7 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -119,5 +119,9 @@ module.exports = { removeComments: true // 👈 add this line } } + }, + server: { + port: 3000, // default: 3000 + host: '0.0.0.0' // default: localhost } } diff --git a/pages/make-contribution.vue b/pages/make-contribution.vue index be5d08c..61b4e84 100644 --- a/pages/make-contribution.vue +++ b/pages/make-contribution.vue @@ -135,7 +135,9 @@ export default { this.status.msg = 'Loading' this.status.type = '' await this.getUserData() - this.loading = false + setTimeout(() => { + this.loading = false + }, 800) }, methods: { ...mapActions('user', ['makeTweet', 'logOut', 'getUserData']),