{"componentChunkName":"component---src-templates-page-js","path":"/workers-site","result":{"data":{"markdownRemark":{"frontmatter":{"title":"Add Cloudflare Workers Site to GitLab Pages","date":"02 October 2019","path":"/workers-site","author":null,"excerpt":"It's surprisingly easy to publish my existing GitLab page to Workers site...","tags":["gitlab","web","jekyll","cloudflare","cloudflare-workers"],"coverImage":null},"id":"c4500b94-569b-5334-bff8-d57614ee6187","html":"<p>It's surprisingly easy to publish my existing GitLab page to Workers site.</p>\n<h2>Step 1: Test locally</h2>\n<p>Just follow the tutorial <a href=\"https://developers.cloudflare.com/workers/sites/start-from-worker/\">Start from an Existing Worker</a></p>\n<h2>Step 2: Update <code class=\"language-text\">.gitlab-ci.yml</code></h2>\n<h3>2a Pick a ruby base image that has <code class=\"language-text\">npm</code>.</h3>\n<p>Wrangler Workers site uses webpack. You will need <code class=\"language-text\">npm</code> for it to work</p>\n<h3>2b. Install Wrangler</h3>\n<p>In this case, I just use the precompiled binary at <a href=\"https://github.com/cloudflare/wrangler/releases\">Github Releases</a></p>\n<h3>2c Configure Environment Variables in CI settigns</h3>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">CF_API_KEY=superlongapikey \nCF_EMAIL=testuser@example.com </code></pre></div>\n<p>See <a href=\"https://github.com/cloudflare/wrangler#using-environment-variables\">Environment Variables</a></p>\n<h3><code class=\"language-text\">.gitlab-ci.yml</code> End reuslt</h3>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\"># requiring the environment of Ruby 2.3.x\nimage: timbru31/ruby-node:2.3\n\n# add bundle cache to &#39;vendor&#39; for speeding up builds\ncache:\n  paths: \n    - vendor/\n\nbefore_script:\n  - bundle install --path vendor\n\n\n# the &#39;pages&#39; job will deploy and build your site to the &#39;public&#39; path\npages:\n  stage: deploy\n  script:\n    - bundle exec jekyll build -d public/\n    - wget https://github.com/cloudflare/wrangler/releases/download/v1.4.0/wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz\n    - tar xvzf wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz \n    - wrangler-v1.4.0-x86_64-unknown-linux-musl/wrangler publish\n  artifacts:\n    paths:\n      - public\n  only:\n    - master # this job will affect only the &#39;master&#39; branch\n\n# \n# https://github.com/jekyll/jekyll/issues/4268#issuecomment-377681274\nvariables:\n  LC_ALL: &quot;C.UTF-8&quot;\n  LANG: &quot;en_US.UTF-8&quot;\n  LANGUAGE: &quot;en_US.UTF-8&quot;</code></pre></div>\n<h2>Step 3: git push!</h2>\n<p>Check the GitLab CI job log</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Running with gitlab-runner 12.3.0 (a8a019e0)\n  on docker-auto-scale fa6cab46\nUsing Docker executor with image timbru31/ruby-node:2.3 ...\nPulling docker image timbru31/ruby-node:2.3 ...\nUsing docker image sha256:1373e82c39364cec1d6d8b1ac92d877c5adfb38066396b13b0cf4e65d7313304 for timbru31/ruby-node:2.3 ...\nRunning on runner-fa6cab46-project-7998729-concurrent-0 via runner-fa6cab46-srm-1570008812-ed443b3a...\nFetching changes...\nInitialized empty Git repository in /builds/mw866/chriswang.tech/.git/\nCreated fresh repository.\nFrom https://gitlab.com/mw866/chriswang.tech\n * [new branch]      gitlab     -&gt; origin/gitlab\n * [new branch]      master     -&gt; origin/master\nChecking out 015b4fb3 as master...\n\nSkipping Git submodules setup\nChecking cache for default...\nDownloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/7998729/default \nSuccessfully extracted cache\n$ bundle install --path vendor\nFetching gem metadata from https://rubygems.org/..........\nFetching gem metadata from https://rubygems.org/.\nResolving dependencies...\nUsing public_suffix 4.0.1\nUsing addressable 2.7.0\nUsing bundler 1.17.3\nUsing colorator 1.1.0\nUsing concurrent-ruby 1.1.5\nUsing eventmachine 1.2.7\nUsing http_parser.rb 0.6.0\nUsing em-websocket 0.5.1\nUsing ffi 1.11.1\nUsing ethon 0.12.0\nUsing forwardable-extended 2.6.0\nUsing mercenary 0.3.6\nUsing mini_portile2 2.4.0\nUsing nokogiri 1.10.4\nUsing parallel 1.17.0\nUsing rainbow 3.0.0\nUsing typhoeus 1.3.1\nUsing yell 2.2.0\nUsing html-proofer 3.13.0\nUsing i18n 0.9.5\nUsing rb-fsevent 0.10.3\nUsing rb-inotify 0.10.0\nUsing sass-listen 4.0.0\nUsing sass 3.7.4\nUsing jekyll-sass-converter 1.5.2\nFetching listen 3.2.0\nInstalling listen 3.2.0\nUsing jekyll-watch 2.2.1\nUsing kramdown 1.17.0\nUsing liquid 4.0.3\nUsing pathutil 0.16.2\nFetching rouge 3.11.1\nInstalling rouge 3.11.1\nUsing safe_yaml 1.0.5\nUsing jekyll 3.8.6\nUsing jekyll-paginate 1.1.0\nUsing jekyll-seo-tag 2.6.1\nBundle complete! 4 Gemfile dependencies, 35 gems now installed.\nBundled gems are installed into `./vendor`\n$ bundle exec jekyll build -d public/\nConfiguration file: /builds/mw866/chriswang.tech/_config.yml\n            Source: /builds/mw866/chriswang.tech\n       Destination: public/\n Incremental build: disabled. Enable with --incremental\n      Generating... \n                    done in 0.459 seconds.\n Auto-regeneration: disabled. Use --watch to enable.\n$ wget https://github.com/cloudflare/wrangler/releases/download/v1.4.0/wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz\n--2019-10-02 09:35:37--  https://github.com/cloudflare/wrangler/releases/download/v1.4.0/wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz\nResolving github.com (github.com)... 140.82.113.4\nConnecting to github.com (github.com)|140.82.113.4|:443... connected.\nHTTP request sent, awaiting response... 302 Found\nLocation: https://github-production-release-asset-2e65be.s3.amazonaws.com/175043545/07d9d500-e0f0-11e9-9844-d794107bcf7a?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191002%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20191002T093537Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=9aeaae6f3201a5d50fa05502f5d57c996205966142d0cde4664b4af128f82964&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;response-content-disposition=attachment%3B%20filename%3Dwrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz&amp;response-content-type=application%2Foctet-stream [following]\n--2019-10-02 09:35:37--  https://github-production-release-asset-2e65be.s3.amazonaws.com/175043545/07d9d500-e0f0-11e9-9844-d794107bcf7a?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20191002%2Fus-east-1%2Fs3%2Faws4_request&amp;X-Amz-Date=20191002T093537Z&amp;X-Amz-Expires=300&amp;X-Amz-Signature=9aeaae6f3201a5d50fa05502f5d57c996205966142d0cde4664b4af128f82964&amp;X-Amz-SignedHeaders=host&amp;actor_id=0&amp;response-content-disposition=attachment%3B%20filename%3Dwrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz&amp;response-content-type=application%2Foctet-stream\nResolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.36.172\nConnecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.36.172|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 5891583 (5.6M) [application/octet-stream]\nSaving to: ‘wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz’\n\n     0K .......... .......... .......... .......... ..........  0% 3.07M 2s\n    50K .......... .......... .......... .......... ..........  1% 3.96M 2s\n   100K .......... .......... .......... .......... ..........  2% 3.69M 2s\n   150K .......... .......... .......... .......... ..........  3%  248M 1s\n   200K .......... .......... .......... .......... ..........  4%  245M 1s\n   250K .......... .......... .......... .......... ..........  5% 3.52M 1s\n   300K .......... .......... .......... .......... ..........  6%  105M 1s\n   350K .......... .......... .......... .......... ..........  6% 3.42M 1s\n   400K .......... .......... .......... .......... ..........  7%  236M 1s\n   450K .......... .......... .......... .......... ..........  8%  291M 1s\n   500K .......... .......... .......... .......... ..........  9%  271M 1s\n   550K .......... .......... .......... .......... .......... 10%  289M 1s\n   600K .......... .......... .......... .......... .......... 11%  227M 1s\n   650K .......... .......... .......... .......... .......... 12%  277M 1s\n   700K .......... .......... .......... .......... .......... 13% 4.06M 1s\n   750K .......... .......... .......... .......... .......... 13% 49.6M 1s\n   800K .......... .......... .......... .......... .......... 14% 86.9M 0s\n   850K .......... .......... .......... .......... .......... 15%  313M 0s\n   900K .......... .......... .......... .......... .......... 16%  290M 0s\n   950K .......... .......... .......... .......... .......... 17%  217M 0s\n  1000K .......... .......... .......... .......... .......... 18%  202M 0s\n  1050K .......... .......... .......... .......... .......... 19%  244M 0s\n  1100K .......... .......... .......... .......... .......... 19%  290M 0s\n  1150K .......... .......... .......... .......... .......... 20%  288M 0s\n  1200K .......... .......... .......... .......... .......... 21%  238M 0s\n  1250K .......... .......... .......... .......... .......... 22%  268M 0s\n  1300K .......... .......... .......... .......... .......... 23%  297M 0s\n  1350K .......... .......... .......... .......... .......... 24%  281M 0s\n  1400K .......... .......... .......... .......... .......... 25% 5.09M 0s\n  1450K .......... .......... .......... .......... .......... 26% 12.7M 0s\n  1500K .......... .......... .......... .......... .......... 26%  184M 0s\n  1550K .......... .......... .......... .......... .......... 27% 55.1M 0s\n  1600K .......... .......... .......... .......... .......... 28%  210M 0s\n  1650K .......... .......... .......... .......... .......... 29%  236M 0s\n  1700K .......... .......... .......... .......... .......... 30%  153M 0s\n  1750K .......... .......... .......... .......... .......... 31%  237M 0s\n  1800K .......... .......... .......... .......... .......... 32%  266M 0s\n  1850K .......... .......... .......... .......... .......... 33%  273M 0s\n  1900K .......... .......... .......... .......... .......... 33%  316M 0s\n  1950K .......... .......... .......... .......... .......... 34%  312M 0s\n  2000K .......... .......... .......... .......... .......... 35%  302M 0s\n  2050K .......... .......... .......... .......... .......... 36%  251M 0s\n  2100K .......... .......... .......... .......... .......... 37%  319M 0s\n  2150K .......... .......... .......... .......... .......... 38%  326M 0s\n  2200K .......... .......... .......... .......... .......... 39%  294M 0s\n  2250K .......... .......... .......... .......... .......... 39%  263M 0s\n  2300K .......... .......... .......... .......... .......... 40%  310M 0s\n  2350K .......... .......... .......... .......... .......... 41% 20.6M 0s\n  2400K .......... .......... .......... .......... .......... 42% 40.5M 0s\n  2450K .......... .......... .......... .......... .......... 43%  274M 0s\n  2500K .......... .......... .......... .......... .......... 44% 62.1M 0s\n  2550K .......... .......... .......... .......... .......... 45%  174M 0s\n  2600K .......... .......... .......... .......... .......... 46%  341M 0s\n  2650K .......... .......... .......... .......... .......... 46%  258M 0s\n  2700K .......... .......... .......... .......... .......... 47%  351M 0s\n  2750K .......... .......... .......... .......... .......... 48%  233M 0s\n  2800K .......... .......... .......... .......... .......... 49%  247M 0s\n  2850K .......... .......... .......... .......... .......... 50%  316M 0s\n  2900K .......... .......... .......... .......... .......... 51%  356M 0s\n  2950K .......... .......... .......... .......... .......... 52%  274M 0s\n  3000K .......... .......... .......... .......... .......... 53%  348M 0s\n  3050K .......... .......... .......... .......... .......... 53% 16.1M 0s\n  3100K .......... .......... .......... .......... .......... 54%  117M 0s\n  3150K .......... .......... .......... .......... .......... 55%  300M 0s\n  3200K .......... .......... .......... .......... .......... 56%  279M 0s\n  3250K .......... .......... .......... .......... .......... 57%  283M 0s\n  3300K .......... .......... .......... .......... .......... 58%  309M 0s\n  3350K .......... .......... .......... .......... .......... 59%  300M 0s\n  3400K .......... .......... .......... .......... .......... 59%  280M 0s\n  3450K .......... .......... .......... .......... .......... 60%  257M 0s\n  3500K .......... .......... .......... .......... .......... 61%  304M 0s\n  3550K .......... .......... .......... .......... .......... 62%  300M 0s\n  3600K .......... .......... .......... .......... .......... 63%  302M 0s\n  3650K .......... .......... .......... .......... .......... 64%  270M 0s\n  3700K .......... .......... .......... .......... .......... 65%  307M 0s\n  3750K .......... .......... .......... .......... .......... 66%  286M 0s\n  3800K .......... .......... .......... .......... .......... 66% 22.4M 0s\n  3850K .......... .......... .......... .......... .......... 67% 24.8M 0s\n  3900K .......... .......... .......... .......... .......... 68%  291M 0s\n  3950K .......... .......... .......... .......... .......... 69%  341M 0s\n  4000K .......... .......... .......... .......... .......... 70%  346M 0s\n  4050K .......... .......... .......... .......... .......... 71%  269M 0s\n  4100K .......... .......... .......... .......... .......... 72%  334M 0s\n  4150K .......... .......... .......... .......... .......... 72%  358M 0s\n  4200K .......... .......... .......... .......... .......... 73%  305M 0s\n  4250K .......... .......... .......... .......... .......... 74%  273M 0s\n  4300K .......... .......... .......... .......... .......... 75%  336M 0s\n  4350K .......... .......... .......... .......... .......... 76%  326M 0s\n  4400K .......... .......... .......... .......... .......... 77%  344M 0s\n  4450K .......... .......... .......... .......... .......... 78%  322M 0s\n  4500K .......... .......... .......... .......... .......... 79% 57.7M 0s\n  4550K .......... .......... .......... .......... .......... 79% 19.1M 0s\n  4600K .......... .......... .......... .......... .......... 80% 77.1M 0s\n  4650K .......... .......... .......... .......... .......... 81%  192M 0s\n  4700K .......... .......... .......... .......... .......... 82%  327M 0s\n  4750K .......... .......... .......... .......... .......... 83%  347M 0s\n  4800K .......... .......... .......... .......... .......... 84%  325M 0s\n  4850K .......... .......... .......... .......... .......... 85%  304M 0s\n  4900K .......... .......... .......... .......... .......... 86%  356M 0s\n  4950K .......... .......... .......... .......... .......... 86%  302M 0s\n  5000K .......... .......... .......... .......... .......... 87%  349M 0s\n  5050K .......... .......... .......... .......... .......... 88%  289M 0s\n  5100K .......... .......... .......... .......... .......... 89%  340M 0s\n  5150K .......... .......... .......... .......... .......... 90%  324M 0s\n  5200K .......... .......... .......... .......... .......... 91%  363M 0s\n  5250K .......... .......... .......... .......... .......... 92%  322M 0s\n  5300K .......... .......... .......... .......... .......... 92% 57.7M 0s\n  5350K .......... .......... .......... .......... .......... 93% 19.1M 0s\n  5400K .......... .......... .......... .......... .......... 94%  181M 0s\n  5450K .......... .......... .......... .......... .......... 95%  294M 0s\n  5500K .......... .......... .......... .......... .......... 96%  363M 0s\n  5550K .......... .......... .......... .......... .......... 97%  313M 0s\n  5600K .......... .......... .......... .......... .......... 98%  343M 0s\n  5650K .......... .......... .......... .......... .......... 99%  306M 0s\n  5700K .......... .......... .......... .......... .......... 99%  361M 0s\n  5750K ...                                                   100% 6674G=0.1s\n\n2019-10-02 09:35:37 (42.2 MB/s) - ‘wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz’ saved [5891583/5891583]\n\n$ tar xvzf wrangler-v1.4.0-x86_64-unknown-linux-musl.tar.gz\nwrangler-v1.4.0-x86_64-unknown-linux-musl/\nwrangler-v1.4.0-x86_64-unknown-linux-musl/LICENSE-APACHE\nwrangler-v1.4.0-x86_64-unknown-linux-musl/LICENSE-MIT\nwrangler-v1.4.0-x86_64-unknown-linux-musl/wrangler\nwrangler-v1.4.0-x86_64-unknown-linux-musl/README.md\n$ wrangler-v1.4.0-x86_64-unknown-linux-musl/wrangler publish\n Using namespace for Workers Site &quot;__workers-chriswang-tech-workers_sites_assets&quot;\n Uploading...\n Success\nadded 2 packages from 2 contributors and audited 2 packages in 0.747s\nfound 0 vulnerabilities\n\n⬇️ Installing wranglerjs...\nnpm notice created a lockfile as package-lock.json. You should commit this file.\nnpm WARN wrangler-js@0.1.11 No description\nnpm WARN wrangler-js@0.1.11 No repository field.\nnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):\nnpm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {&quot;os&quot;:&quot;darwin&quot;,&quot;arch&quot;:&quot;any&quot;} (current: {&quot;os&quot;:&quot;linux&quot;,&quot;arch&quot;:&quot;x64&quot;})\n\nadded 323 packages from 199 contributors and audited 4226 packages in 10.948s\nfound 0 vulnerabilities\n\n⬇️ Installing wasm-pack...\n Built successfully, built project size is 11 KiB.\n Successfully published your script to workers.chriswang.tech/*\nCreating cache default...\nvendor/: found 4596 matching files                 \nUploading cache.zip to https://storage.googleapis.com/gitlab-com-runners-cache/project/7998729/default \nCreated cache\nUploading artifacts...\npublic: found 83 matching files                    \nUploading artifacts to coordinator... ok            id=309666254 responseStatus=201 Created token=Pyc6zLN8\nJob succeeded</code></pre></div>\n<p><strong>Voilà!</strong></p>","excerpt":"It's surprisingly easy to publish my existing GitLab page to Workers site. Step 1: Test locally Just follow the tutorial Start from an…"}},"pageContext":{"type":"posts","next":{"frontmatter":{"path":"/nyancat-spectrum","title":"Deploy Nyancat Server to Google Cloud using containers in 5 mins","tags":["docker","container","telnet","google-cloud"]},"fileAbsolutePath":"/opt/build/repo/src/posts/2018-10-02-nyancat-server-gcp-container.md"},"previous":{"frontmatter":{"path":"/welcome-v4","title":"Welcome (Again) to My Blog v4 and How I Built It ","tags":["v4","web","developers","devops","github","gitlab","gatsby","netlify-cms","netlify","jamstack"]},"fileAbsolutePath":"/opt/build/repo/src/posts/2020-08-26-welcome-v4.md"}}},"staticQueryHashes":["1425477374","3128451518"]}