Compare commits
	
		
			15 Commits
		
	
	
		
			master
			...
			tests-with
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| c0bc65ed3d | |||
| 6d52f56d27 | |||
| f5640a1d01 | |||
| 45d7e2c62e | |||
| 56b00934be | |||
| aa67a1e1b2 | |||
| 3fb8254c15 | |||
| 8a4794a344 | |||
| 4cf11798aa | |||
| e1867eb430 | |||
| 62c7355b4c | |||
| 202d0aefff | |||
| 01478dfd87 | |||
| a4837aff87 | |||
| ecc8f885fa | 
							
								
								
									
										11
									
								
								.env.sample
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								.env.sample
									
									
									
									
									
								
							| @ -1,11 +0,0 @@ | ||||
| # Optional, default `mock` | ||||
| #SPOKE_MODEL=shell-scripts | ||||
| # Optional, default `0` | ||||
| #FLASK_DEBUG=0 | ||||
| # Optional, default `http://localhost:5000` | ||||
| #BASE_URL=http://localhost:5000 | ||||
| # Optional, default `qemu:///system` if you're root, otherwise `qemu:///session` | ||||
| #VIRSH_DEFAULT_CONNECT_URI=qemu:///system | ||||
| #ADMIN_PANEL_ALLOW_EMAIL_ADDRESSES=3wc.capsul@doesthisthing.work | ||||
| # Optional, default no theme | ||||
| #THEME=yolocolo | ||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -11,7 +11,6 @@ instance/ | ||||
| .pytest_cache/ | ||||
| .coverage | ||||
| htmlcov/ | ||||
| /unittest-log-output.log | ||||
|  | ||||
| dist/ | ||||
| build/ | ||||
|  | ||||
| @ -59,7 +59,6 @@ def create_app(http_client_factory): | ||||
|     LOG_LEVEL=config.get("LOG_LEVEL", "INFO"), | ||||
|     SPOKE_HOST_ID=config.get("SPOKE_HOST_ID", "baikal"), | ||||
|     SPOKE_HOST_TOKEN=config.get("SPOKE_HOST_TOKEN", "changeme"), | ||||
|     SSH_USERNAME=os.environ.get("SSH_USERNAME", default="cyberian"), | ||||
|     HUB_TOKEN=config.get("HUB_TOKEN", "changeme"), | ||||
|  | ||||
|     # https://www.postgresql.org/docs/9.1/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS | ||||
|  | ||||
| @ -62,18 +62,6 @@ def sql_script(f, c): | ||||
|  | ||||
|     model.connection.commit() | ||||
|  | ||||
| @bp.cli.command('account-balance') | ||||
| @click.option('-u', help='users email address') | ||||
| @with_appcontext | ||||
| def account_balance(u): | ||||
|   vms = get_model().list_vms_for_account(u) | ||||
|   payments = get_model().list_payments_for_account(u) | ||||
|   click.echo(".") | ||||
|   click.echo(".") | ||||
|   click.echo(get_account_balance(vms, payments, datetime.utcnow())) | ||||
|   click.echo(".") | ||||
|  | ||||
|  | ||||
|  | ||||
| @bp.cli.command('cron-task') | ||||
| @with_appcontext | ||||
|  | ||||
| @ -108,8 +108,6 @@ def detail(id): | ||||
|   if vm is None: | ||||
|     return abort(404, f"{id} doesn't exist.") | ||||
|  | ||||
|   vm['ssh_username'] = current_app.config['SSH_USERNAME'] | ||||
|  | ||||
|   if vm['deleted']: | ||||
|     return render_template("capsul-detail.html", vm=vm, delete=True, deleted=True) | ||||
|  | ||||
|  | ||||
| @ -43,7 +43,7 @@ def init_app(app, is_running_server): | ||||
|   hasSchemaVersionTable = False | ||||
|   actionWasTaken = False | ||||
|   schemaVersion = 0 | ||||
|   desiredSchemaVersion = 19 | ||||
|   desiredSchemaVersion = 18 | ||||
|  | ||||
|   cursor = connection.cursor() | ||||
|  | ||||
|  | ||||
| @ -23,7 +23,7 @@ def pricing(): | ||||
|  | ||||
| @bp.route("/faq") | ||||
| def faq(): | ||||
|   return render_template("faq.html", ssh_username=current_app.config['SSH_USERNAME']) | ||||
|   return render_template("faq.html") | ||||
|  | ||||
| @bp.route("/about-ssh") | ||||
| def about_ssh(): | ||||
|  | ||||
| @ -1,8 +0,0 @@ | ||||
| DELETE FROM os_images WHERE id = 'guixsystem130'; | ||||
| DELETE FROM os_images WHERE id = 'archlinux'; | ||||
| UPDATE os_images SET deprecated = FALSE WHERE id = 'guixsystem120'; | ||||
| UPDATE os_images SET deprecated = FALSE WHERE id = 'centos7'; | ||||
| UPDATE os_images SET deprecated = FALSE WHERE id = 'centos8'; | ||||
| UPDATE os_images SET description = 'Ubuntu 20.04 LTS (Fossa)' WHERE id = 'ubuntu20'; | ||||
|  | ||||
| UPDATE schemaversion SET version = 18; | ||||
| @ -1,12 +0,0 @@ | ||||
| INSERT INTO os_images (id, template_image_file_name, description, deprecated) | ||||
| VALUES  ('guixsystem130', 'guixsystem/1.3.0/root.img.qcow2', 'Guix System 1.3.0', FALSE); | ||||
| INSERT INTO os_images (id, template_image_file_name, description, deprecated) | ||||
| VALUES  ('archlinux', 'archlinux/root.img.qcow2', 'Arch Linux', FALSE); | ||||
|  | ||||
| UPDATE os_images SET deprecated = TRUE WHERE id = 'guixsystem120'; | ||||
| UPDATE os_images SET deprecated = TRUE WHERE id = 'centos7'; | ||||
| UPDATE os_images SET deprecated = TRUE WHERE id = 'centos8'; | ||||
| UPDATE os_images SET description = 'Ubuntu 20.04 (Focal)' WHERE id = 'ubuntu20'; | ||||
|  | ||||
|  | ||||
| UPDATE schemaversion SET version = 19; | ||||
| @ -30,6 +30,6 @@ if virsh domuuid "$vmname" | grep -vqE '^[\t\s\n]*$'; then | ||||
| fi | ||||
|  | ||||
| # this gets the ipv4 | ||||
| ipv4="$(virsh domifaddr "$vmname" | awk '/ipv4/ {print $4}' | cut -d'/' -f1)" | ||||
| ipv4="$(virsh domifaddr "$vmname" | awk '/vnet/ {print $4}' | cut -d'/' -f1)" | ||||
|  | ||||
| echo "$exists $state $ipv4" | ||||
| @ -97,7 +97,7 @@ | ||||
|       </div> | ||||
|       <div class="row justify-start"> | ||||
|         <label class="align" for="ssh_username">SSH Username</label> | ||||
|         <span id="ssh_username">{{ vm['ssh_username'] }}</span> | ||||
|         <span id="ssh_username">cyberian</span> | ||||
|       </div> | ||||
|       <div class="row justify-start"> | ||||
|         <label class="align" for="ssh_authorized_keys">SSH Authorized Keys</label> | ||||
|  | ||||
| @ -21,13 +21,13 @@ | ||||
|    </li> | ||||
|    <li> | ||||
|      How do I log in? | ||||
|      <p>ssh to the ip provided to you using the "{{ ssh_username }}" user.</p> | ||||
|      <pre class='code'>$ ssh {{ ssh_username }}@1.2.3.4</pre> | ||||
|      <p>ssh to the ip provided to you using the cyberian user.</p> | ||||
|      <pre class='code'>$ ssh cyberian@1.2.3.4</pre> | ||||
|      <p>For more information, see <a href="/about-ssh">Understanding the Secure Shell Protocol (SSH)</a>.</p> | ||||
|    </li> | ||||
|    <li> | ||||
|      How do I change to the root user? | ||||
|      <p>The "{{ ssh_username }}" user has passwordless sudo access by default. This should work:</p> | ||||
|      <p>The cyberian user has passwordless sudo access by default. This should work:</p> | ||||
|      <pre class='code'> | ||||
| # Linux | ||||
| $ sudo su - | ||||
|  | ||||
| @ -7,11 +7,18 @@ | ||||
|     <h1>SUPPORT</h1> | ||||
|   </div> | ||||
|   <div class="row half-margin"> | ||||
|     <a href="mailto:support@cyberia.club?subject=capsul%20support%20request">support@cyberia.club</a> | ||||
|     <a href="mailto:support@cyberia.club?subject=Please%20help!">support@cyberia.club</a>  | ||||
|   </div> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block subcontent %} | ||||
| <p> | ||||
|   Note: We maintain a searchable archive of all support emails at  | ||||
|   <a href="https://lists.cyberia.club/~cyberia/support">https://lists.cyberia.club/~cyberia/support</a> | ||||
| </p> | ||||
| <p> | ||||
|   If you do not want your mail to appear in a public archive, email <a href="mailto:capsul@cyberia.club?subject=Please%20help!">capsul@cyberia.club</a> instead. | ||||
| </p> | ||||
| <p> | ||||
|   Please describe your problem or feature request, and we will do our best to get back to you promptly. Thank you very much. | ||||
| </p> | ||||
|  | ||||
| @ -12,6 +12,8 @@ class LoginTests(BaseTestCase): | ||||
|             response = client.get(url_for("auth.login")) | ||||
|             self.assert_200(response) | ||||
|  | ||||
|             # FIXME test generated login link | ||||
|  | ||||
|     def test_login_magiclink(self): | ||||
|         token, ignoreCaseMatches = get_model().login('test@example.com') | ||||
|  | ||||
|  | ||||
| @ -29,6 +29,7 @@ class ConsoleTests(BaseTestCase): | ||||
|     def setUp(self): | ||||
|         super().setUp() | ||||
|  | ||||
|  | ||||
|         get_model().cursor.execute("DELETE FROM host_operation") | ||||
|         get_model().cursor.execute("DELETE FROM operations") | ||||
|         get_model().cursor.execute("DELETE FROM vm_ssh_host_key") | ||||
| @ -47,6 +48,8 @@ class ConsoleTests(BaseTestCase): | ||||
|         for host_id in host_ids: | ||||
|           get_model().host_heartbeat(host_id) | ||||
|  | ||||
|        | ||||
|  | ||||
|     def test_index(self): | ||||
|         self._login('test@example.com') | ||||
|         with self.client as client: | ||||
| @ -77,6 +80,7 @@ class ConsoleTests(BaseTestCase): | ||||
|                 0 | ||||
|             ) | ||||
|  | ||||
|  | ||||
|     def test_create_fails_capacity(self): | ||||
|         with self.client as client: | ||||
|  | ||||
| @ -158,6 +162,7 @@ class ConsoleTests(BaseTestCase): | ||||
|                 url_for("console.index") + f'?created={vm_id}' | ||||
|             ) | ||||
|  | ||||
|  | ||||
|     def test_keys_loads(self): | ||||
|         self._login('test@example.com') | ||||
|         with self.client as client: | ||||
| @ -210,3 +215,5 @@ class ConsoleTests(BaseTestCase): | ||||
|                 'A key with that name already exists', | ||||
|                 category='message' | ||||
|             ) | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -116,4 +116,4 @@ class TestHTTPClient: | ||||
|     # in the same order as the tasks that we passed in -- which were in the same order as online_hosts | ||||
|     results = await asyncio.gather(*tasks) | ||||
|  | ||||
|     return results | ||||
|     return results | ||||
| @ -15,8 +15,8 @@ services: | ||||
|       - "5000:5000" | ||||
|     environment: | ||||
|       - "POSTGRES_CONNECTION_PARAMETERS=host=db port=5432 user=capsul password=capsul dbname=capsul" | ||||
|       - SPOKE_MODEL | ||||
|       - FLASK_DEBUG | ||||
|       - SPOKE_MODEL=shell-scripts | ||||
|         #- FLASK_DEBUG=1 | ||||
|       - BASE_URL=http://localhost:5000 | ||||
|       - ADMIN_PANEL_ALLOW_EMAIL_ADDRESSES=3wc.capsul@doesthisthing.work | ||||
|       - VIRSH_DEFAULT_CONNECT_URI=qemu:///system | ||||
|  | ||||
| @ -3,7 +3,6 @@ | ||||
| Create a `.env` file to set up the application configuration: | ||||
|  | ||||
| ``` | ||||
| cp .env.sample .env | ||||
| nano .env | ||||
| ``` | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	